Alexandre Julliard : gdi32: Fix clipping to the DIB rectangle in GetPixel( ).
Alexandre Julliard
julliard at winehq.org
Fri Dec 22 11:15:05 CST 2017
Module: wine
Branch: master
Commit: 90273a6e811417a6cd57207fb572d3bd1f5439d1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=90273a6e811417a6cd57207fb572d3bd1f5439d1
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Dec 22 16:29:03 2017 +0100
gdi32: Fix clipping to the DIB rectangle in GetPixel().
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/gdi32/dibdrv/graphics.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c
index a39f1e2..07ff72d 100644
--- a/dlls/gdi32/dibdrv/graphics.c
+++ b/dlls/gdi32/dibdrv/graphics.c
@@ -1108,6 +1108,7 @@ COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y )
dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
DC *dc = get_physdev_dc( dev );
POINT pt;
+ RECT rect;
DWORD pixel;
TRACE( "(%p, %d, %d)\n", dev, x, y );
@@ -1115,10 +1116,11 @@ COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y )
pt.x = x;
pt.y = y;
lp_to_dp( dc, &pt, 1 );
-
- if (pt.x < 0 || pt.x >= pdev->dib.rect.right - pdev->dib.rect.left ||
- pt.y < 0 || pt.y >= pdev->dib.rect.bottom - pdev->dib.rect.top)
- return CLR_INVALID;
+ rect.left = pt.x;
+ rect.top = pt.y;
+ rect.right = rect.left + 1;
+ rect.bottom = rect.top + 1;
+ if (!clip_rect_to_dib( &pdev->dib, &rect )) return CLR_INVALID;
pixel = pdev->dib.funcs->get_pixel( &pdev->dib, pt.x, pt.y );
return pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel );
More information about the wine-cvs
mailing list