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

This commit is contained in:
Alexandre Julliard 2012-05-02 12:02:28 +02:00
parent 039c85346c
commit a0a95eb0ca
1 changed files with 2 additions and 7 deletions

View File

@ -383,7 +383,6 @@ TW_UINT16 GPHOTO2_ImageNativeXferGet (pTW_IDENTITY pOrigin,
BITMAPINFO bmpInfo; BITMAPINFO bmpInfo;
LPBYTE bits; LPBYTE bits;
JSAMPROW samprow, oldsamprow; JSAMPROW samprow, oldsamprow;
HDC dc;
FIXME("DG_IMAGE/DAT_IMAGENATIVEXFER/MSG_GET: implemented, but expect program crash due to DIB.\n"); FIXME("DG_IMAGE/DAT_IMAGENATIVEXFER/MSG_GET: implemented, but expect program crash due to DIB.\n");
@ -425,8 +424,7 @@ TW_UINT16 GPHOTO2_ImageNativeXferGet (pTW_IDENTITY pOrigin,
bmpInfo.bmiHeader.biYPelsPerMeter = 0; bmpInfo.bmiHeader.biYPelsPerMeter = 0;
bmpInfo.bmiHeader.biClrUsed = 0; bmpInfo.bmiHeader.biClrUsed = 0;
bmpInfo.bmiHeader.biClrImportant = 0; bmpInfo.bmiHeader.biClrImportant = 0;
hDIB = CreateDIBSection ((dc = GetDC(activeDS.hwndOwner)), &bmpInfo, hDIB = CreateDIBSection (0, &bmpInfo, DIB_RGB_COLORS, (LPVOID)&bits, 0, 0);
DIB_RGB_COLORS, (LPVOID)&bits, 0, 0);
if (!hDIB) { if (!hDIB) {
FIXME("Failed creating DIB.\n"); FIXME("Failed creating DIB.\n");
gp_file_unref (activeDS.file); gp_file_unref (activeDS.file);
@ -454,7 +452,6 @@ TW_UINT16 GPHOTO2_ImageNativeXferGet (pTW_IDENTITY pOrigin,
HeapFree (GetProcessHeap(), 0, samprow); HeapFree (GetProcessHeap(), 0, samprow);
gp_file_unref (activeDS.file); gp_file_unref (activeDS.file);
activeDS.file = NULL; activeDS.file = NULL;
ReleaseDC (activeDS.hwndOwner, dc);
*pHandle = (UINT_PTR)hDIB; *pHandle = (UINT_PTR)hDIB;
activeDS.twCC = TWCC_SUCCESS; activeDS.twCC = TWCC_SUCCESS;
activeDS.currentState = 7; activeDS.currentState = 7;
@ -568,7 +565,6 @@ _get_gphoto2_file_as_DIB(
struct jpeg_source_mgr xjsm; struct jpeg_source_mgr xjsm;
struct jpeg_decompress_struct jd; struct jpeg_decompress_struct jd;
struct jpeg_error_mgr jerr; struct jpeg_error_mgr jerr;
HDC dc;
BITMAPINFO bmpInfo; BITMAPINFO bmpInfo;
LPBYTE bits; LPBYTE bits;
JSAMPROW samprow, oldsamprow; JSAMPROW samprow, oldsamprow;
@ -636,7 +632,7 @@ _get_gphoto2_file_as_DIB(
bmpInfo.bmiHeader.biYPelsPerMeter = 0; bmpInfo.bmiHeader.biYPelsPerMeter = 0;
bmpInfo.bmiHeader.biClrUsed = 0; bmpInfo.bmiHeader.biClrUsed = 0;
bmpInfo.bmiHeader.biClrImportant = 0; bmpInfo.bmiHeader.biClrImportant = 0;
*hDIB = CreateDIBSection ((dc = GetDC(hwnd)), &bmpInfo, DIB_RGB_COLORS, (LPVOID)&bits, 0, 0); *hDIB = CreateDIBSection(0, &bmpInfo, DIB_RGB_COLORS, (LPVOID)&bits, 0, 0);
if (!*hDIB) { if (!*hDIB) {
FIXME("Failed creating DIB.\n"); FIXME("Failed creating DIB.\n");
gp_file_unref (file); gp_file_unref (file);
@ -659,7 +655,6 @@ _get_gphoto2_file_as_DIB(
bits = (LPBYTE)(((UINT_PTR)bits + 3) & ~3); bits = (LPBYTE)(((UINT_PTR)bits + 3) & ~3);
samprow = oldsamprow; samprow = oldsamprow;
} }
if (hwnd) ReleaseDC (hwnd, dc);
HeapFree (GetProcessHeap(), 0, samprow); HeapFree (GetProcessHeap(), 0, samprow);
gp_file_unref (file); gp_file_unref (file);
return TWRC_SUCCESS; return TWRC_SUCCESS;