[GDI32_WINETEST] Sync with Wine Staging 1.9.14.
[reactos.git] / rostests / winetests / gdi32 / dib.c
index 6b2b9be..023b902 100644 (file)
@@ -1214,17 +1214,17 @@ static const char **current_sha1;
 static const RECT *current_bounds;
 static const char *dst_format;
 
-static inline DWORD get_stride(BITMAPINFO *bmi)
+static inline DWORD get_stride(const BITMAPINFO *bmi)
 {
     return ((bmi->bmiHeader.biBitCount * bmi->bmiHeader.biWidth + 31) >> 3) & ~3;
 }
 
-static inline DWORD get_dib_size(BITMAPINFO *bmi)
+static inline DWORD get_dib_size(const BITMAPINFO *bmi)
 {
     return get_stride(bmi) * abs(bmi->bmiHeader.biHeight);
 }
 
-static char *hash_dib(BITMAPINFO *bmi, void *bits)
+static char *hash_dib(const BITMAPINFO *bmi, const void *bits)
 {
     DWORD dib_size = get_dib_size(bmi);
     HCRYPTHASH hash;
@@ -1275,14 +1275,12 @@ static void compare_bounds( HDC hdc, const char *info )
         current_bounds->right == -1 &&
         current_bounds->bottom == -1)
     {
-        ok( 0, "missing bounds, got { %d, %d, %d, %d },\n", rect.left, rect.top, rect.right, rect.bottom );
+        ok( 0, "missing bounds, got %s,\n", wine_dbgstr_rect( &rect ));
         return;
     }
 
-    ok( !memcmp( current_bounds, &rect, sizeof(RECT) ),
-        "%s: %s: expected bounds %d,%d,%d,%d got %d,%d,%d,%d\n", dst_format, info,
-        current_bounds->left, current_bounds->top, current_bounds->right, current_bounds->bottom,
-        rect.left, rect.top, rect.right, rect.bottom );
+    ok( EqualRect( current_bounds, &rect ), "%s: %s: expected bounds %s got %s\n", dst_format, info,
+        wine_dbgstr_rect( current_bounds ), wine_dbgstr_rect( &rect ));
     current_bounds++;
 }
 
@@ -1292,7 +1290,7 @@ static void skip_compare( int count )
     current_bounds++;
 }
 
-static void compare_hash_broken_todo(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char *info, int num_broken, BOOL todo)
+static void compare_hash_broken_todo(HDC hdc, const BITMAPINFO *bmi, BYTE *bits, const char *info, int num_broken, BOOL todo)
 {
     char *hash = hash_dib(bmi, bits);
     BOOL ok_cond;
@@ -1322,10 +1320,7 @@ static void compare_hash_broken_todo(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const
     for(i = 1; i <= num_broken; i++)
         ok_cond = ok_cond || broken( !strcmp(hash, current_sha1[i]) );
 
-    if(todo)
-        todo_wine ok( ok_cond, "%s: %s: expected hash %s got %s\n",
-                      dst_format, info, *current_sha1, hash );
-    else
+    todo_wine_if(todo)
         ok( ok_cond, "%s: %s: expected hash %s got %s\n",
             dst_format, info, *current_sha1, hash );
 
@@ -1336,7 +1331,7 @@ static void compare_hash_broken_todo(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const
     compare_bounds( hdc, info );
 }
 
-static void compare_hash(HDC hdc, BITMAPINFO *bmi, BYTE *bits, const char *info)
+static void compare_hash(HDC hdc, const BITMAPINFO *bmi, BYTE *bits, const char *info)
 {
     compare_hash_broken_todo(hdc, bmi, bits, info, 0, FALSE);
 }
@@ -1619,7 +1614,7 @@ static inline void solid_patblt( HDC hdc, int x, int y, int width, int height, C
     DeleteObject( SelectObject( hdc, brush ) );
 }
 
-static void draw_graphics(HDC hdc, BITMAPINFO *bmi, BYTE *bits)
+static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
 {
     char pal_buffer[sizeof(LOGPALETTE) + 255 * sizeof(PALETTEENTRY)];
     LOGPALETTE *pal = (LOGPALETTE *)pal_buffer;
@@ -2844,7 +2839,7 @@ static inline COLORREF aa_colorref( COLORREF dst, COLORREF text, BYTE glyph )
 
 static const BYTE masks[8] = {0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01};
 
-static void draw_text_2( HDC hdc, BITMAPINFO *bmi, BYTE *bits, BOOL aa )
+static void draw_text_2( HDC hdc, const BITMAPINFO *bmi, BYTE *bits, BOOL aa )
 {
     DWORD dib_size = get_dib_size(bmi), ret;
     LOGFONTA lf;
@@ -2960,7 +2955,7 @@ static void draw_text_2( HDC hdc, BITMAPINFO *bmi, BYTE *bits, BOOL aa )
     DeleteObject( font );
 }
 
-static void draw_text( HDC hdc, BITMAPINFO *bmi, BYTE *bits )
+static void draw_text( HDC hdc, const BITMAPINFO *bmi, BYTE *bits )
 {
     draw_text_2( hdc, bmi, bits, FALSE );