Evan Stade : gdiplus: Replace GetDC(0) with CreateCompatibleDC(0).

Alexandre Julliard julliard at wine.codeweavers.com
Fri Aug 10 07:31:16 CDT 2007


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

Author: Evan Stade <estade at gmail.com>
Date:   Thu Aug  9 18:25:05 2007 -0700

gdiplus: Replace GetDC(0) with CreateCompatibleDC(0).

---

 dlls/gdiplus/image.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/gdiplus/image.c b/dlls/gdiplus/image.c
index d779907..a6cf671 100644
--- a/dlls/gdiplus/image.c
+++ b/dlls/gdiplus/image.c
@@ -130,7 +130,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
     bmi.bmiHeader.biBitCount = 0;
 
     if(!bm_is_selected){
-        hdc = GetDC(0);
+        hdc = CreateCompatibleDC(0);
         old = SelectObject(hdc, (HBITMAP)hbm);
     }
 
@@ -149,7 +149,7 @@ GpStatus WINGDIPAPI GdipBitmapLockBits(GpBitmap* bitmap, GDIPCONST GpRect* rect,
 
     if(!bm_is_selected){
         SelectObject(hdc, old);
-        ReleaseDC(0, hdc);
+        DeleteDC(hdc);
     }
 
     lockeddata->Width = rect->Width;
@@ -210,7 +210,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
     bmi.bmiHeader.biBitCount = 0;
 
     if(!bm_is_selected){
-        hdc = GetDC(0);
+        hdc = CreateCompatibleDC(0);
         old = SelectObject(hdc, (HBITMAP)hbm);
     }
 
@@ -221,7 +221,7 @@ GpStatus WINGDIPAPI GdipBitmapUnlockBits(GpBitmap* bitmap,
 
     if(!bm_is_selected){
         SelectObject(hdc, old);
-        ReleaseDC(0, hdc);
+        DeleteDC(hdc);
     }
 
     GdipFree(bitmap->bitmapbits);
@@ -677,11 +677,11 @@ GpStatus WINGDIPAPI GdipLoadImageFromStream(IStream* stream, GpImage **image)
 
         if(!hdc){
             HBITMAP old;
-            hdc = GetDC(0);
+            hdc = CreateCompatibleDC(0);
             old = SelectObject(hdc, (HBITMAP)hbm);
             GetDIBits(hdc, (HBITMAP)hbm, 0, 0, NULL, &bmi, DIB_RGB_COLORS);
             SelectObject(hdc, old);
-            ReleaseDC(0, hdc);
+            DeleteDC(hdc);
         }
         else
             GetDIBits(hdc, (HBITMAP)hbm, 0, 0, NULL, &bmi, DIB_RGB_COLORS);




More information about the wine-cvs mailing list