Skip to content

Commit

Permalink
respect gradient bounding box
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Apr 26, 2024
1 parent ea5f7d1 commit 4ebd314
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions magick/draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -2005,6 +2005,7 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image,
bounding_box;

ssize_t
height,
y;

/*
Expand All @@ -2025,11 +2026,12 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image,
exception=(&image->exception);
GetMagickPixelPacket(image,&zero);
image_view=AcquireAuthenticCacheView(image,exception);
height=(size_t) (bounding_box.y+bounding_box.height);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(status) \
magick_number_threads(image,image,(size_t) (bounding_box.height-bounding_box.y),1)
magick_number_threads(image,image,height,1)
#endif
for (y=bounding_box.y; y < (ssize_t) bounding_box.height; y++)
for (y=bounding_box.y; y < (ssize_t) height; y++)
{
double
alpha,
Expand All @@ -2048,12 +2050,13 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image,
ssize_t
i,
j,
width,
x;

if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,bounding_box.x,y,(size_t)
(bounding_box.width-bounding_box.x),1,exception);
bounding_box.width,1,exception);
if (q == (PixelPacket *) NULL)
{
status=MagickFalse;
Expand All @@ -2065,7 +2068,8 @@ MagickExport MagickBooleanType DrawGradientImage(Image *image,
offset=GetStopColorOffset(gradient,0,y);
if (gradient->type != RadialGradient)
offset*=PerceptibleReciprocal(length);
for (x=bounding_box.x; x < (ssize_t) bounding_box.width; x++)
width=(size_t) (bounding_box.x+bounding_box.width);
for (x=bounding_box.x; x < (ssize_t) width; x++)
{
SetMagickPixelPacket(image,q,indexes+x,&pixel);
switch (gradient->spread)
Expand Down

0 comments on commit 4ebd314

Please sign in to comment.