Evas GDI engine: save the original bitmap into the memory DC
authorVincent Torri <vincent.torri@gmail.com>
Thu, 23 Jul 2015 07:52:31 +0000 (09:52 +0200)
committerTom Hacohen <tom@stosb.com>
Thu, 23 Jul 2015 13:05:33 +0000 (14:05 +0100)
This allows the memory DC to be killed and fix a memory leak

@fix

src/modules/evas/engines/software_gdi/evas_gdi_buffer.c

index fe69d73..ab233dd 100644 (file)
@@ -59,18 +59,21 @@ evas_software_gdi_output_buffer_paste(Gdi_Output_Buffer *gdiob,
                                       int                y)
 {
    HDC     dc;
+   HGDIOBJ obj;
 
    dc = CreateCompatibleDC(gdiob->dc);
-   if (!dc)
-     return;
-   SelectObject(dc, gdiob->bitmap);
-   BitBlt(gdiob->dc,
-          x, y,
-          gdiob->width, gdiob->height,
-          dc,
-          0, 0,
-          SRCCOPY);
-   DeleteDC(dc);
+   if (dc)
+     {
+        obj = SelectObject(dc, gdiob->bitmap);
+        BitBlt(gdiob->dc,
+               x, y,
+               gdiob->width, gdiob->height,
+               dc,
+               0, 0,
+               SRCCOPY);
+        SelectObject(dc, obj);
+        DeleteDC(dc);
+     }
 }
 
 DATA8 *