From: Cristy Date: Sun, 29 Apr 2018 19:27:26 +0000 (-0400) Subject: Restore draw clip path behavior X-Git-Tag: 7.0.7-29~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fb08024370aea8c4cb1a93f1bb1bf2d88916e2c6;p=imagemagick Restore draw clip path behavior --- diff --git a/MagickCore/color.h b/MagickCore/color.h index 8b1934ed6..1a3915baf 100644 --- a/MagickCore/color.h +++ b/MagickCore/color.h @@ -33,6 +33,7 @@ typedef enum SVGCompliance = 0x0001, X11Compliance = 0x0002, XPMCompliance = 0x0004, + MVGCompliance = 0x0008, AllCompliance = 0x7fffffff } ComplianceType; diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 77842412d..a64507a5a 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -267,6 +267,7 @@ MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, (void) CloneString(&clone_info->primitive,draw_info->primitive); if (draw_info->geometry != (char *) NULL) (void) CloneString(&clone_info->geometry,draw_info->geometry); + clone_info->compliance=draw_info->compliance; clone_info->viewbox=draw_info->viewbox; clone_info->affine=draw_info->affine; clone_info->gravity=draw_info->gravity; @@ -2130,6 +2131,9 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, graphic_context[n]->clipping_mask=DrawClippingMask(image, graphic_context[n],clip_path,exception); clip_path=DestroyString(clip_path); + if (draw_info->compliance != SVGCompliance) + status=SetImageMask(image,WritePixelMask, + graphic_context[n]->clipping_mask,exception); } break; } @@ -2182,6 +2186,12 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, primitive_type=ColorPrimitive; break; } + if (LocaleCompare("compliance",keyword) == 0) + { + GetNextToken(q,&q,extent,token); + graphic_context[n]->compliance=(ComplianceType) ParseCommandOption( + MagickComplianceOptions,MagickFalse,token); + } status=MagickFalse; break; } @@ -4665,7 +4675,10 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, ((IsPixelInfoGray(&draw_info->fill) == MagickFalse) || (IsPixelInfoGray(&draw_info->stroke) == MagickFalse))) (void) SetImageColorspace(image,sRGBColorspace,exception); - status=SetImageMask(image,WritePixelMask,draw_info->clipping_mask,exception); + status=MagickTrue; + if (draw_info->compliance == SVGCompliance) + status=SetImageMask(image,WritePixelMask,draw_info->clipping_mask, + exception); x=(ssize_t) ceil(primitive_info->point.x-0.5); y=(ssize_t) ceil(primitive_info->point.y-0.5); image_view=AcquireAuthenticCacheView(image,exception); @@ -5103,7 +5116,8 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image, } } image_view=DestroyCacheView(image_view); - status&=SetImageMask(image,WritePixelMask,(Image *) NULL,exception); + if (draw_info->compliance == SVGCompliance) + status&=SetImageMask(image,WritePixelMask,(Image *) NULL,exception); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," end draw-primitive"); return(status != 0 ? MagickTrue : MagickFalse); diff --git a/MagickCore/draw.h b/MagickCore/draw.h index 0bd9209e9..09707a6e9 100644 --- a/MagickCore/draw.h +++ b/MagickCore/draw.h @@ -22,6 +22,7 @@ #include "MagickCore/image.h" #include "MagickCore/pixel.h" #include "MagickCore/type.h" +#include "MagickCore/color.h" #if defined(__cplusplus) || defined(c_plusplus) extern "C" { @@ -330,6 +331,9 @@ typedef struct _DrawInfo Image *clipping_mask; + + ComplianceType + compliance; } DrawInfo; typedef struct _PrimitiveInfo diff --git a/coders/svg.c b/coders/svg.c index 4ac2bf199..6e624cd02 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -1144,6 +1144,7 @@ static void SVGStartElement(void *context,const xmlChar *name, if (LocaleCompare((const char *) name,"svg") == 0) { PushGraphicContext(id); + (void) FormatLocaleFile(svg_info->file,"compliance \"SVG\"\n"); (void) FormatLocaleFile(svg_info->file,"fill \"black\"\n"); (void) FormatLocaleFile(svg_info->file,"fill-opacity 1\n"); (void) FormatLocaleFile(svg_info->file,"stroke \"none\"\n"); diff --git a/configure b/configure index 906640aea..d83bc5d7a 100755 --- a/configure +++ b/configure @@ -4554,7 +4554,7 @@ MAGICK_PATCHLEVEL_VERSION=29 MAGICK_VERSION=7.0.7-29 -MAGICK_GIT_REVISION=14195:eb005622e:20180427 +MAGICK_GIT_REVISION=14218:84d1b11ea:20180429 # Substitute library versioning