From: Cristy Date: Mon, 28 May 2018 13:43:11 +0000 (-0400) Subject: ... X-Git-Tag: 7.0.7-36~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0377685a0bfe9419f50097038106e2e7f587e3f7;p=imagemagick ... --- diff --git a/MagickCore/draw.c b/MagickCore/draw.c index 784de9b64..7d5426f5e 100644 --- a/MagickCore/draw.c +++ b/MagickCore/draw.c @@ -2052,7 +2052,7 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image, { j=i; i--; - alpha=(offset-gradient->stops[i].offset)/ + alpha=100.0*(offset-gradient->stops[i].offset)/ (gradient->stops[j].offset-gradient->stops[i].offset); CompositePixelInfoBlend(&gradient->stops[i].color,1.0-alpha, &gradient->stops[j].color,alpha,&composite); @@ -3410,9 +3410,10 @@ MagickExport MagickBooleanType DrawImage(Image *image,const DrawInfo *draw_info, number_stops++; if (number_stops == 1) stops=(StopInfo *) AcquireQuantumMemory(2,sizeof(*stops)); - else if (number_stops > 2) - stops=(StopInfo *) ResizeQuantumMemory(stops,number_stops, - sizeof(*stops)); + else + if (number_stops > 2) + stops=(StopInfo *) ResizeQuantumMemory(stops,number_stops, + sizeof(*stops)); if (stops == (StopInfo *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), diff --git a/coders/svg.c b/coders/svg.c index 6bf786ce9..9c924cbd0 100644 --- a/coders/svg.c +++ b/coders/svg.c @@ -1390,6 +1390,10 @@ static void SVGStartElement(void *context,const xmlChar *name, if (LocaleCompare((const char *) name,"text") == 0) { PushGraphicContext(id); + (void) FormatLocaleFile(svg_info->file,"translate %g,%g\n", + svg_info->bounds.x,svg_info->bounds.y); + svg_info->center.x=svg_info->bounds.x; + svg_info->center.y=svg_info->bounds.y; svg_info->bounds.x=0.0; svg_info->bounds.y=0.0; svg_info->bounds.width=0.0; @@ -2592,8 +2596,7 @@ static void SVGEndElement(void *context,const xmlChar *name) *text; text=EscapeString(svg_info->text,'\''); - (void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n", - svg_info->bounds.x,svg_info->bounds.y,text); + (void) FormatLocaleFile(svg_info->file,"text 0,0 \"%s\"\n",text); text=DestroyString(text); *svg_info->text='\0'; } @@ -2615,7 +2618,7 @@ static void SVGEndElement(void *context,const xmlChar *name) text=EscapeString(svg_info->text,'\''); (void) FormatLocaleFile(svg_info->file,"text %g,%g \"%s\"\n", - svg_info->bounds.x,svg_info->bounds.y,text); + svg_info->bounds.x-svg_info->center.x,svg_info->bounds.y-svg_info->center.y,text); text=DestroyString(text); draw_info=CloneDrawInfo(svg_info->image_info,(DrawInfo *) NULL); draw_info->pointsize=svg_info->pointsize;