Do not clip source rectangle even by visible region for bitblts.
[wine/multimedia.git] / graphics / x11drv / bitmap.c
blob96694579dee6b852fe06a2143638b4ff95a815e4
1 /*
2 * GDI bitmap objects
4 * Copyright 1993 Alexandre Julliard
5 */
7 #include <stdio.h>
8 #include <stdlib.h>
9 #include "ts_xlib.h"
10 #include "ts_xutil.h"
11 #include "gdi.h"
12 #include "callback.h"
13 #include "dc.h"
14 #include "bitmap.h"
15 #include "heap.h"
16 #include "debug.h"
18 /***********************************************************************
19 * X11DRV_BITMAP_Init
21 BOOL32 X11DRV_BITMAP_Init(void)
23 Pixmap tmpPixmap;
25 /* Create the necessary GCs */
27 if ((tmpPixmap = TSXCreatePixmap( display, rootWindow, 1, 1, 1 )))
29 BITMAP_monoGC = TSXCreateGC( display, tmpPixmap, 0, NULL );
30 TSXSetGraphicsExposures( display, BITMAP_monoGC, False );
31 TSXFreePixmap( display, tmpPixmap );
34 if (screenDepth != 1)
36 if ((tmpPixmap = TSXCreatePixmap(display, rootWindow, 1,1,screenDepth)))
38 BITMAP_colorGC = TSXCreateGC( display, tmpPixmap, 0, NULL );
39 TSXSetGraphicsExposures( display, BITMAP_colorGC, False );
40 TSXFreePixmap( display, tmpPixmap );
43 return TRUE;
46 /***********************************************************************
47 * X11DRV_BITMAP_SelectObject
49 HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
50 BITMAPOBJ * bmp )
52 HRGN32 hrgn;
53 HBITMAP32 prevHandle = dc->w.hBitmap;
55 if (!(dc->w.flags & DC_MEMORY)) return 0;
57 dc->w.totalExtent.left = 0;
58 dc->w.totalExtent.top = 0;
59 dc->w.totalExtent.right = bmp->bitmap.bmWidth;
60 dc->w.totalExtent.bottom = bmp->bitmap.bmHeight;
62 if (dc->w.hVisRgn)
63 SetRectRgn32( dc->w.hVisRgn, 0, 0,
64 bmp->bitmap.bmWidth, bmp->bitmap.bmHeight );
65 else
67 hrgn = CreateRectRgn32(0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight);
68 if (!hrgn) return 0;
69 dc->w.hVisRgn = hrgn;
72 dc->u.x.drawable = bmp->pixmap;
73 dc->w.hBitmap = hbitmap;
75 /* Change GC depth if needed */
77 if (dc->w.bitsPerPixel != bmp->bitmap.bmBitsPixel)
79 TSXFreeGC( display, dc->u.x.gc );
80 dc->u.x.gc = TSXCreateGC( display, dc->u.x.drawable, 0, NULL );
81 dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
82 DC_InitDC( dc );
84 else CLIPPING_UpdateGCRegion( dc ); /* Just update GC clip region */
85 return prevHandle;