winehq.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2025
February
January
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
January
2003
December
November
October
September
August
July
June
May
April
March
February
January
2002
December
November
October
September
August
July
June
May
April
March
February
January
2001
December
November
October
September
August
July
June
May
April
March
February
List overview
wine-commits
October 2011
----- 2025 -----
February 2025
January 2025
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
January 2004
----- 2003 -----
December 2003
November 2003
October 2003
September 2003
August 2003
July 2003
June 2003
May 2003
April 2003
March 2003
February 2003
January 2003
----- 2002 -----
December 2002
November 2002
October 2002
September 2002
August 2002
July 2002
June 2002
May 2002
April 2002
March 2002
February 2002
January 2002
----- 2001 -----
December 2001
November 2001
October 2001
September 2001
August 2001
July 2001
June 2001
May 2001
April 2001
March 2001
February 2001
wine-commits@winehq.org
3 participants
783 discussions
Start a n
N
ew thread
Huw Davies : gdi32/tests: Add tests for GetPixel.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: 2e724343406e96a7ea1907d46490a69e7c3ab022 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2e724343406e96a7ea1907d46…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:59 2011 +0100 gdi32/tests: Add tests for GetPixel. --- dlls/gdi32/tests/dib.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-) diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c index f440420..844ccef 100644 --- a/dlls/gdi32/tests/dib.c +++ b/dlls/gdi32/tests/dib.c @@ -1990,11 +1990,22 @@ static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sh for (i = 0; i < 256; i++) { - COLORREF s; + COLORREF s, g; s = SetPixel( hdc, i * 2, 10, DIBINDEX(i) ); + g = GetPixel( hdc, i * 2, 10 ); + ok( s == g, "got %08x and %08x\n", s, g ); + s = SetPixel( hdc, i * 2, 20, PALETTEINDEX(i) ); + g = GetPixel( hdc, i * 2, 20 ); + ok( s == g, "got %08x and %08x\n", s, g ); + s = SetPixel( hdc, i * 2, 30, RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) ); + g = GetPixel( hdc, i * 2, 30 ); + ok( s == g, "got %08x and %08x\n", s, g ); + s = SetPixel( hdc, i * 2, 40, PALETTERGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) ); + g = GetPixel( hdc, i * 2, 40 ); + ok( s == g, "got %08x and %08x\n", s, g ); } compare_hash(bmi, bits, sha1, "SetPixel");
1
0
0
0
Huw Davies : gdi32: Implement GetPixel.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: f6c7e96a61bf6755f005bb7d1883154ffacc65c3 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=f6c7e96a61bf6755f005bb7d1…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:58 2011 +0100 gdi32: Implement GetPixel. --- dlls/gdi32/dibdrv/dc.c | 2 +- dlls/gdi32/dibdrv/dibdrv.h | 1 + dlls/gdi32/dibdrv/graphics.c | 23 +++++++++++++++++++ dlls/gdi32/tests/bitmap.c | 50 +++++++++++++++++++++--------------------- dlls/gdi32/tests/palette.c | 1 - 5 files changed, 50 insertions(+), 27 deletions(-) diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index 877c132..335baae 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -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 */ diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index e5f4645..74a786d 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -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; diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c index b68b17e..65f5b9a 100644 --- a/dlls/gdi32/dibdrv/graphics.c +++ b/dlls/gdi32/dibdrv/graphics.c @@ -57,6 +57,29 @@ static RECT get_device_rect( HDC hdc, int left, int top, int right, int bottom, } /*********************************************************************** + * 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 */ BOOL dibdrv_LineTo( PHYSDEV dev, INT x, INT y ) diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index bf18b9b..f5fd5fd 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -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; diff --git a/dlls/gdi32/tests/palette.c b/dlls/gdi32/tests/palette.c index 0a5822a..039be59 100644 --- a/dlls/gdi32/tests/palette.c +++ b/dlls/gdi32/tests/palette.c @@ -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 );
1
0
0
0
Huw Davies : gdi32: Add get_pixel primitives.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: 70be58c17d034174fcd5e270b2c3c325a817332a URL:
http://source.winehq.org/git/wine.git/?a=commit;h=70be58c17d034174fcd5e270b…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:57 2011 +0100 gdi32: Add get_pixel primitives. --- dlls/gdi32/dibdrv/dibdrv.h | 1 + dlls/gdi32/dibdrv/primitives.c | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 0 deletions(-) diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index c73bc8e..e5f4645 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -145,6 +145,7 @@ typedef struct primitive_funcs const POINT *origin, int rop2, int overlap); void (* blend_rect)(const dib_info *dst, const RECT *rc, const dib_info *src, const POINT *origin, BLENDFUNCTION blend); + DWORD (* get_pixel)(const dib_info *dib, const POINT *pt); DWORD (* colorref_to_pixel)(const dib_info *dib, COLORREF color); COLORREF (* pixel_to_colorref)(const dib_info *dib, DWORD pixel); void (* convert_to)(dib_info *dst, const dib_info *src, const RECT *src_rect); diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c index 594d05d..0423c43 100644 --- a/dlls/gdi32/dibdrv/primitives.c +++ b/dlls/gdi32/dibdrv/primitives.c @@ -1025,6 +1025,51 @@ static void copy_rect_null(const dib_info *dst, const RECT *rc, return; } +static DWORD get_pixel_32(const dib_info *dib, const POINT *pt) +{ + DWORD *ptr = get_pixel_ptr_32( dib, pt->x, pt->y ); + return *ptr; +} + +static DWORD get_pixel_24(const dib_info *dib, const POINT *pt) +{ + BYTE *ptr = get_pixel_ptr_24( dib, pt->x, pt->y ); + return ptr[0] | ((DWORD)ptr[1] << 8) | ((DWORD)ptr[2] << 16); +} + +static DWORD get_pixel_16(const dib_info *dib, const POINT *pt) +{ + WORD *ptr = get_pixel_ptr_16( dib, pt->x, pt->y ); + return *ptr; +} + +static DWORD get_pixel_8(const dib_info *dib, const POINT *pt) +{ + BYTE *ptr = get_pixel_ptr_8( dib, pt->x, pt->y ); + return *ptr; +} + +static DWORD get_pixel_4(const dib_info *dib, const POINT *pt) +{ + BYTE *ptr = get_pixel_ptr_4( dib, pt->x, pt->y ); + + if (pt->x & 1) + return *ptr & 0x0f; + else + return (*ptr >> 4) & 0x0f; +} + +static DWORD get_pixel_1(const dib_info *dib, const POINT *pt) +{ + BYTE *ptr = get_pixel_ptr_1( dib, pt->x, pt->y ); + return (*ptr & pixel_masks_1[pt->x & 0x7]) ? 1 : 0; +} + +static DWORD get_pixel_null(const dib_info *dib, const POINT *pt) +{ + return 0; +} + static DWORD colorref_to_pixel_888(const dib_info *dib, COLORREF color) { return ( ((color >> 16) & 0xff) | (color & 0xff00) | ((color << 16) & 0xff0000) ); @@ -4350,6 +4395,7 @@ const primitive_funcs funcs_8888 = pattern_rects_32, copy_rect_32, blend_rect_8888, + get_pixel_32, colorref_to_pixel_888, pixel_to_colorref_888, convert_to_8888, @@ -4364,6 +4410,7 @@ const primitive_funcs funcs_32 = pattern_rects_32, copy_rect_32, blend_rect_32, + get_pixel_32, colorref_to_pixel_masks, pixel_to_colorref_masks, convert_to_32, @@ -4378,6 +4425,7 @@ const primitive_funcs funcs_24 = pattern_rects_24, copy_rect_24, blend_rect_24, + get_pixel_24, colorref_to_pixel_888, pixel_to_colorref_888, convert_to_24, @@ -4392,6 +4440,7 @@ const primitive_funcs funcs_555 = pattern_rects_16, copy_rect_16, blend_rect_555, + get_pixel_16, colorref_to_pixel_555, pixel_to_colorref_555, convert_to_555, @@ -4406,6 +4455,7 @@ const primitive_funcs funcs_16 = pattern_rects_16, copy_rect_16, blend_rect_16, + get_pixel_16, colorref_to_pixel_masks, pixel_to_colorref_masks, convert_to_16, @@ -4420,6 +4470,7 @@ const primitive_funcs funcs_8 = pattern_rects_8, copy_rect_8, blend_rect_8, + get_pixel_8, colorref_to_pixel_colortable, pixel_to_colorref_colortable, convert_to_8, @@ -4434,6 +4485,7 @@ const primitive_funcs funcs_4 = pattern_rects_4, copy_rect_4, blend_rect_4, + get_pixel_4, colorref_to_pixel_colortable, pixel_to_colorref_colortable, convert_to_4, @@ -4448,6 +4500,7 @@ const primitive_funcs funcs_1 = pattern_rects_1, copy_rect_1, blend_rect_1, + get_pixel_1, colorref_to_pixel_colortable, pixel_to_colorref_colortable, convert_to_1, @@ -4462,6 +4515,7 @@ const primitive_funcs funcs_null = pattern_rects_null, copy_rect_null, blend_rect_null, + get_pixel_null, colorref_to_pixel_null, pixel_to_colorref_null, convert_to_null,
1
0
0
0
Huw Davies : gdi32/tests: Add tests for SetPixel.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: 07e652b330d1a1843dfed24e00a3e232a2afca76 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=07e652b330d1a1843dfed24e0…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:56 2011 +0100 gdi32/tests: Add tests for SetPixel. --- dlls/gdi32/tests/dib.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c index 4c81330..f440420 100644 --- a/dlls/gdi32/tests/dib.c +++ b/dlls/gdi32/tests/dib.c @@ -131,6 +131,7 @@ static const char *sha1_graphics_a8r8g8b8[] = "af99228aa4cfbd1f61bd824db046144a3c6c2ed7", "568f87f0194ca19b69a5b2bcdef795d89c5721ce", "257d114354a93e681225072bcde756f155b70496", + "0cdf6fee6721d60d5d5ed26b1989eacddc16b14e", NULL }; @@ -189,6 +190,7 @@ static const char *sha1_graphics_a8b8g8r8[] = "af99228aa4cfbd1f61bd824db046144a3c6c2ed7", "25675c30adfe24d6cae60793b156dfdaa36ac3ba", "2c4f116451b571106beba8b85da8e4b923937246", + "9c8f3063504a81bbbfa8558e111c63d8bc36dbbf", NULL }; @@ -247,6 +249,7 @@ static const char *sha1_graphics_r10g10b10[] = "36f6db4fbe2a1630a7597d3a446f2902755c96ef", "d3f08946300e1700865042aed121870e292d1095", "abb56db94becb64d663b51f0ea6b4bd535a88ba0", + "3a81fe558c69ca0aea7e7191771ed86cf4321a5a", NULL }; @@ -305,6 +308,7 @@ static const char *sha1_graphics_r6g6b6[] = "325279e76367200d3fd7194d81c09fd139988ece", "c3def160a1e847605ff0fc7edd30397fa90635a0", "50acb1597c4d53ad63225376d2aa36f64e8a229d", + "796fd861474aa7861bd0384127df755458757ec3", NULL }; @@ -363,6 +367,7 @@ static const char *sha1_graphics_24[] = "d347ca5c6c4b6a61389247c3b6f61564033e8c25", "ee315634ed92da3a32c2675ecd1b369471c60936", "3491e2bd81e70dd203c8551cc2d39b19401caafe", + "826de85271b67a11e7bd1a6596b58a045a96b69e", NULL }; @@ -425,6 +430,7 @@ static const char *sha1_graphics_r5g5b5[] = "dab47c9dc149e570045d699598b14a613bf319b3", "2daca4d26a086ed34894693be0b0374402232809", "bf0e0b74ce5686b73c527843e0d0df0cd10efefe", + "517e32a8c0312b5676d498583ea092b0f198f2bc", NULL }; @@ -482,6 +488,7 @@ static const char *sha1_graphics_r4g4b4[] = "07b10c3f191d0a93e5e5694aae37dcad407e10f5", "f7900e60347029876ba55e8f0c4c02e89deb36b6", "734d4a7836891d729f4a9ec6916ead78eecb2596", + "d8ba2e556fd64c9c2f1746496e6e7dd7a487cd6d", NULL }; @@ -545,6 +552,7 @@ static const char *sha1_graphics_8_color[] = "678979a45126a76eb629992cd64734862f53a555", "2f7ba8803604c032cb1a1228bc021f0f1c03e245", "0204f06422a01787f7379d0edb51104bb023758a", + "1f9a21eba2f2ce87768a5618d9cfefa7e48fb386", NULL }; @@ -613,6 +621,7 @@ static const char *sha1_graphics_8_grayscale[] = "09640bad951c33e7d70a1fced83b1869f65b3fc5", "cb9ea8137eca1450e049879772f5c11a0e11ff0a", "a05e05b2e6e515baa59ea032d063ca11e70a72b5", + "d908c86b7301666a8d7999b831841115a4938181", NULL }; @@ -674,6 +683,7 @@ static const char *sha1_graphics_8[] = "465d9cd0a77ab4fcf035aa67544b2a26269e0b09", "600d6b2713d5e4c0d90c02660245ed26c7ae3033", "963d1fa8608c8b743e972eb9a4e9f3fc53c6c7e8", + "ba49de83c4668fb08956221f465b93e7dd6a3383", NULL }; @@ -731,6 +741,7 @@ static const char *sha1_graphics_4[] = "d8af3868c66c7d6dac35ec8ee0317b38a6910bb1", "ec8e2aebfb4a1c28ebcd0e053b9e4d8638b50951", "da401c745421f6bdfaefd590ab99dee948dce412", + "38a3b6edcba2a1fba6064f0b4d771aedae7f4673", NULL }; @@ -788,6 +799,7 @@ static const char *sha1_graphics_4_grayscale[] = "b5ee51cfc73acb59a2f6124509ea236f8fc7f9f7", "d374d4d92c940ae42a9b42c14d744341b68a8c14", "25ec9fd2eeb1514ba4e0458a444149a5456cf63a", + "2e4dc1e859350289575ffc2a47cd0033efca6c32", NULL }; @@ -860,6 +872,7 @@ static const char *sha1_graphics_1[] = "88763f8e8fcf4f78fa864325791a9dd35a0bd279", "013cee26bac8f815eadad4bfc012d9b5d01c3b7f", "6b2cb2346b5820bdd0251cd6a4aeb5c22ee82e85", + "6c4640b17e072efc682044c499e5a4f3481b7c87", NULL }; @@ -1975,6 +1988,18 @@ static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sh compare_hash(bmi, bits, sha1, "Colors"); memset(bits, 0xcc, dib_size); + for (i = 0; i < 256; i++) + { + COLORREF s; + s = SetPixel( hdc, i * 2, 10, DIBINDEX(i) ); + s = SetPixel( hdc, i * 2, 20, PALETTEINDEX(i) ); + s = SetPixel( hdc, i * 2, 30, RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) ); + s = SetPixel( hdc, i * 2, 40, PALETTERGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) ); + } + + compare_hash(bmi, bits, sha1, "SetPixel"); + memset(bits, 0xcc, dib_size); + SelectObject(hdc, orig_brush); SelectObject(hdc, orig_pen); DeleteObject(hrgn);
1
0
0
0
Huw Davies : gdi32: Implement SetPixel.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: 2ac6a1bbf6eb192a906f31837719e3c947979b0e URL:
http://source.winehq.org/git/wine.git/?a=commit;h=2ac6a1bbf6eb192a906f31837…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:55 2011 +0100 gdi32: Implement SetPixel. --- dlls/gdi32/dibdrv/dc.c | 2 +- dlls/gdi32/dibdrv/dibdrv.h | 1 + dlls/gdi32/dibdrv/graphics.c | 40 ++++++++++++++++++++++++++++++++++++++++ dlls/gdi32/dibdrv/objects.c | 6 ------ dlls/gdi32/gdi_private.h | 6 ++++++ dlls/gdi32/tests/bitmap.c | 38 +++++++++++++++++++------------------- dlls/gdi32/tests/palette.c | 1 + 7 files changed, 68 insertions(+), 26 deletions(-) diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index e832a20..877c132 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -606,7 +606,7 @@ const struct gdi_dc_funcs dib_driver = NULL, /* pSetLayout */ NULL, /* pSetMapMode */ NULL, /* pSetMapperFlags */ - NULL, /* pSetPixel */ + dibdrv_SetPixel, /* pSetPixel */ NULL, /* pSetPixelFormat */ NULL, /* pSetPolyFillMode */ dibdrv_SetROP2, /* pSetROP2 */ diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index b23e931..c73bc8e 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -120,6 +120,7 @@ extern HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) DECLSPEC_HIDDEN extern HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) DECLSPEC_HIDDEN; extern COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; extern COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) DECLSPEC_HIDDEN; +extern COLORREF dibdrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) DECLSPEC_HIDDEN; extern BOOL dibdrv_StretchBlt( PHYSDEV dst_dev, struct bitblt_coords *dst, PHYSDEV src_dev, struct bitblt_coords *src, DWORD rop ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/dibdrv/graphics.c b/dlls/gdi32/dibdrv/graphics.c index f8b3f8a..b68b17e 100644 --- a/dlls/gdi32/dibdrv/graphics.c +++ b/dlls/gdi32/dibdrv/graphics.c @@ -240,3 +240,43 @@ BOOL dibdrv_Rectangle( PHYSDEV dev, INT left, INT top, INT right, INT bottom ) return TRUE; } + +/*********************************************************************** + * dibdrv_SetPixel + */ +COLORREF dibdrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) +{ + dibdrv_physdev *pdev = get_dibdrv_pdev( dev ); + int i; + POINT pt; + DWORD pixel; + const WINEREGION *clip = get_wine_region( pdev->clip ); + + TRACE( "(%p, %d, %d, %08x)\n", dev, x, y, color ); + + pt.x = x; + pt.y = y; + LPtoDP( dev->hdc, &pt, 1 ); + + /* SetPixel doesn't do the 1bpp massaging like other fg colors */ + pixel = get_pixel_color( pdev, color, FALSE ); + color = pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel ); + + for (i = 0; i < clip->numRects; i++) + { + if (pt_in_rect( clip->rects + i, pt )) + { + RECT rect; + rect.left = pt.x; + rect.top = pt.y; + rect.right = rect.left + 1; + rect.bottom = rect.top + 1; + + pdev->dib.funcs->solid_rects( &pdev->dib, 1, &rect, 0, pixel ); + break; + } + } + + release_wine_region( pdev->clip ); + return color; +} diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index a1f6829..8d84284 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -259,12 +259,6 @@ static inline void order_end_points(int *s, int *e) } } -static inline BOOL pt_in_rect( const RECT *rect, const POINT *pt ) -{ - return ((pt->x >= rect->left) && (pt->x < rect->right) && - (pt->y >= rect->top) && (pt->y < rect->bottom)); -} - #define Y_INCREASING_MASK 0x0f #define X_INCREASING_MASK 0xc3 #define X_MAJOR_MASK 0x99 diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index 67bdd2c..0d38efe 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -480,6 +480,12 @@ static inline void offset_rect( RECT *rect, int offset_x, int offset_y ) rect->bottom += offset_y; } +static inline BOOL pt_in_rect( const RECT *rect, POINT pt ) +{ + return ((pt.x >= rect->left) && (pt.x < rect->right) && + (pt.y >= rect->top) && (pt.y < rect->bottom)); +} + static inline void get_bounding_rect( RECT *rect, int x, int y, int width, int height ) { rect->left = x; diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index a412cc9..bf18b9b 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -582,17 +582,17 @@ static void test_dibsections(void) test_color(hdcmem, DIBINDEX(0), c0, 0, 1); test_color(hdcmem, DIBINDEX(1), c1, 0, 1); - test_color(hdcmem, DIBINDEX(2), c0, 1, 1); - test_color(hdcmem, PALETTEINDEX(0), c0, 1, 1); - test_color(hdcmem, PALETTEINDEX(1), c0, 1, 1); - test_color(hdcmem, PALETTEINDEX(2), c0, 1, 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, PALETTERGB(pbmi->bmiColors[0].rgbRed, pbmi->bmiColors[0].rgbGreen, - pbmi->bmiColors[0].rgbBlue), c0, 1, 1); + pbmi->bmiColors[0].rgbBlue), c0, 0, 1); test_color(hdcmem, PALETTERGB(pbmi->bmiColors[1].rgbRed, pbmi->bmiColors[1].rgbGreen, - pbmi->bmiColors[1].rgbBlue), c1, 1, 1); - test_color(hdcmem, PALETTERGB(0, 0, 0), c0, 1, 1); - test_color(hdcmem, PALETTERGB(0xff, 0xff, 0xff), c0, 1, 1); - test_color(hdcmem, PALETTERGB(0, 0, 0xfe), c1, 1, 1); + 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); SelectObject(hdcmem, oldbm); DeleteObject(hdib); @@ -706,20 +706,20 @@ static void test_dibsections(void) test_color(hdcmem, DIBINDEX(0), c0, 0, 1); test_color(hdcmem, DIBINDEX(1), c1, 0, 1); - test_color(hdcmem, DIBINDEX(2), c0, 1, 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, 1, 1); + test_color(hdcmem, PALETTEINDEX(2), c0, 0, 1); test_color(hdcmem, PALETTERGB(plogpal->palPalEntry[0].peRed, plogpal->palPalEntry[0].peGreen, - plogpal->palPalEntry[0].peBlue), c0, 1, 1); + plogpal->palPalEntry[0].peBlue), c0, 0, 1); test_color(hdcmem, PALETTERGB(plogpal->palPalEntry[1].peRed, plogpal->palPalEntry[1].peGreen, - plogpal->palPalEntry[1].peBlue), c1, 1, 1); - test_color(hdcmem, PALETTERGB(0, 0, 0), c1, 1, 1); - test_color(hdcmem, PALETTERGB(0xff, 0xff, 0xff), c0, 1, 1); - test_color(hdcmem, PALETTERGB(0, 0, 0xfe), c0, 1, 1); - test_color(hdcmem, PALETTERGB(0, 1, 0), c1, 1, 1); - test_color(hdcmem, PALETTERGB(0x3f, 0, 0x3f), c1, 1, 1); - test_color(hdcmem, PALETTERGB(0x40, 0, 0x40), c0, 1, 1); + 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); /* Bottom and 2nd row from top green, everything else magenta */ bits[0] = bits[1] = 0xff; diff --git a/dlls/gdi32/tests/palette.c b/dlls/gdi32/tests/palette.c index 039be59..0a5822a 100644 --- a/dlls/gdi32/tests/palette.c +++ b/dlls/gdi32/tests/palette.c @@ -109,6 +109,7 @@ 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 );
1
0
0
0
Huw Davies : gdi32: Add pixel_to_colorref primitives.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: ddbaa9491a7953886d1b5d4c9b671a0048e61eb2 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=ddbaa9491a7953886d1b5d4c9…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:54 2011 +0100 gdi32: Add pixel_to_colorref primitives. --- dlls/gdi32/dibdrv/dibdrv.h | 1 + dlls/gdi32/dibdrv/primitives.c | 40 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 0 deletions(-) diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 6d96e77..b23e931 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -145,6 +145,7 @@ typedef struct primitive_funcs void (* blend_rect)(const dib_info *dst, const RECT *rc, const dib_info *src, const POINT *origin, BLENDFUNCTION blend); DWORD (* colorref_to_pixel)(const dib_info *dib, COLORREF color); + COLORREF (* pixel_to_colorref)(const dib_info *dib, DWORD pixel); void (* convert_to)(dib_info *dst, const dib_info *src, const RECT *src_rect); BOOL (* create_rop_masks)(const dib_info *dib, const dib_info *hatch, const rop_mask *fg, const rop_mask *bg, rop_mask_bits *bits); diff --git a/dlls/gdi32/dibdrv/primitives.c b/dlls/gdi32/dibdrv/primitives.c index 7477a79..594d05d 100644 --- a/dlls/gdi32/dibdrv/primitives.c +++ b/dlls/gdi32/dibdrv/primitives.c @@ -1132,6 +1132,37 @@ static inline RGBQUAD colortable_entry(const dib_info *dib, DWORD index) return default_rgb; } +static COLORREF pixel_to_colorref_888(const dib_info *dib, DWORD pixel) +{ + return ( ((pixel >> 16) & 0xff) | (pixel & 0xff00) | ((pixel << 16) & 0xff0000) ); +} + +static COLORREF pixel_to_colorref_masks(const dib_info *dib, DWORD pixel) +{ + return RGB( get_field( pixel, dib->red_shift, dib->red_len ), + get_field( pixel, dib->green_shift, dib->green_len ), + get_field( pixel, dib->blue_shift, dib->blue_len ) ); +} + +static COLORREF pixel_to_colorref_555(const dib_info *dib, DWORD pixel) +{ + return RGB( ((pixel >> 7) & 0xf8) | ((pixel >> 12) & 0x07), + ((pixel >> 2) & 0xf8) | ((pixel >> 7) & 0x07), + ((pixel << 3) & 0xf8) | ((pixel >> 2) & 0x07) ); +} + +static COLORREF pixel_to_colorref_colortable(const dib_info *dib, DWORD pixel) +{ + RGBQUAD quad = colortable_entry( dib, pixel ); + + return RGB( quad.rgbRed, quad.rgbGreen, quad.rgbBlue ); +} + +static COLORREF pixel_to_colorref_null(const dib_info *dib, DWORD pixel) +{ + return 0; +} + static inline BOOL bit_fields_match(const dib_info *d1, const dib_info *d2) { assert( d1->bit_count > 8 && d1->bit_count == d2->bit_count ); @@ -4320,6 +4351,7 @@ const primitive_funcs funcs_8888 = copy_rect_32, blend_rect_8888, colorref_to_pixel_888, + pixel_to_colorref_888, convert_to_8888, create_rop_masks_32, stretch_row_32, @@ -4333,6 +4365,7 @@ const primitive_funcs funcs_32 = copy_rect_32, blend_rect_32, colorref_to_pixel_masks, + pixel_to_colorref_masks, convert_to_32, create_rop_masks_32, stretch_row_32, @@ -4346,6 +4379,7 @@ const primitive_funcs funcs_24 = copy_rect_24, blend_rect_24, colorref_to_pixel_888, + pixel_to_colorref_888, convert_to_24, create_rop_masks_24, stretch_row_24, @@ -4359,6 +4393,7 @@ const primitive_funcs funcs_555 = copy_rect_16, blend_rect_555, colorref_to_pixel_555, + pixel_to_colorref_555, convert_to_555, create_rop_masks_16, stretch_row_16, @@ -4372,6 +4407,7 @@ const primitive_funcs funcs_16 = copy_rect_16, blend_rect_16, colorref_to_pixel_masks, + pixel_to_colorref_masks, convert_to_16, create_rop_masks_16, stretch_row_16, @@ -4385,6 +4421,7 @@ const primitive_funcs funcs_8 = copy_rect_8, blend_rect_8, colorref_to_pixel_colortable, + pixel_to_colorref_colortable, convert_to_8, create_rop_masks_8, stretch_row_8, @@ -4398,6 +4435,7 @@ const primitive_funcs funcs_4 = copy_rect_4, blend_rect_4, colorref_to_pixel_colortable, + pixel_to_colorref_colortable, convert_to_4, create_rop_masks_4, stretch_row_4, @@ -4411,6 +4449,7 @@ const primitive_funcs funcs_1 = copy_rect_1, blend_rect_1, colorref_to_pixel_colortable, + pixel_to_colorref_colortable, convert_to_1, create_rop_masks_1, stretch_row_1, @@ -4424,6 +4463,7 @@ const primitive_funcs funcs_null = copy_rect_null, blend_rect_null, colorref_to_pixel_null, + pixel_to_colorref_null, convert_to_null, create_rop_masks_null, stretch_row_null,
1
0
0
0
Huw Davies : gdi32/tests: Add tests for non-rgb colorrefs.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: b70066007511aba97df730695b73e0759bc7e0a1 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=b70066007511aba97df730695…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:53 2011 +0100 gdi32/tests: Add tests for non-rgb colorrefs. --- dlls/gdi32/tests/dib.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 47 insertions(+), 0 deletions(-) diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c index 5577918..4c81330 100644 --- a/dlls/gdi32/tests/dib.c +++ b/dlls/gdi32/tests/dib.c @@ -27,6 +27,7 @@ #include "wingdi.h" #include "winuser.h" #include "wincrypt.h" +#include "mmsystem.h" /* DIBINDEX */ #include "wine/test.h" @@ -129,6 +130,7 @@ static const char *sha1_graphics_a8r8g8b8[] = "d7dd4700f49808541bba99244b7eb5840e0a2439", "af99228aa4cfbd1f61bd824db046144a3c6c2ed7", "568f87f0194ca19b69a5b2bcdef795d89c5721ce", + "257d114354a93e681225072bcde756f155b70496", NULL }; @@ -186,6 +188,7 @@ static const char *sha1_graphics_a8b8g8r8[] = "86c84cc8306975edecc6d4a89a8aff29f59b55a7", "af99228aa4cfbd1f61bd824db046144a3c6c2ed7", "25675c30adfe24d6cae60793b156dfdaa36ac3ba", + "2c4f116451b571106beba8b85da8e4b923937246", NULL }; @@ -243,6 +246,7 @@ static const char *sha1_graphics_r10g10b10[] = "fc0c32afb719295f28bcfef22803bef94f798e20", "36f6db4fbe2a1630a7597d3a446f2902755c96ef", "d3f08946300e1700865042aed121870e292d1095", + "abb56db94becb64d663b51f0ea6b4bd535a88ba0", NULL }; @@ -300,6 +304,7 @@ static const char *sha1_graphics_r6g6b6[] = "49341c297a887186bd47d7465d827ab3147f05e3", "325279e76367200d3fd7194d81c09fd139988ece", "c3def160a1e847605ff0fc7edd30397fa90635a0", + "50acb1597c4d53ad63225376d2aa36f64e8a229d", NULL }; @@ -357,6 +362,7 @@ static const char *sha1_graphics_24[] = "b25ba91487ec945410deb2b51bc1156890c032a8", "d347ca5c6c4b6a61389247c3b6f61564033e8c25", "ee315634ed92da3a32c2675ecd1b369471c60936", + "3491e2bd81e70dd203c8551cc2d39b19401caafe", NULL }; @@ -418,6 +424,7 @@ static const char *sha1_graphics_r5g5b5[] = "3772003c7fb420003512d0c437b3659d96d89ce4", "dab47c9dc149e570045d699598b14a613bf319b3", "2daca4d26a086ed34894693be0b0374402232809", + "bf0e0b74ce5686b73c527843e0d0df0cd10efefe", NULL }; @@ -474,6 +481,7 @@ static const char *sha1_graphics_r4g4b4[] = "f0acb3cfcda62e95bee5f7bc8830ffeb3dd7e5a7", "07b10c3f191d0a93e5e5694aae37dcad407e10f5", "f7900e60347029876ba55e8f0c4c02e89deb36b6", + "734d4a7836891d729f4a9ec6916ead78eecb2596", NULL }; @@ -536,6 +544,7 @@ static const char *sha1_graphics_8_color[] = "9ae38bb94c7b4c0c6dfebbee23d1de4db9b77488", "678979a45126a76eb629992cd64734862f53a555", "2f7ba8803604c032cb1a1228bc021f0f1c03e245", + "0204f06422a01787f7379d0edb51104bb023758a", NULL }; @@ -603,6 +612,7 @@ static const char *sha1_graphics_8_grayscale[] = "3685c9ae95118a83db3569832c29753276fa1264", "09640bad951c33e7d70a1fced83b1869f65b3fc5", "cb9ea8137eca1450e049879772f5c11a0e11ff0a", + "a05e05b2e6e515baa59ea032d063ca11e70a72b5", NULL }; @@ -663,6 +673,7 @@ static const char *sha1_graphics_8[] = "31e667c2dbb81dcf81d01cb88f794e88ddb90ff2", "465d9cd0a77ab4fcf035aa67544b2a26269e0b09", "600d6b2713d5e4c0d90c02660245ed26c7ae3033", + "963d1fa8608c8b743e972eb9a4e9f3fc53c6c7e8", NULL }; @@ -719,6 +730,7 @@ static const char *sha1_graphics_4[] = "df5feb905a31c288008cf5e82d73ac818a160d82", "d8af3868c66c7d6dac35ec8ee0317b38a6910bb1", "ec8e2aebfb4a1c28ebcd0e053b9e4d8638b50951", + "da401c745421f6bdfaefd590ab99dee948dce412", NULL }; @@ -775,6 +787,7 @@ static const char *sha1_graphics_4_grayscale[] = "f8681c09f1abfc38d31e47622cb8798cd896a00e", "b5ee51cfc73acb59a2f6124509ea236f8fc7f9f7", "d374d4d92c940ae42a9b42c14d744341b68a8c14", + "25ec9fd2eeb1514ba4e0458a444149a5456cf63a", NULL }; @@ -846,6 +859,7 @@ static const char *sha1_graphics_1[] = "23366004515f3bc46796ea505d748f8d0f97fbe1", "88763f8e8fcf4f78fa864325791a9dd35a0bd279", "013cee26bac8f815eadad4bfc012d9b5d01c3b7f", + "6b2cb2346b5820bdd0251cd6a4aeb5c22ee82e85", NULL }; @@ -1055,6 +1069,14 @@ static const DWORD four_by_four_data[16] = { 0x000000, 0xff0000, 0x00ff00, 0x000 0x000000, 0xff0000, 0x00ff00, 0x0000ff, 0xffffff, 0x00ffff, 0xff00ff, 0xffff00 }; +static inline void solid_patblt( HDC hdc, int x, int y, int width, int height, COLORREF color ) +{ + HBRUSH brush = CreateSolidBrush( color ); + brush = SelectObject( hdc, brush ); + PatBlt( hdc, x, y, width, height, PATCOPY ); + DeleteObject( SelectObject( hdc, brush ) ); +} + static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sha1) { DWORD dib_size = get_dib_size(bmi); @@ -1925,7 +1947,32 @@ static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char ***sh ok(ret == -4, "got %d\n", ret); compare_hash_broken_todo( bmi, bits, sha1, "stretchdibits", dib_is_8bpp_gray ? 1 : 0, dib_is_8bpp_gray ); + memset(bits, 0xcc, dib_size); + + /* Solid colors */ + for (i = 0; i < 256; i++) + { + solid_patblt( hdc, i * 2, 10, 1, 1, DIBINDEX(i) ); + solid_patblt( hdc, i * 2, 20, 1, 1, PALETTEINDEX(i) ); + solid_patblt( hdc, i * 2, 30, 1, 1, RGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) ); + solid_patblt( hdc, i * 2, 40, 1, 1, PALETTERGB( (i & 0x07) << 5, (i & 0x38) << 2, i & 0xc0 ) ); + } + + /* A few extra colors that are interesting in the 1bpp case */ + + /* bk color */ + solid_patblt( hdc, 0, 50, 1, 1, RGB( 0, 0xff, 0 ) ); + solid_patblt( hdc, 2, 50, 1, 1, PALETTERGB( 0, 0xff, 0 ) ); + + /* color 0 */ + solid_patblt( hdc, 4, 50, 1, 1, RGB( 0, 0x1, 0xff ) ); + solid_patblt( hdc, 6, 50, 1, 1, PALETTERGB( 0, 0x1, 0xff ) ); + + /* color 1 */ + solid_patblt( hdc, 8, 50, 1, 1, RGB( 0xff, 0, 0 ) ); + solid_patblt( hdc, 10, 50, 1, 1, PALETTERGB( 0xff, 0, 0 ) ); + compare_hash(bmi, bits, sha1, "Colors"); memset(bits, 0xcc, dib_size); SelectObject(hdc, orig_brush);
1
0
0
0
Huw Davies : gdi32: Add support for non-rgb colorrefs.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: a3b5f270a89052425d35238710466e668bfe0588 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=a3b5f270a89052425d3523871…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:52 2011 +0100 gdi32: Add support for non-rgb colorrefs. --- dlls/gdi32/dibdrv/objects.c | 58 +++++++++++++++++++++++++++++++++++++++++- 1 files changed, 56 insertions(+), 2 deletions(-) diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index 6b278c8..a1f6829 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -123,6 +123,54 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b) return FALSE; } +static COLORREF make_rgb_colorref( dibdrv_physdev *pdev, COLORREF color, + BOOL *got_pixel, DWORD *pixel ) +{ + BYTE type = color >> 24; + WORD index = LOWORD( color ); + HPALETTE pal = GetCurrentObject( pdev->dev.hdc, OBJ_PAL ); + PALETTEENTRY pal_ent; + + *pixel = 0; + *got_pixel = FALSE; + + switch( type ) + { + case 0: break; + + case 0x10: /* DIBINDEX */ + *got_pixel = TRUE; + *pixel = 0; + color = RGB(0, 0, 0); + + if (pdev->dib.bit_count <= 8 && index < (1 << pdev->dib.bit_count)) + { + *pixel = index; + if (index < pdev->dib.color_table_size) + color = RGB( pdev->dib.color_table[index].rgbRed, + pdev->dib.color_table[index].rgbGreen, + pdev->dib.color_table[index].rgbBlue ); + } + break; + + case 2: /* PALETTERGB */ + color &= 0xffffff; + break; + + case 1: /* PALETTEINDEX */ + if (!GetPaletteEntries( pal, index, 1, &pal_ent )) + GetPaletteEntries( pal, 0, 1, &pal_ent ); + color = RGB( pal_ent.peRed, pal_ent.peGreen, pal_ent.peBlue ); + break; + + default: + FIXME("Unhandled color type %08x\n", color); + color &= 0xffffff; + } + + return color; +} + /****************************************************************** * get_pixel_color * @@ -135,11 +183,17 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b) DWORD get_pixel_color( dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup ) { RGBQUAD fg_quad; + BOOL got_pixel; + DWORD pixel; + COLORREF rgb_ref; + + rgb_ref = make_rgb_colorref( pdev, color, &got_pixel, &pixel ); + if (got_pixel) return pixel; if (pdev->dib.bit_count != 1 || !mono_fixup) - return pdev->dib.funcs->colorref_to_pixel( &pdev->dib, color ); + return pdev->dib.funcs->colorref_to_pixel( &pdev->dib, rgb_ref ); - fg_quad = rgbquad_from_colorref( color ); + fg_quad = rgbquad_from_colorref( rgb_ref ); if(rgbquad_equal(&fg_quad, pdev->dib.color_table)) return 0; if(rgbquad_equal(&fg_quad, pdev->dib.color_table + 1))
1
0
0
0
Huw Davies : gdi32: Introduce a unified function to perform COLORREF to pixel color mapping.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: 0967de74dbfd452a7d2599e1e32655a4d5b567d8 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=0967de74dbfd452a7d2599e1e…
Author: Huw Davies <huw(a)codeweavers.com> Date: Wed Oct 19 12:41:51 2011 +0100 gdi32: Introduce a unified function to perform COLORREF to pixel color mapping. --- dlls/gdi32/dibdrv/dc.c | 8 ++++---- dlls/gdi32/dibdrv/dibdrv.h | 2 +- dlls/gdi32/dibdrv/objects.c | 22 +++++++++++----------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dlls/gdi32/dibdrv/dc.c b/dlls/gdi32/dibdrv/dc.c index 2331e7c..e832a20 100644 --- a/dlls/gdi32/dibdrv/dc.c +++ b/dlls/gdi32/dibdrv/dc.c @@ -323,8 +323,8 @@ DWORD convert_bitmapinfo( const BITMAPINFO *src_info, void *src_bits, struct bit static void update_fg_colors( dibdrv_physdev *pdev ) { - pdev->pen_color = get_fg_color( pdev, pdev->pen_colorref ); - pdev->brush_color = get_fg_color( pdev, pdev->brush_colorref ); + pdev->pen_color = get_pixel_color( pdev, pdev->pen_colorref, TRUE ); + pdev->brush_color = get_pixel_color( pdev, pdev->brush_colorref, TRUE ); } static void update_masks( dibdrv_physdev *pdev, INT rop ) @@ -427,7 +427,7 @@ static COLORREF dibdrv_SetBkColor( PHYSDEV dev, COLORREF color ) PHYSDEV next = GET_NEXT_PHYSDEV( dev, pSetBkColor ); dibdrv_physdev *pdev = get_dibdrv_pdev(dev); - pdev->bkgnd_color = pdev->dib.funcs->colorref_to_pixel( &pdev->dib, color ); + pdev->bkgnd_color = get_pixel_color( pdev, color, FALSE ); if( GetBkMode(dev->hdc) == OPAQUE ) calc_and_xor_masks( GetROP2(dev->hdc), pdev->bkgnd_color, &pdev->bkgnd_and, &pdev->bkgnd_xor ); @@ -488,7 +488,7 @@ static UINT dibdrv_SetDIBColorTable( PHYSDEV dev, UINT pos, UINT count, const RG if( pos + count > pdev->dib.color_table_size ) count = pdev->dib.color_table_size - pos; memcpy( pdev->dib.color_table + pos, colors, count * sizeof(RGBQUAD) ); - pdev->bkgnd_color = pdev->dib.funcs->colorref_to_pixel( &pdev->dib, GetBkColor( dev->hdc ) ); + pdev->bkgnd_color = get_pixel_color( pdev, GetBkColor( dev->hdc ), FALSE ); update_fg_colors( pdev ); update_masks( pdev, GetROP2( dev->hdc ) ); diff --git a/dlls/gdi32/dibdrv/dibdrv.h b/dlls/gdi32/dibdrv/dibdrv.h index 60b24ee..6d96e77 100644 --- a/dlls/gdi32/dibdrv/dibdrv.h +++ b/dlls/gdi32/dibdrv/dibdrv.h @@ -198,7 +198,7 @@ extern void free_dib_info(dib_info *dib) DECLSPEC_HIDDEN; extern void free_pattern_brush(dibdrv_physdev *pdev) DECLSPEC_HIDDEN; extern void copy_dib_color_info(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN; extern BOOL convert_dib(dib_info *dst, const dib_info *src) DECLSPEC_HIDDEN; -extern DWORD get_fg_color(dibdrv_physdev *pdev, COLORREF color) DECLSPEC_HIDDEN; +extern DWORD get_pixel_color(dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup) DECLSPEC_HIDDEN; extern BOOL brush_rects( dibdrv_physdev *pdev, int num, const RECT *rects ) DECLSPEC_HIDDEN; extern HRGN add_extra_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC_HIDDEN; extern void restore_clipping_region( dibdrv_physdev *pdev, HRGN rgn ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/dibdrv/objects.c b/dlls/gdi32/dibdrv/objects.c index 67eda57..6b278c8 100644 --- a/dlls/gdi32/dibdrv/objects.c +++ b/dlls/gdi32/dibdrv/objects.c @@ -124,7 +124,7 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b) } /****************************************************************** - * get_fg_color + * get_pixel_color * * 1 bit bitmaps map the fg/bg colors as follows: * If the fg colorref exactly matches one of the color table entries then @@ -132,20 +132,20 @@ static inline BOOL rgbquad_equal(const RGBQUAD *a, const RGBQUAD *b) * Otherwise the bg color is mapped to the closest entry in the table and * the fg takes the other one. */ -DWORD get_fg_color( dibdrv_physdev *pdev, COLORREF fg ) +DWORD get_pixel_color( dibdrv_physdev *pdev, COLORREF color, BOOL mono_fixup ) { RGBQUAD fg_quad; - if(pdev->dib.bit_count != 1) - return pdev->dib.funcs->colorref_to_pixel( &pdev->dib, fg ); + if (pdev->dib.bit_count != 1 || !mono_fixup) + return pdev->dib.funcs->colorref_to_pixel( &pdev->dib, color ); - fg_quad = rgbquad_from_colorref( fg ); + fg_quad = rgbquad_from_colorref( color ); if(rgbquad_equal(&fg_quad, pdev->dib.color_table)) return 0; if(rgbquad_equal(&fg_quad, pdev->dib.color_table + 1)) return 1; - if(fg == GetBkColor(pdev->dev.hdc)) return pdev->bkgnd_color; + if(color == GetBkColor(pdev->dev.hdc)) return pdev->bkgnd_color; else return pdev->bkgnd_color ? 0 : 1; } @@ -987,7 +987,7 @@ HPEN dibdrv_SelectPen( PHYSDEV dev, HPEN hpen ) logpen.lopnColor = GetDCPenColor( dev->hdc ); pdev->pen_colorref = logpen.lopnColor; - pdev->pen_color = get_fg_color( pdev, pdev->pen_colorref ); + pdev->pen_color = get_pixel_color( pdev, pdev->pen_colorref, TRUE ); calc_and_xor_masks(GetROP2(dev->hdc), pdev->pen_color, &pdev->pen_and, &pdev->pen_xor); pdev->pen_pattern = dash_patterns[PS_SOLID]; @@ -1039,7 +1039,7 @@ COLORREF dibdrv_SetDCPenColor( PHYSDEV dev, COLORREF color ) if (GetCurrentObject(dev->hdc, OBJ_PEN) == GetStockObject( DC_PEN )) { pdev->pen_colorref = color; - pdev->pen_color = get_fg_color( pdev, pdev->pen_colorref ); + pdev->pen_color = get_pixel_color( pdev, pdev->pen_colorref, TRUE ); calc_and_xor_masks(GetROP2(dev->hdc), pdev->pen_color, &pdev->pen_and, &pdev->pen_xor); } @@ -1311,7 +1311,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) { case BS_SOLID: pdev->brush_colorref = logbrush.lbColor; - pdev->brush_color = get_fg_color( pdev, pdev->brush_colorref ); + pdev->brush_color = get_pixel_color( pdev, pdev->brush_colorref, TRUE ); calc_and_xor_masks(GetROP2(dev->hdc), pdev->brush_color, &pdev->brush_and, &pdev->brush_xor); pdev->brush_rects = solid_brush; pdev->defer &= ~DEFER_BRUSH; @@ -1363,7 +1363,7 @@ HBRUSH dibdrv_SelectBrush( PHYSDEV dev, HBRUSH hbrush ) if(logbrush.lbHatch > HS_DIAGCROSS) return 0; pdev->brush_hatch = logbrush.lbHatch; pdev->brush_colorref = logbrush.lbColor; - pdev->brush_color = get_fg_color( pdev, pdev->brush_colorref ); + pdev->brush_color = get_pixel_color( pdev, pdev->brush_colorref, TRUE ); calc_and_xor_masks(GetROP2(dev->hdc), pdev->brush_color, &pdev->brush_and, &pdev->brush_xor); pdev->brush_rects = pattern_brush; pdev->defer &= ~DEFER_BRUSH; @@ -1388,7 +1388,7 @@ COLORREF dibdrv_SetDCBrushColor( PHYSDEV dev, COLORREF color ) if (GetCurrentObject(dev->hdc, OBJ_BRUSH) == GetStockObject( DC_BRUSH )) { pdev->brush_colorref = color; - pdev->brush_color = get_fg_color( pdev, pdev->brush_colorref ); + pdev->brush_color = get_pixel_color( pdev, pdev->brush_colorref, TRUE ); calc_and_xor_masks(GetROP2(dev->hdc), pdev->brush_color, &pdev->brush_and, &pdev->brush_xor); }
1
0
0
0
Aric Stewart : user32: Recalculate string length when cropping string to fit.
by Alexandre Julliard
19 Oct '11
19 Oct '11
Module: wine Branch: master Commit: 67196377b5b2fd28e7ef3d8bbb674740ddfe0508 URL:
http://source.winehq.org/git/wine.git/?a=commit;h=67196377b5b2fd28e7ef3d8bb…
Author: Aric Stewart <aric(a)codeweavers.com> Date: Wed Oct 19 08:37:25 2011 -0500 user32: Recalculate string length when cropping string to fit. --- dlls/user32/edit.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 039e7c9..dffc72a 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -2489,6 +2489,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac while ((es->text_width > fw) && s + strl >= s) { strcpyW(es->text + s + strl - 1, es->text + s + strl); strl--; + es->text_length = -1; EDIT_InvalidateUniscribeData(es); EDIT_CalcLineWidth_SL(es); }
1
0
0
0
← Newer
1
...
28
29
30
31
32
33
34
...
79
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Results per page:
10
25
50
100
200