Commit 9f410413 authored by Alexandre Julliard's avatar Alexandre Julliard

gdi32: Implement GetPixel in the null driver using GetImage.

parent 0c194895
......@@ -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.@)
*/
......
......@@ -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
*/
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
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