Commit 5244bd07 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

gdi32: Initialize rgbReserved to zero in SetDIBColorTable.

parent 0e8bb752
...@@ -6412,7 +6412,7 @@ static void test_palette_alpha(void) ...@@ -6412,7 +6412,7 @@ static void test_palette_alpha(void)
rgbquad.rgbGreen, test_data[i].name); rgbquad.rgbGreen, test_data[i].name);
ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n", ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n",
rgbquad.rgbBlue, test_data[i].name); rgbquad.rgbBlue, test_data[i].name);
todo_wine ok(rgbquad.rgbReserved == 0, "Expected rgbReserved = 0, got %u, %s surface.\n", ok(rgbquad.rgbReserved == 0, "Expected rgbReserved = 0, got %u, %s surface.\n",
rgbquad.rgbReserved, test_data[i].name); rgbquad.rgbReserved, test_data[i].name);
hr = IDirectDrawSurface_ReleaseDC(surface, dc); hr = IDirectDrawSurface_ReleaseDC(surface, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
......
...@@ -7659,7 +7659,7 @@ static void test_palette_alpha(void) ...@@ -7659,7 +7659,7 @@ static void test_palette_alpha(void)
rgbquad.rgbGreen, test_data[i].name); rgbquad.rgbGreen, test_data[i].name);
ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n", ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n",
rgbquad.rgbBlue, test_data[i].name); rgbquad.rgbBlue, test_data[i].name);
todo_wine ok(rgbquad.rgbReserved == 0, "Expected rgbReserved = 0, got %u, %s surface.\n", ok(rgbquad.rgbReserved == 0, "Expected rgbReserved = 0, got %u, %s surface.\n",
rgbquad.rgbReserved, test_data[i].name); rgbquad.rgbReserved, test_data[i].name);
hr = IDirectDrawSurface2_ReleaseDC(surface, dc); hr = IDirectDrawSurface2_ReleaseDC(surface, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
......
...@@ -8623,7 +8623,7 @@ static void test_palette_alpha(void) ...@@ -8623,7 +8623,7 @@ static void test_palette_alpha(void)
rgbquad.rgbGreen, test_data[i].name); rgbquad.rgbGreen, test_data[i].name);
ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n", ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n",
rgbquad.rgbBlue, test_data[i].name); rgbquad.rgbBlue, test_data[i].name);
todo_wine ok(rgbquad.rgbReserved == 0, "Expected rgbReserved = 0, got %u, %s surface.\n", ok(rgbquad.rgbReserved == 0, "Expected rgbReserved = 0, got %u, %s surface.\n",
rgbquad.rgbReserved, test_data[i].name); rgbquad.rgbReserved, test_data[i].name);
hr = IDirectDrawSurface4_ReleaseDC(surface, dc); hr = IDirectDrawSurface4_ReleaseDC(surface, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
......
...@@ -8423,7 +8423,7 @@ static void test_palette_alpha(void) ...@@ -8423,7 +8423,7 @@ static void test_palette_alpha(void)
rgbquad.rgbGreen, test_data[i].name); rgbquad.rgbGreen, test_data[i].name);
ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n", ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n",
rgbquad.rgbBlue, test_data[i].name); rgbquad.rgbBlue, test_data[i].name);
todo_wine ok(rgbquad.rgbReserved == 0, "Expected rgbReserved = 0, got %u, %s surface.\n", ok(rgbquad.rgbReserved == 0, "Expected rgbReserved = 0, got %u, %s surface.\n",
rgbquad.rgbReserved, test_data[i].name); rgbquad.rgbReserved, test_data[i].name);
hr = IDirectDrawSurface7_ReleaseDC(surface, dc); hr = IDirectDrawSurface7_ReleaseDC(surface, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);
......
...@@ -922,7 +922,7 @@ INT WINAPI SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx, ...@@ -922,7 +922,7 @@ INT WINAPI SetDIBitsToDevice(HDC hdc, INT xDest, INT yDest, DWORD cx,
UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUAD *colors ) UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUAD *colors )
{ {
DC * dc; DC * dc;
UINT result = 0; UINT i, result = 0;
BITMAPOBJ * bitmap; BITMAPOBJ * bitmap;
if (!(dc = get_dc_ptr( hdc ))) return 0; if (!(dc = get_dc_ptr( hdc ))) return 0;
...@@ -932,7 +932,13 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUA ...@@ -932,7 +932,13 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUA
if (startpos < bitmap->dib.dsBmih.biClrUsed) if (startpos < bitmap->dib.dsBmih.biClrUsed)
{ {
result = min( entries, bitmap->dib.dsBmih.biClrUsed - startpos ); result = min( entries, bitmap->dib.dsBmih.biClrUsed - startpos );
memcpy(bitmap->color_table + startpos, colors, result * sizeof(RGBQUAD)); for (i = 0; i < result; i++)
{
bitmap->color_table[startpos + i].rgbBlue = colors[i].rgbBlue;
bitmap->color_table[startpos + i].rgbGreen = colors[i].rgbGreen;
bitmap->color_table[startpos + i].rgbRed = colors[i].rgbRed;
bitmap->color_table[startpos + i].rgbReserved = 0;
}
} }
GDI_ReleaseObj( dc->hBitmap ); GDI_ReleaseObj( dc->hBitmap );
......
...@@ -880,12 +880,13 @@ static void test_dibsections(void) ...@@ -880,12 +880,13 @@ static void test_dibsections(void)
ok( ret == 1, "SetDIBColorTable returned unexpected result %u\n", ret ); ok( ret == 1, "SetDIBColorTable returned unexpected result %u\n", ret );
ok( rgb[0].rgbReserved == 123, "Expected rgbReserved = 123, got %u\n", rgb[0].rgbReserved ); ok( rgb[0].rgbReserved == 123, "Expected rgbReserved = 123, got %u\n", rgb[0].rgbReserved );
rgb[0].rgbRed = rgb[0].rgbGreen = rgb[0].rgbBlue = rgb[0].rgbReserved = -1;
ret = GetDIBColorTable( hdcmem, 0, 1, rgb ); ret = GetDIBColorTable( hdcmem, 0, 1, rgb );
ok( ret == 1, "GetDIBColorTable returned unexpected result %u\n", ret ); ok( ret == 1, "GetDIBColorTable returned unexpected result %u\n", ret );
ok( rgb[0].rgbRed == 1, "Expected rgbRed = 1, got %u\n", rgb[0].rgbRed ); ok( rgb[0].rgbRed == 1, "Expected rgbRed = 1, got %u\n", rgb[0].rgbRed );
ok( rgb[0].rgbGreen == 2, "Expected rgbGreen = 2, got %u\n", rgb[0].rgbGreen ); ok( rgb[0].rgbGreen == 2, "Expected rgbGreen = 2, got %u\n", rgb[0].rgbGreen );
ok( rgb[0].rgbBlue == 3, "Expected rgbBlue = 3, got %u\n", rgb[0].rgbBlue ); ok( rgb[0].rgbBlue == 3, "Expected rgbBlue = 3, got %u\n", rgb[0].rgbBlue );
todo_wine ok( rgb[0].rgbReserved == 0, "Expected rgbReserved = 0, got %u\n", rgb[0].rgbReserved ); ok( rgb[0].rgbReserved == 0, "Expected rgbReserved = 0, got %u\n", rgb[0].rgbReserved );
SelectObject(hdcmem, oldbm); SelectObject(hdcmem, oldbm);
DeleteObject(hdib); DeleteObject(hdib);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment