...
authorCristy <urban-warrior@imagemagick.org>
Fri, 4 May 2018 00:06:56 +0000 (20:06 -0400)
committerCristy <urban-warrior@imagemagick.org>
Fri, 4 May 2018 00:06:56 +0000 (20:06 -0400)
MagickCore/draw.c
coders/svg.c

index c93612f5e1b18b7bc6dac4a06aa9b81b855ef67b..c06fa95e6d3fa18e50ceb1f68a093cb10bf8cc40 100644 (file)
@@ -6583,8 +6583,8 @@ static PrimitiveInfo *TraceStrokePolygon(const Image *image,
     number_vertices+2UL,sizeof(*polygon_primitive));
   if (polygon_primitive == (PrimitiveInfo *) NULL)
     return((PrimitiveInfo *) NULL);
-  (void) memcpy(polygon_primitive,primitive_info,(size_t)
-    number_vertices*sizeof(*polygon_primitive));
+  (void) memcpy(polygon_primitive,primitive_info,(size_t) number_vertices*
+    sizeof(*polygon_primitive));
   closed_path=primitive_info[0].closed_subpath;
   if (((draw_info->linejoin == RoundJoin) ||
        (draw_info->linejoin == MiterJoin)) && (closed_path != MagickFalse))
index 6e624cd028eefb4b0175431adafd1d7f21de2455..8ef0cdb9b0a2b7972690f66f319db94da2137491 100644 (file)
@@ -184,6 +184,9 @@ typedef struct _SVGInfo
   xmlDocPtr
     document;
 #endif
+
+  ssize_t
+    svgDepth;
 } SVGInfo;
 \f
 /*
@@ -1143,6 +1146,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
         }
       if (LocaleCompare((const char *) name,"svg") == 0)
         {
+          svg_info->svgDepth++;
           PushGraphicContext(id);
           (void) FormatLocaleFile(svg_info->file,"compliance \"SVG\"\n");
           (void) FormatLocaleFile(svg_info->file,"fill \"black\"\n");
@@ -2309,7 +2313,7 @@ static void SVGStartElement(void *context,const xmlChar *name,
             0.0;
           (void) FormatLocaleFile(svg_info->file,"affine %g 0 0 %g %g %g\n",
             sx,sy,tx,ty);
-          if (*background != '\0')
+          if ((svg_info->svgDepth == 1) && (*background != '\0'))
             {
               PushGraphicContext(id);
               (void) FormatLocaleFile(svg_info->file,"fill %s\n",background);
@@ -2556,6 +2560,7 @@ static void SVGEndElement(void *context,const xmlChar *name)
       if (LocaleCompare((const char *) name,"svg") == 0)
         {
           (void) FormatLocaleFile(svg_info->file,"pop graphic-context\n");
+          svg_info->svgDepth--;
           break;
         }
       break;
@@ -3339,6 +3344,7 @@ static Image *ReadSVGImage(const ImageInfo *image_info,ExceptionInfo *exception)
   svg_info->image_info=image_info;
   svg_info->bounds.width=image->columns;
   svg_info->bounds.height=image->rows;
+  svg_info->svgDepth=0;
   if (image_info->size != (char *) NULL)
     (void) CloneString(&svg_info->size,image_info->size);
   if (image->debug != MagickFalse)