Module: wine Branch: master Commit: 3ae7035afdaa09eade10e33fc3f3609fadfebfdf URL: https://gitlab.winehq.org/wine/wine/-/commit/3ae7035afdaa09eade10e33fc3f3609...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Nov 23 12:02:51 2022 +0100
win32u: Add a debug helper to print color values.
---
dlls/win32u/brush.c | 4 ++-- dlls/win32u/dibdrv/graphics.c | 6 +++--- dlls/win32u/palette.c | 4 ++-- dlls/win32u/pen.c | 2 +- dlls/win32u/win32u_private.h | 9 +++++++++ dlls/win32u/window.c | 2 +- 6 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/dlls/win32u/brush.c b/dlls/win32u/brush.c index f9b718b4d2e..c5a9eb91d7b 100644 --- a/dlls/win32u/brush.c +++ b/dlls/win32u/brush.c @@ -222,7 +222,7 @@ HBRUSH WINAPI NtGdiCreateHatchBrushInternal( INT style, COLORREF color, BOOL pen { LOGBRUSH logbrush;
- TRACE( "%d %06x\n", style, color ); + TRACE( "%d %s\n", style, debugstr_color(color) );
logbrush.lbStyle = BS_HATCHED; logbrush.lbColor = color; @@ -282,7 +282,7 @@ HBRUSH WINAPI NtGdiCreateSolidBrush( COLORREF color, HBRUSH brush ) { LOGBRUSH logbrush;
- TRACE("%06x\n", color ); + TRACE("%s\n", debugstr_color(color) );
logbrush.lbStyle = BS_SOLID; logbrush.lbColor = color; diff --git a/dlls/win32u/dibdrv/graphics.c b/dlls/win32u/dibdrv/graphics.c index 32d98572801..1eda7d2256a 100644 --- a/dlls/win32u/dibdrv/graphics.c +++ b/dlls/win32u/dibdrv/graphics.c @@ -1056,7 +1056,7 @@ BOOL CDECL dibdrv_ExtFloodFill( PHYSDEV dev, INT x, INT y, COLORREF color, UINT RECT row; HRGN rgn;
- TRACE( "(%p, %d, %d, %08x, %d)\n", pdev, x, y, color, type ); + TRACE( "(%p, %d, %d, %s, %d)\n", pdev, x, y, debugstr_color(color), type );
if (x < 0 || x >= pdev->dib.rect.right - pdev->dib.rect.left || y < 0 || y >= pdev->dib.rect.bottom - pdev->dib.rect.top) return FALSE; @@ -1097,7 +1097,7 @@ COLORREF CDECL dibdrv_GetNearestColor( PHYSDEV dev, COLORREF color ) DC *dc = get_physdev_dc( dev ); DWORD pixel;
- TRACE( "(%p, %08x)\n", dev, color ); + TRACE( "(%p, %s)\n", dev, debugstr_color(color) );
pixel = get_pixel_color( dc, &pdev->dib, color, FALSE ); return pdev->dib.funcs->pixel_to_colorref( &pdev->dib, pixel ); @@ -1575,7 +1575,7 @@ COLORREF CDECL dibdrv_SetPixel( PHYSDEV dev, INT x, INT y, COLORREF color ) POINT pt; DWORD pixel;
- TRACE( "(%p, %d, %d, %08x)\n", dev, x, y, color ); + TRACE( "(%p, %d, %d, %s)\n", dev, x, y, debugstr_color(color) );
pt.x = x; pt.y = y; diff --git a/dlls/win32u/palette.c b/dlls/win32u/palette.c index e8fd51dba22..6d5d1feb292 100644 --- a/dlls/win32u/palette.c +++ b/dlls/win32u/palette.c @@ -384,7 +384,7 @@ UINT WINAPI NtGdiGetNearestPaletteIndex( HPALETTE hpalette, COLORREF color ) } GDI_ReleaseObj( hpalette ); } - TRACE("(%p,%06x): returning %d\n", hpalette, color, index ); + TRACE("(%p,%s): returning %d\n", hpalette, debugstr_color(color), index ); return index; }
@@ -413,7 +413,7 @@ COLORREF CDECL nulldrv_GetNearestColor( PHYSDEV dev, COLORREF color )
if (!get_palette_entries( hpal, index, 1, &entry )) { - WARN("RGB(%x) : idx %d is out of bounds, assuming NULL\n", color, index ); + WARN("%s: idx %d is out of bounds, assuming NULL\n", debugstr_color(color), index ); if (!get_palette_entries( hpal, 0, 1, &entry )) return CLR_INVALID; } color = RGB( entry.peRed, entry.peGreen, entry.peBlue ); diff --git a/dlls/win32u/pen.c b/dlls/win32u/pen.c index 551c4438f3c..f45d7bb1c4e 100644 --- a/dlls/win32u/pen.c +++ b/dlls/win32u/pen.c @@ -59,7 +59,7 @@ HPEN create_pen( INT style, INT width, COLORREF color ) PENOBJ *penPtr; HPEN hpen;
- TRACE( "%d %d %06x\n", style, width, color ); + TRACE( "%d %d %s\n", style, width, debugstr_color(color) );
switch (style) { diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index caab312482e..bc64bedb22b 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -506,4 +506,13 @@ static inline const char *debugstr_us( const UNICODE_STRING *us ) return debugstr_wn( us->Buffer, us->Length / sizeof(WCHAR) ); }
+static inline const char *debugstr_color( COLORREF color ) +{ + if (color & (1 << 24)) /* PALETTEINDEX */ + return wine_dbg_sprintf( "PALETTEINDEX(%u)", LOWORD(color) ); + if (color >> 16 == 0x10ff) /* DIBINDEX */ + return wine_dbg_sprintf( "DIBINDEX(%u)", LOWORD(color) ); + return wine_dbg_sprintf( "RGB(%02x,%02x,%02x)", GetRValue(color), GetGValue(color), GetBValue(color) ); +} + #endif /* __WINE_WIN32U_PRIVATE */ diff --git a/dlls/win32u/window.c b/dlls/win32u/window.c index d92c09689ed..e9328cee55b 100644 --- a/dlls/win32u/window.c +++ b/dlls/win32u/window.c @@ -2066,7 +2066,7 @@ BOOL WINAPI NtUserSetLayeredWindowAttributes( HWND hwnd, COLORREF key, BYTE alph { BOOL ret;
- TRACE( "(%p,%08x,%d,%x)\n", hwnd, key, alpha, flags ); + TRACE( "(%p,%s,%d,%x)\n", hwnd, debugstr_color(key), alpha, flags );
SERVER_START_REQ( set_window_layered_info ) {