Replaced X11DRV_CritSection references by wine_tsx11_(un)lock.
[wine] / graphics / x11drv / objects.c
index c665b07..cb5377c 100644 (file)
@@ -4,37 +4,42 @@
  * Copyright 1993 Alexandre Julliard
  */
 
+#include "config.h"
+
 #include <stdlib.h>
 #include <stdio.h>
+
 #include "bitmap.h"
 #include "brush.h"
 #include "font.h"
 #include "pen.h"
-#include "stddebug.h"
-#include "debug.h"
+#include "debugtools.h"
 
+DEFAULT_DEBUG_CHANNEL(gdi);
 
-extern HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
+
+extern HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
                                              BITMAPOBJ * bmp );
-extern HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
+extern HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush,
                                            BRUSHOBJ * brush );
-extern HFONT32 X11DRV_FONT_SelectObject( DC * dc, HFONT32 hfont,
+extern HFONT X11DRV_FONT_SelectObject( DC * dc, HFONT hfont,
                                          FONTOBJ * font );
-extern HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen );
+extern HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen );
 
+extern BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ *bmp );
 
 /***********************************************************************
  *           X11DRV_SelectObject
  */
-HGDIOBJ32 X11DRV_SelectObject( DC *dc, HGDIOBJ32 handle )
+HGDIOBJ X11DRV_SelectObject( DC *dc, HGDIOBJ handle )
 {
     GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
-    HGDIOBJ32 ret = 0;
+    HGDIOBJ ret = 0;
 
     if (!ptr) return 0;
-    dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
+    TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
     
-    switch(ptr->wMagic)
+    switch(GDIMAGIC(ptr->wMagic))
     {
       case PEN_MAGIC:
          ret = X11DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
@@ -52,6 +57,32 @@ HGDIOBJ32 X11DRV_SelectObject( DC *dc, HGDIOBJ32 handle )
          ret = (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
          break;
     }
-    GDI_HEAP_UNLOCK( handle );
+    GDI_ReleaseObj( handle );
     return ret;
 }
+
+
+/***********************************************************************
+ *           X11DRV_DeleteObject
+ */
+BOOL X11DRV_DeleteObject( HGDIOBJ handle )
+{
+    GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
+    BOOL ret = 0;
+
+    if (!ptr) return FALSE;
+     
+    switch(GDIMAGIC(ptr->wMagic)) {
+    case BITMAP_MAGIC:
+        ret = X11DRV_BITMAP_DeleteObject( handle, (BITMAPOBJ *)ptr );
+       break;
+
+    default:
+        ERR("Shouldn't be here!\n");
+       ret = FALSE;
+       break;
+    }
+    GDI_ReleaseObj( handle );
+    return ret;
+}
+