Alexandre Julliard : gdi32: Implement GetPixel in the null driver using GetImage.
Alexandre Julliard
julliard at winehq.org
Tue Dec 13 13:01:24 CST 2011
Module: wine
Branch: master
Commit: 9f410413a6cb89fc4c4340daf917d5cfa9d1909e
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9f410413a6cb89fc4c4340daf917d5cfa9d1909e
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Dec 12 20:53:50 2011 +0100
gdi32: Implement GetPixel in the null driver using GetImage.
---
dlls/gdi32/bitblt.c | 29 +++++++++++++++++++++++++++++
dlls/gdi32/dibdrv/bitblt.c | 13 +++++++++++++
dlls/gdi32/driver.c | 5 -----
dlls/gdi32/gdi_private.h | 2 ++
dlls/gdi32/painting.c | 8 ++------
5 files changed, 46 insertions(+), 11 deletions(-)
diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c
index 1638f46..0d7ed3c 100644
--- a/dlls/gdi32/bitblt.c
+++ b/dlls/gdi32/bitblt.c
@@ -472,6 +472,35 @@ done:
return ret;
}
+COLORREF nulldrv_GetPixel( PHYSDEV dev, INT x, INT y )
+{
+ DC *dc = get_nulldrv_dc( dev );
+ char buffer[FIELD_OFFSET( BITMAPINFO, bmiColors[256] )];
+ BITMAPINFO *info = (BITMAPINFO *)buffer;
+ struct bitblt_coords src;
+ struct gdi_image_bits bits;
+ COLORREF ret;
+
+ src.visrect.left = x;
+ src.visrect.top = y;
+ LPtoDP( dev->hdc, (POINT *)&src.visrect, 1 );
+ src.visrect.right = src.visrect.left + 1;
+ src.visrect.bottom = src.visrect.top + 1;
+ src.x = src.visrect.left;
+ src.y = src.visrect.top;
+ src.width = src.height = 1;
+
+ if (!clip_visrect( dc, &src.visrect, &src.visrect )) return CLR_INVALID;
+
+ dev = GET_DC_PHYSDEV( dc, pGetImage );
+ if (dev->funcs->pGetImage( dev, 0, info, &bits, &src )) return CLR_INVALID;
+
+ ret = get_pixel_bitmapinfo( info, bits.ptr, &src );
+ if (bits.free) bits.free( &bits );
+ return ret;
+}
+
+
/***********************************************************************
* PatBlt (GDI32.@)
*/
diff --git a/dlls/gdi32/dibdrv/bitblt.c b/dlls/gdi32/dibdrv/bitblt.c
index 20fcd4d..ad329be 100644
--- a/dlls/gdi32/dibdrv/bitblt.c
+++ b/dlls/gdi32/dibdrv/bitblt.c
@@ -1372,6 +1372,19 @@ DWORD gradient_bitmapinfo( const BITMAPINFO *info, void *bits, TRIVERTEX *vert_a
return ret;
}
+COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt_coords *src )
+{
+ dib_info dib;
+ POINT pt;
+ DWORD pixel;
+
+ init_dib_info_from_bitmapinfo( &dib, info, bits, default_color_table );
+ pt.x = src->x;
+ pt.y = src->y;
+ pixel = dib.funcs->get_pixel( &dib, &pt );
+ return dib.funcs->pixel_to_colorref( &dib, pixel );
+}
+
/***********************************************************************
* dibdrv_StretchBlt
*/
diff --git a/dlls/gdi32/driver.c b/dlls/gdi32/driver.c
index 15481ac..9612d6f 100644
--- a/dlls/gdi32/driver.c
+++ b/dlls/gdi32/driver.c
@@ -394,11 +394,6 @@ static UINT nulldrv_GetOutlineTextMetrics( PHYSDEV dev, UINT size, LPOUTLINETEXT
return 0;
}
-static COLORREF nulldrv_GetPixel( PHYSDEV dev, INT x, INT y )
-{
- return CLR_INVALID;
-}
-
static INT nulldrv_GetPixelFormat( PHYSDEV dev )
{
return 0;
diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h
index a371f4e..d87dfdc 100644
--- a/dlls/gdi32/gdi_private.h
+++ b/dlls/gdi32/gdi_private.h
@@ -250,6 +250,7 @@ extern DWORD blend_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struc
BLENDFUNCTION blend ) DECLSPEC_HIDDEN;
extern DWORD gradient_bitmapinfo( const BITMAPINFO *info, void *bits, TRIVERTEX *vert_array, ULONG nvert,
void *grad_array, ULONG ngrad, ULONG mode, const POINT *dev_pts, HRGN rgn ) DECLSPEC_HIDDEN;
+extern COLORREF get_pixel_bitmapinfo( const BITMAPINFO *info, void *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN;
extern BOOL render_aa_text_bitmapinfo( HDC hdc, BITMAPINFO *info, struct gdi_image_bits *bits,
struct bitblt_coords *src, INT x, INT y, UINT flags,
UINT aa_flags, LPCWSTR str, UINT count, const INT *dx ) DECLSPEC_HIDDEN;
@@ -356,6 +357,7 @@ extern BOOL nulldrv_FrameRgn( PHYSDEV dev, HRGN rgn, HBRUSH brush, INT width, IN
extern LONG nulldrv_GetBitmapBits( HBITMAP bitmap, void *bits, LONG size ) DECLSPEC_HIDDEN;
extern DWORD nulldrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info, struct gdi_image_bits *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN;
extern COLORREF nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
+extern COLORREF nulldrv_GetPixel( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL nulldrv_GradientFill( PHYSDEV dev, TRIVERTEX *vert_array, ULONG nvert,
void * grad_array, ULONG ngrad, ULONG mode ) DECLSPEC_HIDDEN;
extern INT nulldrv_IntersectClipRect( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) DECLSPEC_HIDDEN;
diff --git a/dlls/gdi32/painting.c b/dlls/gdi32/painting.c
index d721bd1..241f9c3 100644
--- a/dlls/gdi32/painting.c
+++ b/dlls/gdi32/painting.c
@@ -476,13 +476,9 @@ COLORREF WINAPI GetPixel( HDC hdc, INT x, INT y )
if (dc)
{
+ PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetPixel );
update_dc( dc );
- /* FIXME: should this be in the graphics driver? */
- if (PtVisible( hdc, x, y ))
- {
- PHYSDEV physdev = GET_DC_PHYSDEV( dc, pGetPixel );
- ret = physdev->funcs->pGetPixel( physdev, x, y );
- }
+ ret = physdev->funcs->pGetPixel( physdev, x, y );
release_dc_ptr( dc );
}
return ret;
More information about the wine-cvs
mailing list