]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 3 Sep 2012 23:04:46 +0000 (23:04 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 3 Sep 2012 23:04:46 +0000 (23:04 +0000)
MagickCore/draw.c
coders/ps.c
coders/ps2.c
coders/ps3.c
coders/xps.c

index 1a18924064fcac51fc1de7d80dbba3806bc673d0..9be6fcecc3b0ca0919c1435e618208065d9f126f 100644 (file)
@@ -1165,8 +1165,8 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image,
   GetPixelInfo(image,&zero);
   start=(ssize_t) ceil(edge.y1-0.5);
   stop=(ssize_t) ceil(edge.y2-0.5);
-  height=(size_t) (floor(edge.y2+0.5)-ceil(edge.y1-0.5));
-  width=(size_t) (floor(edge.x2+0.5)-ceil(edge.x1-0.5));
+  height=(size_t) (floor(edge.y2-0.5)-ceil(edge.y1-0.5));
+  width=(size_t) (floor(edge.x2-0.5)-ceil(edge.x1-0.5));
   source_view=AcquireVirtualCacheView(source,exception);
   image_view=AcquireAuthenticCacheView(image,exception);
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
@@ -1198,14 +1198,14 @@ MagickExport MagickBooleanType DrawAffineImage(Image *image,
     if (inverse_edge.x2 < inverse_edge.x1)
       continue;
     q=GetCacheViewAuthenticPixels(image_view,(ssize_t) ceil(inverse_edge.x1-
-      0.5),y,(size_t) ((ssize_t) floor(inverse_edge.x2+0.5)-(ssize_t) floor(
-      inverse_edge.x1+0.5)+1),1,exception);
+      0.5),y,(size_t) ((ssize_t) floor(inverse_edge.x2-0.5)-(ssize_t) ceil(
+      inverse_edge.x1-0.5)),1,exception);
     if (q == (Quantum *) NULL)
       continue;
     pixel=zero;
     composite=zero;
     x_offset=0;
-    for (x=(ssize_t) ceil(inverse_edge.x1-0.5); x <= (ssize_t) floor(inverse_edge.x2+0.5); x++)
+    for (x=(ssize_t) ceil(inverse_edge.x1-0.5); x <= (ssize_t) floor(inverse_edge.x2-0.5); x++)
     {
       point.x=(double) x*inverse_affine.sx+y*inverse_affine.ry+
         inverse_affine.tx;
@@ -3855,22 +3855,22 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image,
   bounds.y1=bounds.y1 < 0.0 ? 0.0 : (size_t) ceil(bounds.y1-0.5) >=
     image->rows ? (double) image->rows-1.0 : bounds.y1;
   bounds.x2+=(mid+1.0);
-  bounds.x2=bounds.x2 < 0.0 ? 0.0 : (size_t) floor(bounds.x2+0.5) >=
+  bounds.x2=bounds.x2 < 0.0 ? 0.0 : (size_t) floor(bounds.x2-0.5) >=
     image->columns ? (double) image->columns-1.0 : bounds.x2;
   bounds.y2+=(mid+1.0);
-  bounds.y2=bounds.y2 < 0.0 ? 0.0 : (size_t) floor(bounds.y2+0.5) >=
+  bounds.y2=bounds.y2 < 0.0 ? 0.0 : (size_t) floor(bounds.y2-0.5) >=
     image->rows ? (double) image->rows-1.0 : bounds.y2;
   status=MagickTrue;
   image_view=AcquireAuthenticCacheView(image,exception);
-  height=(size_t) (floor(bounds.y2+0.5)-ceil(bounds.y1-0.5));
-  width=(size_t) (floor(bounds.x2+0.5)-ceil(bounds.x1-0.5));
+  height=(size_t) (floor(bounds.y2-0.5)-ceil(bounds.y1-0.5));
+  width=(size_t) (floor(bounds.x2-0.5)-ceil(bounds.x1-0.5));
   if (primitive_info->coordinates == 1)
     {
       /*
         Draw point.
       */
       start=(ssize_t) ceil(bounds.y1-0.5);
-      stop=(ssize_t) floor(bounds.y2+0.5);
+      stop=(ssize_t) floor(bounds.y2-0.5);
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
       #pragma omp parallel for schedule(static) shared(status) \
         dynamic_number_threads(image,width,height,1)
@@ -3896,7 +3896,7 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image,
         if (status == MagickFalse)
           continue;
         start=(ssize_t) ceil(bounds.x1-0.5);
-        stop=(ssize_t) floor(bounds.x2+0.5);
+        stop=(ssize_t) floor(bounds.x2-0.5);
         x=start;
         q=GetCacheViewAuthenticPixels(image_view,x,y,(size_t) (stop-x+1),
           1,exception);
@@ -3933,7 +3933,7 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image,
   if (image->alpha_trait != BlendPixelTrait)
     (void) SetImageAlphaChannel(image,OpaqueAlphaChannel,exception);
   start=(ssize_t) ceil(bounds.y1-0.5);
-  stop=(ssize_t) floor(bounds.y2+0.5);
+  stop=(ssize_t) floor(bounds.y2-0.5);
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
   #pragma omp parallel for schedule(static) shared(status) \
     dynamic_number_threads(image,width,height,1)
@@ -3964,7 +3964,7 @@ static MagickBooleanType DrawPolygonPrimitive(Image *image,
     if (status == MagickFalse)
       continue;
     start=(ssize_t) ceil(bounds.x1-0.5);
-    stop=(ssize_t) floor(bounds.x2+0.5);
+    stop=(ssize_t) floor(bounds.x2-0.5);
     q=GetCacheViewAuthenticPixels(image_view,start,y,(size_t) (stop-start+1),1,
       exception);
     if (q == (Quantum *) NULL)
index fb563c8b581bb559ae401502aca43903b1a191b2..7b48a8de6605e22a49515d22ef59b9152ea43ae0 100644 (file)
@@ -1539,7 +1539,7 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image,
           {
             (void) FormatLocaleString(buffer,MaxTextExtent,
               "%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5),
-              ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));
+              ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5));
             (void) WriteBlobString(image,buffer);
             (void) FormatLocaleString(buffer,MaxTextExtent,
               "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
@@ -2150,11 +2150,11 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image,
     {
       (void) FormatLocaleString(buffer,MaxTextExtent,
         "%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5),
-        ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));
+        ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5));
       (void) WriteBlobString(image,buffer);
       (void) FormatLocaleString(buffer,MaxTextExtent,
-        "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
-        bounds.x2,bounds.y2);
+        "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,bounds.x2,
+        bounds.y2);
       (void) WriteBlobString(image,buffer);
     }
   (void) WriteBlobString(image,"%%EOF\n");
index 06e19c36c47d67a33524f5b0a2eb3c90a21a2e12..47c3b0f9c34589812660d2ad872f5db6a18643df 100644 (file)
@@ -585,7 +585,7 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image,
           {
             (void) FormatLocaleString(buffer,MaxTextExtent,
               "%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5),
-              ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));
+              ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5));
             (void) WriteBlobString(image,buffer);
             (void) FormatLocaleString(buffer,MaxTextExtent,
               "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
@@ -1111,7 +1111,7 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image,
     {
       (void) FormatLocaleString(buffer,MaxTextExtent,
         "%%%%BoundingBox: %.20g %.20g %.20g %.20g\n",ceil(bounds.x1-0.5),
-        ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));
+        ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5));
       (void) WriteBlobString(image,buffer);
       (void) FormatLocaleString(buffer,MaxTextExtent,
         "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
index 3cf1f455bb57e8b743e2bc66f9eef651d95204a3..160d25255dc533de3c176fe2fb8b9efecbb8a9e8 100644 (file)
@@ -1012,8 +1012,8 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
         else
           {
             (void) FormatLocaleString(buffer,MaxTextExtent,
-              "%%%%BoundingBox: %g %g %g %g\n",floor(bounds.x1+0.5),
-              floor(bounds.y1+0.5),ceil(bounds.x2-0.5),ceil(bounds.y2-0.5));
+              "%%%%BoundingBox: %g %g %g %g\n",ceil(bounds.x1-0.5),
+              ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5));
             (void) WriteBlobString(image,buffer);
             (void) FormatLocaleString(buffer,MaxTextExtent,
               "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,
@@ -1584,12 +1584,12 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
   if (page > 1)
     {
       (void) FormatLocaleString(buffer,MaxTextExtent,
-        "%%%%BoundingBox: %g %g %g %g\n",floor(bounds.x1+0.5),
-        floor(bounds.y1+0.5),ceil(bounds.x2-0.5),ceil(bounds.y2-0.5));
+        "%%%%BoundingBox: %g %g %g %g\n",ceil(bounds.x1-0.5),
+        ceil(bounds.y1-0.5),floor(bounds.x2-0.5),floor(bounds.y2-0.5));
       (void) WriteBlobString(image,buffer);
       (void) FormatLocaleString(buffer,MaxTextExtent,
-        "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,
-        bounds.x2,bounds.y2);
+        "%%%%HiResBoundingBox: %g %g %g %g\n",bounds.x1,bounds.y1,bounds.x2,
+        bounds.y2);
       (void) WriteBlobString(image,buffer);
     }
   (void) WriteBlobString(image,"%%EOF\n");
index 3cbf5c742400bd9a50bf535b792a0c72fb315856..23e8af751e1cc6b967241ecb3c88813e3e973f3b 100644 (file)
@@ -252,8 +252,8 @@ static Image *ReadXPSImage(const ImageInfo *image_info,ExceptionInfo *exception)
     /*
       Set XPS render geometry.
     */
-    width=(size_t) floor(bounds.x2-bounds.x1+0.5);
-    height=(size_t) floor(bounds.y2-bounds.y1+0.5);
+    width=(size_t) (floor(bounds.x2-0.5)-ceil(bounds.x1-0.5));
+    height=(size_t) (floor(bounds.y2-0.5)-ceil(bounds.y1-0.5));
     if (width > page.width)
       page.width=width;
     if (height > page.height)
@@ -284,8 +284,7 @@ static Image *ReadXPSImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if (image_info->page != (char *) NULL)
     (void) ParseAbsoluteGeometry(image_info->page,&page);
   page.width=(size_t) floor(page.width*image->resolution.y/delta.x+0.5);
-  page.height=(size_t) floor(page.height*image->resolution.y/delta.y+
-    0.5);
+  page.height=(size_t) floor(page.height*image->resolution.y/delta.y+0.5);
   (void) FormatLocaleString(options,MaxTextExtent,"-g%.20gx%.20g ",(double)
     page.width,(double) page.height);
   image=DestroyImage(image);