gdi32: Implement GetNearestColor in the DIB driver.

oldstable
Alexandre Julliard 2011-12-12 20:20:06 +01:00
parent cae4ef81e6
commit 49ae736022
4 changed files with 18 additions and 1 deletions

View File

@ -530,7 +530,7 @@ const struct gdi_dc_funcs dib_driver =
NULL, /* pGetICMProfile */
dibdrv_GetImage, /* pGetImage */
NULL, /* pGetKerningPairs */
NULL, /* pGetNearestColor */
dibdrv_GetNearestColor, /* pGetNearestColor */
NULL, /* pGetOutlineTextMetrics */
dibdrv_GetPixel, /* pGetPixel */
NULL, /* pGetPixelFormat */

View File

@ -124,6 +124,7 @@ extern BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
const RECT *rect, LPCWSTR str, UINT count, const INT *dx ) DECLSPEC_HIDDEN;
extern DWORD dibdrv_GetImage( PHYSDEV dev, HBITMAP hbitmap, BITMAPINFO *info,
struct gdi_image_bits *bits, struct bitblt_coords *src ) DECLSPEC_HIDDEN;
extern COLORREF dibdrv_GetNearestColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN;
extern COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y ) DECLSPEC_HIDDEN;
extern BOOL dibdrv_PatBlt( PHYSDEV dev, struct bitblt_coords *dst, DWORD rop ) DECLSPEC_HIDDEN;

View File

@ -391,6 +391,20 @@ BOOL dibdrv_ExtTextOut( PHYSDEV dev, INT x, INT y, UINT flags,
return TRUE;
}
/***********************************************************************
* dibdrv_GetNearestColor
*/
COLORREF dibdrv_GetNearestColor( PHYSDEV dev, COLORREF color )
{
dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
DWORD pixel;
TRACE( "(%p, %08x)\n", dev, color );
pixel = get_pixel_color( pdev, color, FALSE );
return pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel );
}
/***********************************************************************
* dibdrv_GetPixel
*/

View File

@ -346,6 +346,8 @@ static void test_dib_info(HBITMAP hbm, const void *bits, const BITMAPINFOHEADER
ok(c == exp, "SetPixel failed: got 0x%06x expected 0x%06x\n", c, (UINT)exp); \
c = GetPixel(hdc, 0, 0); \
ok(c == exp, "GetPixel failed: got 0x%06x expected 0x%06x\n", c, (UINT)exp); \
c = GetNearestColor(hdc, color); \
ok(c == exp, "GetNearestColor failed: got 0x%06x expected 0x%06x\n", c, (UINT)exp); \
}
static void test_dib_bits_access( HBITMAP hdib, void *bits )