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

Alexandre Julliard julliard at winehq.org
Wed May 2 14:30:02 CDT 2012


Module: wine
Branch: master
Commit: c054d7bc6f0e63a71b8d7b46aeed1f9d5c875315
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c054d7bc6f0e63a71b8d7b46aeed1f9d5c875315

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed May  2 12:02:33 2012 +0200

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

---

 dlls/wined3d/surface.c |   14 +-------------
 1 files changed, 1 insertions(+), 13 deletions(-)

diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index a80cab2..148c014 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -377,8 +377,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
     BITMAPINFO *b_info;
     int extraline = 0;
     DWORD *masks;
-    UINT usage;
-    HDC dc;
 
     TRACE("surface %p.\n", surface);
 
@@ -441,7 +439,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
     switch (surface->resource.format->id)
     {
         case WINED3DFMT_B8G8R8_UNORM:
-            usage = DIB_RGB_COLORS;
             b_info->bmiHeader.biCompression = BI_RGB;
             break;
 
@@ -457,7 +454,6 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
         case WINED3DFMT_B10G10R10A2_UNORM:
         case WINED3DFMT_B5G6R5_UNORM:
         case WINED3DFMT_R16G16B16A16_UNORM:
-            usage = 0;
             b_info->bmiHeader.biCompression = BI_BITFIELDS;
             masks[0] = format->red_mask;
             masks[1] = format->green_mask;
@@ -467,21 +463,13 @@ static HRESULT surface_create_dib_section(struct wined3d_surface *surface)
         default:
             /* Don't know palette */
             b_info->bmiHeader.biCompression = BI_RGB;
-            usage = 0;
             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",
             b_info->bmiHeader.biWidth, b_info->bmiHeader.biHeight,
             b_info->bmiHeader.biBitCount, b_info->bmiHeader.biSizeImage);
-    surface->dib.DIBsection = CreateDIBSection(dc, b_info, usage, &surface->dib.bitmap_data, 0, 0);
-    ReleaseDC(0, dc);
+    surface->dib.DIBsection = CreateDIBSection(0, b_info, DIB_RGB_COLORS, &surface->dib.bitmap_data, 0, 0);
 
     if (!surface->dib.DIBsection)
     {




More information about the wine-cvs mailing list