Commit 90273a6e authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Fix clipping to the DIB rectangle in GetPixel().

parent 3eea7ff3
...@@ -1108,6 +1108,7 @@ COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y ) ...@@ -1108,6 +1108,7 @@ COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y )
dibdrv_physdev *pdev = get_dibdrv_pdev( dev ); dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
DC *dc = get_physdev_dc( dev ); DC *dc = get_physdev_dc( dev );
POINT pt; POINT pt;
RECT rect;
DWORD pixel; DWORD pixel;
TRACE( "(%p, %d, %d)\n", dev, x, y ); TRACE( "(%p, %d, %d)\n", dev, x, y );
...@@ -1115,10 +1116,11 @@ COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y ) ...@@ -1115,10 +1116,11 @@ COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y )
pt.x = x; pt.x = x;
pt.y = y; pt.y = y;
lp_to_dp( dc, &pt, 1 ); lp_to_dp( dc, &pt, 1 );
rect.left = pt.x;
if (pt.x < 0 || pt.x >= pdev->dib.rect.right - pdev->dib.rect.left || rect.top = pt.y;
pt.y < 0 || pt.y >= pdev->dib.rect.bottom - pdev->dib.rect.top) rect.right = rect.left + 1;
return CLR_INVALID; 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 ); pixel = pdev->dib.funcs->get_pixel( &pdev->dib, pt.x, pt.y );
return pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel ); return pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment