gdi32: Implement GetPixel.
This commit is contained in:
parent
70be58c17d
commit
f6c7e96a61
|
@ -554,7 +554,7 @@ const struct gdi_dc_funcs dib_driver =
|
|||
NULL, /* pGetICMProfile */
|
||||
dibdrv_GetImage, /* pGetImage */
|
||||
NULL, /* pGetNearestColor */
|
||||
NULL, /* pGetPixel */
|
||||
dibdrv_GetPixel, /* pGetPixel */
|
||||
NULL, /* pGetPixelFormat */
|
||||
NULL, /* pGetSystemPaletteEntries */
|
||||
NULL, /* pGetTextExtentExPoint */
|
||||
|
|
|
@ -106,6 +106,7 @@ extern DWORD dibdrv_BlendImage( PHYSDEV dev, BITMAPINFO *info, const struct g
|
|||
struct bitblt_coords *src, struct bitblt_coords *dst, BLENDFUNCTION func ) 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_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;
|
||||
extern BOOL dibdrv_PaintRgn( PHYSDEV dev, HRGN hrgn ) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -56,6 +56,29 @@ static RECT get_device_rect( HDC hdc, int left, int top, int right, int bottom,
|
|||
return rect;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dibdrv_GetPixel
|
||||
*/
|
||||
COLORREF dibdrv_GetPixel( PHYSDEV dev, INT x, INT y )
|
||||
{
|
||||
dibdrv_physdev *pdev = get_dibdrv_pdev( dev );
|
||||
POINT pt;
|
||||
DWORD pixel;
|
||||
|
||||
TRACE( "(%p, %d, %d)\n", dev, x, y );
|
||||
|
||||
pt.x = x;
|
||||
pt.y = y;
|
||||
LPtoDP( dev->hdc, &pt, 1 );
|
||||
|
||||
if (pt.x < 0 || pt.x >= pdev->dib.width ||
|
||||
pt.y < 0 || pt.y >= pdev->dib.height)
|
||||
return CLR_INVALID;
|
||||
|
||||
pixel = pdev->dib.funcs->get_pixel( &pdev->dib, &pt );
|
||||
return pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* dibdrv_LineTo
|
||||
*/
|
||||
|
|
|
@ -580,19 +580,19 @@ static void test_dibsections(void)
|
|||
c0 = RGB(pbmi->bmiColors[0].rgbRed, pbmi->bmiColors[0].rgbGreen, pbmi->bmiColors[0].rgbBlue);
|
||||
c1 = RGB(pbmi->bmiColors[1].rgbRed, pbmi->bmiColors[1].rgbGreen, pbmi->bmiColors[1].rgbBlue);
|
||||
|
||||
test_color(hdcmem, DIBINDEX(0), c0, 0, 1);
|
||||
test_color(hdcmem, DIBINDEX(1), c1, 0, 1);
|
||||
test_color(hdcmem, DIBINDEX(2), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTEINDEX(0), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTEINDEX(1), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTEINDEX(2), c0, 0, 1);
|
||||
test_color(hdcmem, DIBINDEX(0), c0, 0, 0);
|
||||
test_color(hdcmem, DIBINDEX(1), c1, 0, 0);
|
||||
test_color(hdcmem, DIBINDEX(2), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTEINDEX(0), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTEINDEX(1), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTEINDEX(2), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(pbmi->bmiColors[0].rgbRed, pbmi->bmiColors[0].rgbGreen,
|
||||
pbmi->bmiColors[0].rgbBlue), c0, 0, 1);
|
||||
pbmi->bmiColors[0].rgbBlue), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(pbmi->bmiColors[1].rgbRed, pbmi->bmiColors[1].rgbGreen,
|
||||
pbmi->bmiColors[1].rgbBlue), c1, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0, 0, 0), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0xff, 0xff, 0xff), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0, 0, 0xfe), c1, 0, 1);
|
||||
pbmi->bmiColors[1].rgbBlue), c1, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0, 0, 0), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0xff, 0xff, 0xff), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0, 0, 0xfe), c1, 0, 0);
|
||||
|
||||
SelectObject(hdcmem, oldbm);
|
||||
DeleteObject(hdib);
|
||||
|
@ -704,22 +704,22 @@ static void test_dibsections(void)
|
|||
c0 = RGB(plogpal->palPalEntry[0].peRed, plogpal->palPalEntry[0].peGreen, plogpal->palPalEntry[0].peBlue);
|
||||
c1 = RGB(plogpal->palPalEntry[1].peRed, plogpal->palPalEntry[1].peGreen, plogpal->palPalEntry[1].peBlue);
|
||||
|
||||
test_color(hdcmem, DIBINDEX(0), c0, 0, 1);
|
||||
test_color(hdcmem, DIBINDEX(1), c1, 0, 1);
|
||||
test_color(hdcmem, DIBINDEX(2), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTEINDEX(0), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTEINDEX(1), c1, 0, 1);
|
||||
test_color(hdcmem, PALETTEINDEX(2), c0, 0, 1);
|
||||
test_color(hdcmem, DIBINDEX(0), c0, 0, 0);
|
||||
test_color(hdcmem, DIBINDEX(1), c1, 0, 0);
|
||||
test_color(hdcmem, DIBINDEX(2), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTEINDEX(0), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTEINDEX(1), c1, 0, 0);
|
||||
test_color(hdcmem, PALETTEINDEX(2), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(plogpal->palPalEntry[0].peRed, plogpal->palPalEntry[0].peGreen,
|
||||
plogpal->palPalEntry[0].peBlue), c0, 0, 1);
|
||||
plogpal->palPalEntry[0].peBlue), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(plogpal->palPalEntry[1].peRed, plogpal->palPalEntry[1].peGreen,
|
||||
plogpal->palPalEntry[1].peBlue), c1, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0, 0, 0), c1, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0xff, 0xff, 0xff), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0, 0, 0xfe), c0, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0, 1, 0), c1, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0x3f, 0, 0x3f), c1, 0, 1);
|
||||
test_color(hdcmem, PALETTERGB(0x40, 0, 0x40), c0, 0, 1);
|
||||
plogpal->palPalEntry[1].peBlue), c1, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0, 0, 0), c1, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0xff, 0xff, 0xff), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0, 0, 0xfe), c0, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0, 1, 0), c1, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0x3f, 0, 0x3f), c1, 0, 0);
|
||||
test_color(hdcmem, PALETTERGB(0x40, 0, 0x40), c0, 0, 0);
|
||||
|
||||
/* Bottom and 2nd row from top green, everything else magenta */
|
||||
bits[0] = bits[1] = 0xff;
|
||||
|
|
|
@ -109,7 +109,6 @@ static void test_DIB_PAL_COLORS(void) {
|
|||
SetPixel( memhdc, 0, 0, setColor );
|
||||
chkColor = RGB( logpalettedata[3].peRed, logpalettedata[3].peGreen, logpalettedata[3].peBlue );
|
||||
getColor = GetPixel( memhdc, 0, 0 );
|
||||
todo_wine /* this will be removed with the GetPixel patch */
|
||||
ok( getColor == chkColor, "getColor=%08X\n", (UINT)getColor );
|
||||
|
||||
SelectPalette( memhdc, hpalOld, FALSE );
|
||||
|
|
Loading…
Reference in New Issue