]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 11 Nov 2013 14:55:48 +0000 (14:55 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 11 Nov 2013 14:55:48 +0000 (14:55 +0000)
MagickCore/fx.c
MagickCore/property.c

index e30a8bf079d82cd9f04fbb4273fe8b33a700dad5..778bbdea5d687aad30acf38a281b1691dc5219da 100644 (file)
@@ -208,23 +208,23 @@ MagickPrivate FxInfo *AcquireFxInfo(const Image *image,const char *expression,
     Convert compound to simple operators.
   */
   fx_op[1]='\0';
-  *fx_op=(char) LeftShiftOperator;
+  *fx_op=(char) ((int) LeftShiftOperator);
   (void) SubstituteString(&fx_info->expression,"<<",fx_op);
-  *fx_op=(char) RightShiftOperator;
+  *fx_op=(char) ((int) RightShiftOperator);
   (void) SubstituteString(&fx_info->expression,">>",fx_op);
-  *fx_op=(char) LessThanEqualOperator;
+  *fx_op=(char) ((int) LessThanEqualOperator);
   (void) SubstituteString(&fx_info->expression,"<=",fx_op);
-  *fx_op=(char) GreaterThanEqualOperator;
+  *fx_op=(char) ((int) GreaterThanEqualOperator);
   (void) SubstituteString(&fx_info->expression,">=",fx_op);
-  *fx_op=(char) EqualOperator;
+  *fx_op=(char) ((int) EqualOperator);
   (void) SubstituteString(&fx_info->expression,"==",fx_op);
-  *fx_op=(char) NotEqualOperator;
+  *fx_op=(char) ((int) NotEqualOperator);
   (void) SubstituteString(&fx_info->expression,"!=",fx_op);
-  *fx_op=(char) LogicalAndOperator;
+  *fx_op=(char) ((int) LogicalAndOperator);
   (void) SubstituteString(&fx_info->expression,"&&",fx_op);
-  *fx_op=(char) LogicalOrOperator;
+  *fx_op=(char) ((int) LogicalOrOperator);
   (void) SubstituteString(&fx_info->expression,"||",fx_op);
-  *fx_op=(char) ExponentialNotation;
+  *fx_op=(char) ((int) ExponentialNotation);
   (void) SubstituteString(&fx_info->expression,"**",fx_op);
   return(fx_info);
 }
index 7ea082a38d0f60da190fd45a5e9500171bafaa4b..8e770ef29da0d0e183b3ce2276b17c6219507339 100644 (file)
@@ -1949,14 +1949,28 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
           }
         else
           {
+            /*
+              Handle special cases when Bezier curves are used to describe
+              corners and straight lines.
+            */
             if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
                 (point[0].x == point[1].x) && (point[0].y == point[1].y))
-              (void) FormatLocaleString(message,MaxTextExtent,"L %g,%g\n",
-                point[1].x,point[1].y);
-            else
               (void) FormatLocaleString(message,MaxTextExtent,
-                "C %g,%g %g,%g %g,%g\n",last[2].x,last[2].y,
-                point[0].x,point[0].y,point[1].x,point[1].y);
+                "  %g %g l\n",point[1].x,point[1].y);
+            else
+              if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
+                (void) FormatLocaleString(message,MaxTextExtent,
+                  "  %g %g %g %g v\n",point[0].x,point[0].y,
+                  point[1].x,point[1].y);
+              else
+                if ((point[0].x == point[1].x) && (point[0].y == point[1].y))
+                  (void) FormatLocaleString(message,MaxTextExtent,
+                    "  %g %g %g %g y\n",last[2].x,last[2].y,
+                    point[1].x,point[1].y);
+                else
+                  (void) FormatLocaleString(message,MaxTextExtent,
+                    "  %g %g %g %g %g %g c\n",last[2].x,
+                    last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
             for (i=0; i < 3; i++)
               last[i]=point[i];
           }
@@ -1968,17 +1982,29 @@ static char *TraceSVGClippath(const unsigned char *blob,size_t length,
         */
         if (knot_count == 0)
           {
+           /*
+              Same special handling as above except we compare to the
+              first point in the path and close the path.
+            */
             if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
                 (first[0].x == first[1].x) && (first[0].y == first[1].y))
               (void) FormatLocaleString(message,MaxTextExtent,
-                "L %g,%g Z\n",first[1].x,first[1].y);
+                "  %g %g l z\n",first[1].x,first[1].y);
             else
-              {
+              if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
                 (void) FormatLocaleString(message,MaxTextExtent,
-                  "C %g,%g %g,%g %g,%g Z\n",last[2].x,
-                  last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
-                (void) ConcatenateString(&path,message);
-              }
+                  "  %g %g %g %g v z\n",first[0].x,first[0].y,
+                  first[1].x,first[1].y);
+              else
+                if ((first[0].x == first[1].x) && (first[0].y == first[1].y))
+                  (void) FormatLocaleString(message,MaxTextExtent,
+                    "  %g %g %g %g y z\n",last[2].x,last[2].y,
+                    first[1].x,first[1].y);
+                else
+                  (void) FormatLocaleString(message,MaxTextExtent,
+                    "  %g %g %g %g %g %g c z\n",last[2].x,
+                    last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
+            (void) ConcatenateString(&path,message);
             in_subpath=MagickFalse;
           }
         break;