Commit 433832cf7 for imagemagick.org
commit 433832cf73198b453783251c66dbda3f03cce98a
Author: Cristy <urban-warrior@imagemagick.org>
Date: Thu Dec 3 20:56:29 2026 -0500
honor the results of GetOneVirtualPixelInfo(), although its unlikely to fail
diff --git a/MagickCore/draw-private.h b/MagickCore/draw-private.h
index 7a54ad829..788a97d94 100644
--- a/MagickCore/draw-private.h
+++ b/MagickCore/draw-private.h
@@ -18,9 +18,13 @@
#ifndef MAGICKCORE_DRAW_PRIVATE_H
#define MAGICKCORE_DRAW_PRIVATE_H
+#include <assert.h>
+#include <math.h>
#include "MagickCore/cache.h"
+#include "MagickCore/draw.h"
#include "MagickCore/image.h"
#include "MagickCore/memory_.h"
+#include "MagickCore/pixel.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
@@ -29,41 +33,45 @@ extern "C" {
static inline void GetFillColor(const DrawInfo *draw_info,const ssize_t x,
const ssize_t y,PixelInfo *fill,ExceptionInfo *exception)
{
- if (draw_info->fill_pattern == (Image *) NULL)
+ Image
+ *pattern;
+
+ assert(draw_info != (const DrawInfo *) NULL);
+ assert(fill != (PixelInfo *) NULL);
+ pattern=draw_info->fill_pattern;
+ if (pattern == (Image *) NULL)
{
*fill=draw_info->fill;
return;
}
- {
- Image
- *pattern;
-
- pattern=draw_info->fill_pattern;
- (void) GetOneVirtualPixelInfo(pattern,TileVirtualPixelMethod,x+
- pattern->tile_offset.x,y+pattern->tile_offset.y,fill,exception);
- if (fabs(draw_info->fill_alpha-(double) TransparentAlpha) >= MagickEpsilon)
- fill->alpha*=QuantumScale*draw_info->fill_alpha;
- }
+ if (GetOneVirtualPixelInfo(pattern,TileVirtualPixelMethod,x+
+ pattern->tile_offset.x,y+pattern->tile_offset.y,fill,
+ exception) == MagickFalse)
+ return;
+ if (fabs(draw_info->fill_alpha-(double) TransparentAlpha) >= MagickEpsilon)
+ fill->alpha*=QuantumScale*draw_info->fill_alpha;
}
static inline void GetStrokeColor(const DrawInfo *draw_info,const ssize_t x,
const ssize_t y,PixelInfo *stroke,ExceptionInfo *exception)
{
- if (draw_info->stroke_pattern == (Image *) NULL)
+ Image
+ *pattern;
+
+ assert(draw_info != (const DrawInfo *) NULL);
+ assert(stroke != (PixelInfo *) NULL);
+ pattern=draw_info->stroke_pattern;
+ if (pattern == (Image *) NULL)
{
*stroke=draw_info->stroke;
return;
}
- {
- Image
- *pattern;
-
- pattern=draw_info->stroke_pattern;
- (void) GetOneVirtualPixelInfo(pattern,TileVirtualPixelMethod,x+
- pattern->tile_offset.x,y+pattern->tile_offset.y,stroke,exception);
- if (fabs(draw_info->stroke_alpha-(double) TransparentAlpha) >= MagickEpsilon)
- stroke->alpha*=QuantumScale*draw_info->stroke_alpha;
- }
+ if (GetOneVirtualPixelInfo(pattern,TileVirtualPixelMethod,x+
+ pattern->tile_offset.x,y+pattern->tile_offset.y,stroke,
+ exception) == MagickFalse)
+ return;
+ if (fabs(draw_info->stroke_alpha-(double) TransparentAlpha) >= MagickEpsilon)
+ stroke->alpha*=QuantumScale*draw_info->stroke_alpha;
}
#if defined(__cplusplus) || defined(c_plusplus)