Vincent Povirk : gdiplus: Fix a possible floating point exception in path gradients.
Module: wine Branch: master Commit: 331a7af37a432eb719c1c03400421172a820181b URL: http://source.winehq.org/git/wine.git/?a=commit;h=331a7af37a432eb719c1c03400... Author: Vincent Povirk <vincent(a)codeweavers.com> Date: Tue Jul 25 14:55:36 2017 -0500 gdiplus: Fix a possible floating point exception in path gradients. Signed-off-by: Vincent Povirk <vincent(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- dlls/gdiplus/graphics.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 43cd6ac..543593e 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -1493,8 +1493,17 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush, REAL blend_amount, pdy, pdx; pdy = yf - center_point.Y; pdx = xf - center_point.X; - blend_amount = ( (center_point.Y - start_point.Y) * pdx + (start_point.X - center_point.X) * pdy ) / ( dy * pdx - dx * pdy ); - outer_color = blend_colors(start_color, end_color, blend_amount); + + if (fabs(pdx) <= 0.001 && fabs(pdy) <= 0.001) + { + /* Too close to center point, don't try to calculate outer color */ + outer_color = start_color; + } + else + { + blend_amount = ( (center_point.Y - start_point.Y) * pdx + (start_point.X - center_point.X) * pdy ) / ( dy * pdx - dx * pdy ); + outer_color = blend_colors(start_color, end_color, blend_amount); + } } distance = (end_point.Y - start_point.Y) * (start_point.X - xf) +
participants (1)
-
Alexandre Julliard