]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/shear.c
(no commit message)
[imagemagick] / MagickCore / shear.c
index 59125fc2dd62461be43e49bc614ac7b0f2517327..56e9ceaf9dd62e0f1f1ee1e1e871310ee56861a7 100644 (file)
@@ -218,8 +218,8 @@ static MagickBooleanType CropToFitImage(Image **image,
 %
 */
 
-static void RadonProjection(const Image *image,MatrixInfo *source_cells,
-  MatrixInfo *destination_cells,const ssize_t sign,size_t *projection)
+static void RadonProjection(const Image *image,MatrixInfo *source_matrixs,
+  MatrixInfo *destination_matrixs,const ssize_t sign,size_t *projection)
 {
   MatrixInfo
     *swap;
@@ -234,8 +234,8 @@ static void RadonProjection(const Image *image,MatrixInfo *source_cells,
   size_t
     step;
 
-  p=source_cells;
-  q=destination_cells;
+  p=source_matrixs;
+  q=destination_matrixs;
   for (step=1; step < GetMatrixColumns(p); step*=2)
   {
     for (x=0; x < (ssize_t) GetMatrixColumns(p); x+=2*(ssize_t) step)
@@ -247,45 +247,45 @@ static void RadonProjection(const Image *image,MatrixInfo *source_cells,
         y;
 
       unsigned short
-        cell,
+        element,
         neighbor;
 
       for (i=0; i < (ssize_t) step; i++)
       {
         for (y=0; y < (ssize_t) (GetMatrixRows(p)-i-1); y++)
         {
-          if (GetMatrixElement(p,x+i,y,&cell) == MagickFalse)
+          if (GetMatrixElement(p,x+i,y,&element) == MagickFalse)
             continue;
           if (GetMatrixElement(p,x+i+step,y+i,&neighbor) == MagickFalse)
             continue;
-          neighbor+=cell;
+          neighbor+=element;
           if (SetMatrixElement(q,x+2*i,y,&neighbor) == MagickFalse)
             continue;
           if (GetMatrixElement(p,x+i+step,y+i+1,&neighbor) == MagickFalse)
             continue;
-          neighbor+=cell;
+          neighbor+=element;
           if (SetMatrixElement(q,x+2*i+1,y,&neighbor) == MagickFalse)
             continue;
         }
         for ( ; y < (ssize_t) (GetMatrixRows(p)-i); y++)
         {
-          if (GetMatrixElement(p,x+i,y,&cell) == MagickFalse)
+          if (GetMatrixElement(p,x+i,y,&element) == MagickFalse)
             continue;
           if (GetMatrixElement(p,x+i+step,y+i,&neighbor) == MagickFalse)
             continue;
-          neighbor+=cell;
+          neighbor+=element;
           if (SetMatrixElement(q,x+2*i,y,&neighbor) == MagickFalse)
             continue;
-          if (SetMatrixElement(q,x+2*i+1,y,&cell) == MagickFalse)
+          if (SetMatrixElement(q,x+2*i+1,y,&element) == MagickFalse)
             continue;
         }
         for ( ; y < (ssize_t) GetMatrixRows(p); y++)
         {
-          if (GetMatrixElement(p,x+i,y,&cell) == MagickFalse)
+          if (GetMatrixElement(p,x+i,y,&element) == MagickFalse)
             continue;
-          if (SetMatrixElement(q,x+2*i,y,&cell) == MagickFalse)
+          if (SetMatrixElement(q,x+2*i,y,&element) == MagickFalse)
             continue;
-          if (SetMatrixElement(q,x+2*i+1,y,&cell) == MagickFalse)
+          if (SetMatrixElement(q,x+2*i+1,y,&element) == MagickFalse)
             continue;
         }
       }
@@ -313,14 +313,14 @@ static void RadonProjection(const Image *image,MatrixInfo *source_cells,
         delta;
 
       unsigned short
-        cell,
+        element,
         neighbor;
 
-      if (GetMatrixElement(p,x,y,&cell) == MagickFalse)
+      if (GetMatrixElement(p,x,y,&element) == MagickFalse)
         continue;
       if (GetMatrixElement(p,x,y+1,&neighbor) == MagickFalse)
         continue;
-      delta=(ssize_t) cell-(ssize_t) neighbor;
+      delta=(ssize_t) element-(ssize_t) neighbor;
       sum+=delta*delta;
     }
     projection[GetMatrixColumns(p)+sign*x-1]=sum;
@@ -334,8 +334,8 @@ static MagickBooleanType RadonTransform(const Image *image,
     *image_view;
 
   MatrixInfo
-    *destination_cells,
-    *source_cells;
+    *destination_matrixs,
+    *source_matrixs;
 
   MagickBooleanType
     status;
@@ -357,23 +357,23 @@ static MagickBooleanType RadonTransform(const Image *image,
     bits[256];
 
   for (width=1; width < ((image->columns+7)/8); width<<=1) ;
-  source_cells=AcquireMatrixInfo(width,image->rows,sizeof(unsigned short),
+  source_matrixs=AcquireMatrixInfo(width,image->rows,sizeof(unsigned short),
     exception);
-  destination_cells=AcquireMatrixInfo(width,image->rows,sizeof(unsigned short),
+  destination_matrixs=AcquireMatrixInfo(width,image->rows,sizeof(unsigned short),
     exception);
-  if ((source_cells == (MatrixInfo *) NULL) ||
-      (destination_cells == (MatrixInfo *) NULL))
+  if ((source_matrixs == (MatrixInfo *) NULL) ||
+      (destination_matrixs == (MatrixInfo *) NULL))
     {
-      if (destination_cells != (MatrixInfo *) NULL)
-        destination_cells=DestroyMatrixInfo(destination_cells);
-      if (source_cells != (MatrixInfo *) NULL)
-        source_cells=DestroyMatrixInfo(source_cells);
+      if (destination_matrixs != (MatrixInfo *) NULL)
+        destination_matrixs=DestroyMatrixInfo(destination_matrixs);
+      if (source_matrixs != (MatrixInfo *) NULL)
+        source_matrixs=DestroyMatrixInfo(source_matrixs);
       return(MagickFalse);
     }
-  if (ResetMatrixInfo(source_cells) == MagickFalse)
+  if (NullMatrix(source_matrixs) == MagickFalse)
     {
-      destination_cells=DestroyMatrixInfo(destination_cells);
-      source_cells=DestroyMatrixInfo(source_cells);
+      destination_matrixs=DestroyMatrixInfo(destination_matrixs);
+      source_matrixs=DestroyMatrixInfo(source_matrixs);
       return(MagickFalse);
     }
   for (i=0; i < 256; i++)
@@ -427,7 +427,7 @@ static MagickBooleanType RadonTransform(const Image *image,
       if (bit == 8)
         {
           value=bits[byte];
-          (void) SetMatrixElement(source_cells,--i,y,&value);
+          (void) SetMatrixElement(source_matrixs,--i,y,&value);
           bit=0;
           byte=0;
         }
@@ -437,11 +437,11 @@ static MagickBooleanType RadonTransform(const Image *image,
       {
         byte<<=(8-bit);
         value=bits[byte];
-        (void) SetMatrixElement(source_cells,--i,y,&value);
+        (void) SetMatrixElement(source_matrixs,--i,y,&value);
       }
   }
-  RadonProjection(image,source_cells,destination_cells,-1,projection);
-  (void) ResetMatrixInfo(source_cells);
+  RadonProjection(image,source_matrixs,destination_matrixs,-1,projection);
+  (void) NullMatrix(source_matrixs);
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
   #pragma omp parallel for schedule(static,4) shared(status) \
     magick_threads(image,image,image->rows,1)
@@ -484,7 +484,7 @@ static MagickBooleanType RadonTransform(const Image *image,
       if (bit == 8)
         {
           value=bits[byte];
-          (void) SetMatrixElement(source_cells,i++,y,&value);
+          (void) SetMatrixElement(source_matrixs,i++,y,&value);
           bit=0;
           byte=0;
         }
@@ -494,13 +494,13 @@ static MagickBooleanType RadonTransform(const Image *image,
       {
         byte<<=(8-bit);
         value=bits[byte];
-        (void) SetMatrixElement(source_cells,i++,y,&value);
+        (void) SetMatrixElement(source_matrixs,i++,y,&value);
       }
   }
-  RadonProjection(image,source_cells,destination_cells,1,projection);
+  RadonProjection(image,source_matrixs,destination_matrixs,1,projection);
   image_view=DestroyCacheView(image_view);
-  destination_cells=DestroyMatrixInfo(destination_cells);
-  source_cells=DestroyMatrixInfo(source_cells);
+  destination_matrixs=DestroyMatrixInfo(destination_matrixs);
+  source_matrixs=DestroyMatrixInfo(source_matrixs);
   return(MagickTrue);
 }
 
@@ -759,13 +759,6 @@ MagickExport Image *IntegralRotateImage(const Image *image,size_t rotations,
   rotate_view=AcquireAuthenticCacheView(rotate_image,exception);
   switch (rotations)
   {
-    case 0:
-    {
-      /*
-        Rotate 0 degrees.
-      */
-      break;
-    }
     case 1:
     {
       size_t
@@ -1104,6 +1097,8 @@ MagickExport Image *IntegralRotateImage(const Image *image,size_t rotations,
         page.x=(ssize_t) (page.width-rotate_image->columns-page.x);
       break;
     }
+    default:
+      break;
   }
   rotate_view=DestroyCacheView(rotate_view);
   image_view=DestroyCacheView(image_view);