gdi32: Implement GetPixel in the null driver using GetImage.

oldstable
Alexandre Julliard 2011-12-12 20:53:50 +01:00
parent 0c194895a2
commit 9f410413a6
5 changed files with 46 additions and 11 deletions

View File

@ -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.@)
*/

View File

@ -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
*/

View File

@ -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;

View File

@ -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;

View File

@ -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;