gdiplus: Replace GetDC(0) with CreateCompatibleDC(0).
This commit is contained in:
parent
94a19d1f75
commit
9c30236dee
|
@ -130,7 +130,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
|
||||||
bmi.bmiHeader.biBitCount = 0;
|
bmi.bmiHeader.biBitCount = 0;
|
||||||
|
|
||||||
if(!bm_is_selected){
|
if(!bm_is_selected){
|
||||||
hdc = GetDC(0);
|
hdc = CreateCompatibleDC(0);
|
||||||
old = SelectObject(hdc, (HBITMAP)hbm);
|
old = SelectObject(hdc, (HBITMAP)hbm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
|
||||||
|
|
||||||
if(!bm_is_selected){
|
if(!bm_is_selected){
|
||||||
SelectObject(hdc, old);
|
SelectObject(hdc, old);
|
||||||
ReleaseDC(0, hdc);
|
DeleteDC(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
lockeddata->Width = rect->Width;
|
lockeddata->Width = rect->Width;
|
||||||
|
@ -210,7 +210,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
|
||||||
bmi.bmiHeader.biBitCount = 0;
|
bmi.bmiHeader.biBitCount = 0;
|
||||||
|
|
||||||
if(!bm_is_selected){
|
if(!bm_is_selected){
|
||||||
hdc = GetDC(0);
|
hdc = CreateCompatibleDC(0);
|
||||||
old = SelectObject(hdc, (HBITMAP)hbm);
|
old = SelectObject(hdc, (HBITMAP)hbm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
|
||||||
|
|
||||||
if(!bm_is_selected){
|
if(!bm_is_selected){
|
||||||
SelectObject(hdc, old);
|
SelectObject(hdc, old);
|
||||||
ReleaseDC(0, hdc);
|
DeleteDC(hdc);
|
||||||
}
|
}
|
||||||
|
|
||||||
GdipFree(bitmap->bitmapbits);
|
GdipFree(bitmap->bitmapbits);
|
||||||
|
@ -677,11 +677,11 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
|
||||||
|
|
||||||
if(!hdc){
|
if(!hdc){
|
||||||
HBITMAP old;
|
HBITMAP old;
|
||||||
hdc = GetDC(0);
|
hdc = CreateCompatibleDC(0);
|
||||||
old = SelectObject(hdc, (HBITMAP)hbm);
|
old = SelectObject(hdc, (HBITMAP)hbm);
|
||||||
GetDIBits(hdc, (HBITMAP)hbm, 0, 0, NULL, &bmi, DIB_RGB_COLORS);
|
GetDIBits(hdc, (HBITMAP)hbm, 0, 0, NULL, &bmi, DIB_RGB_COLORS);
|
||||||
SelectObject(hdc, old);
|
SelectObject(hdc, old);
|
||||||
ReleaseDC(0, hdc);
|
DeleteDC(hdc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
GetDIBits(hdc, (HBITMAP)hbm, 0, 0, NULL, &bmi, DIB_RGB_COLORS);
|
GetDIBits(hdc, (HBITMAP)hbm, 0, 0, NULL, &bmi, DIB_RGB_COLORS);
|
||||||
|
|
Loading…
Reference in New Issue