gdi32: Initialize rgbReserved to zero in SetDIBColorTable.

Signed-off-by: Daniel Lehman <dlehman25@gmail.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Daniel Lehman 2016-11-22 23:28:00 -08:00 committed by Alexandre Julliard
parent 0e8bb752b8
commit 5244bd0748
6 changed files with 14 additions and 7 deletions

View File

@ -6412,7 +6412,7 @@ static void test_palette_alpha(void)
rgbquad.rgbGreen, test_data[i].name);
ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n",
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);
hr = IDirectDrawSurface_ReleaseDC(surface, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);

View File

@ -7659,7 +7659,7 @@ static void test_palette_alpha(void)
rgbquad.rgbGreen, test_data[i].name);
ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n",
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);
hr = IDirectDrawSurface2_ReleaseDC(surface, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);

View File

@ -8623,7 +8623,7 @@ static void test_palette_alpha(void)
rgbquad.rgbGreen, test_data[i].name);
ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n",
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);
hr = IDirectDrawSurface4_ReleaseDC(surface, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);

View File

@ -8423,7 +8423,7 @@ static void test_palette_alpha(void)
rgbquad.rgbGreen, test_data[i].name);
ok(rgbquad.rgbBlue == 0, "Expected rgbBlue = 0, got %#x, %s surface.\n",
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);
hr = IDirectDrawSurface7_ReleaseDC(surface, dc);
ok(SUCCEEDED(hr), "Failed to release DC, hr %#x.\n", hr);

View File

@ -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 )
{
DC * dc;
UINT result = 0;
UINT i, result = 0;
BITMAPOBJ * bitmap;
if (!(dc = get_dc_ptr( hdc ))) return 0;
@ -932,7 +932,13 @@ UINT WINAPI SetDIBColorTable( HDC hdc, UINT startpos, UINT entries, const RGBQUA
if (startpos < bitmap->dib.dsBmih.biClrUsed)
{
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 );

View File

@ -880,12 +880,13 @@ static void test_dibsections(void)
ok( ret == 1, "SetDIBColorTable returned unexpected result %u\n", ret );
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 );
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].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 );
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);
DeleteObject(hdib);