Commit c054d7bc authored by Alexandre Julliard's avatar Alexandre Julliard

wined3d: CreateDIBSection doesn't need a DC for the DIB_RGB_COLORS case.

parent a0a95eb0
...@@ -377,8 +377,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface) ...@@ -377,8 +377,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
BITMAPINFO *b_info; BITMAPINFO *b_info;
int extraline = 0; int extraline = 0;
DWORD *masks; DWORD *masks;
UINT usage;
HDC dc;
TRACE("surface %p.\n", surface); TRACE("surface %p.\n", surface);
...@@ -441,7 +439,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface) ...@@ -441,7 +439,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
switch (surface->resource.format->id) switch (surface->resource.format->id)
{ {
case WINED3DFMT_B8G8R8_UNORM: case WINED3DFMT_B8G8R8_UNORM:
usage = DIB_RGB_COLORS;
b_info->bmiHeader.biCompression = BI_RGB; b_info->bmiHeader.biCompression = BI_RGB;
break; break;
...@@ -457,7 +454,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface) ...@@ -457,7 +454,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
case WINED3DFMT_B10G10R10A2_UNORM: case WINED3DFMT_B10G10R10A2_UNORM:
case WINED3DFMT_B5G6R5_UNORM: case WINED3DFMT_B5G6R5_UNORM:
case WINED3DFMT_R16G16B16A16_UNORM: case WINED3DFMT_R16G16B16A16_UNORM:
usage = 0;
b_info->bmiHeader.biCompression = BI_BITFIELDS; b_info->bmiHeader.biCompression = BI_BITFIELDS;
masks[0] = format->red_mask; masks[0] = format->red_mask;
masks[1] = format->green_mask; masks[1] = format->green_mask;
...@@ -467,21 +463,13 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface) ...@@ -467,21 +463,13 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
default: default:
/* Don't know palette */ /* Don't know palette */
b_info->bmiHeader.biCompression = BI_RGB; b_info->bmiHeader.biCompression = BI_RGB;
usage = 0;
break; break;
} }
if (!(dc = GetDC(0)))
{
HeapFree(GetProcessHeap(), 0, b_info);
return HRESULT_FROM_WIN32(GetLastError());
}
TRACE("Creating a DIB section with size %dx%dx%d, size=%d.\n", TRACE("Creating a DIB section with size %dx%dx%d, size=%d.\n",
b_info->bmiHeader.biWidth, b_info->bmiHeader.biHeight, b_info->bmiHeader.biWidth, b_info->bmiHeader.biHeight,
b_info->bmiHeader.biBitCount, b_info->bmiHeader.biSizeImage); b_info->bmiHeader.biBitCount, b_info->bmiHeader.biSizeImage);
surface->dib.DIBsection = CreateDIBSection(dc, b_info, usage, &surface->dib.bitmap_data, 0, 0); surface->dib.DIBsection = CreateDIBSection(0, b_info, DIB_RGB_COLORS, &surface->dib.bitmap_data, 0, 0);
ReleaseDC(0, dc);
if (!surface->dib.DIBsection) if (!surface->dib.DIBsection)
{ {
......
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