Removed some unnecessary includes.
[wine.git] / graphics / x11drv / objects.c
blobcb5377c525ecda104d8035dcd2e2d260ba6fb65b
1 /*
2 * GDI objects
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include "config.h"
9 #include <stdlib.h>
10 #include <stdio.h>
12 #include "bitmap.h"
13 #include "brush.h"
14 #include "font.h"
15 #include "pen.h"
16 #include "debugtools.h"
18 DEFAULT_DEBUG_CHANNEL(gdi);
21 extern HBITMAP X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP hbitmap,
22 BITMAPOBJ * bmp );
23 extern HBRUSH X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH hbrush,
24 BRUSHOBJ * brush );
25 extern HFONT X11DRV_FONT_SelectObject( DC * dc, HFONT hfont,
26 FONTOBJ * font );
27 extern HPEN X11DRV_PEN_SelectObject( DC * dc, HPEN hpen, PENOBJ * pen );
29 extern BOOL X11DRV_BITMAP_DeleteObject( HBITMAP hbitmap, BITMAPOBJ *bmp );
31 /***********************************************************************
32 * X11DRV_SelectObject
34 HGDIOBJ X11DRV_SelectObject( DC *dc, HGDIOBJ handle )
36 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
37 HGDIOBJ ret = 0;
39 if (!ptr) return 0;
40 TRACE("hdc=%04x %04x\n", dc->hSelf, handle );
42 switch(GDIMAGIC(ptr->wMagic))
44 case PEN_MAGIC:
45 ret = X11DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
46 break;
47 case BRUSH_MAGIC:
48 ret = X11DRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
49 break;
50 case BITMAP_MAGIC:
51 ret = X11DRV_BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
52 break;
53 case FONT_MAGIC:
54 ret = X11DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
55 break;
56 case REGION_MAGIC:
57 ret = (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
58 break;
60 GDI_ReleaseObj( handle );
61 return ret;
65 /***********************************************************************
66 * X11DRV_DeleteObject
68 BOOL X11DRV_DeleteObject( HGDIOBJ handle )
70 GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
71 BOOL ret = 0;
73 if (!ptr) return FALSE;
75 switch(GDIMAGIC(ptr->wMagic)) {
76 case BITMAP_MAGIC:
77 ret = X11DRV_BITMAP_DeleteObject( handle, (BITMAPOBJ *)ptr );
78 break;
80 default:
81 ERR("Shouldn't be here!\n");
82 ret = FALSE;
83 break;
85 GDI_ReleaseObj( handle );
86 return ret;