2 *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
4 *Permission is hereby granted, free of charge, to any person obtaining
5 * a copy of this software and associated documentation files (the
6 *"Software"), to deal in the Software without restriction, including
7 *without limitation the rights to use, copy, modify, merge, publish,
8 *distribute, sublicense, and/or sell copies of the Software, and to
9 *permit persons to whom the Software is furnished to do so, subject to
10 *the following conditions:
12 *The above copyright notice and this permission notice shall be
13 *included in all copies or substantial portions of the Software.
15 *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
16 *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17 *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
18 *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR
19 *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
20 *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
21 *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *Except as contained in this notice, the name of the XFree86 Project
24 *shall not be used in advertising or otherwise to promote the sale, use
25 *or other dealings in this Software without prior written authorization
26 *from the XFree86 Project.
28 * Authors: drewry, september 1986
32 #ifdef HAVE_XWIN_CONFIG_H
33 #include <xwin-config.h>
43 winXRotatePixmapNativeGDI(PixmapPtr pPix
, int rw
);
46 winYRotatePixmapNativeGDI(PixmapPtr pPix
, int rh
);
50 winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix
, PixmapPtr
*ppdstPix
,
54 /* See Porting Layer Definition - p. 34 */
55 /* See mfb/mfbpixmap.c - mfbCreatePixmap() */
57 winCreatePixmapNativeGDI(ScreenPtr pScreen
,
58 int iWidth
, int iHeight
,
59 int iDepth
, unsigned usage_hint
)
61 winPrivPixmapPtr pPixmapPriv
= NULL
;
62 PixmapPtr pPixmap
= NULL
;
64 /* Allocate pixmap memory */
65 pPixmap
= AllocatePixmap(pScreen
, 0);
67 ErrorF("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
72 winDebug("winCreatePixmap () - w %d h %d d %d uh %d bw %d\n",
73 iWidth
, iHeight
, iDepth
, usage_hint
,
74 PixmapBytePad(iWidth
, iDepth
));
77 /* Setup pixmap values */
78 pPixmap
->drawable
.type
= DRAWABLE_PIXMAP
;
79 pPixmap
->drawable
.class = 0;
80 pPixmap
->drawable
.pScreen
= pScreen
;
81 pPixmap
->drawable
.depth
= iDepth
;
82 pPixmap
->drawable
.bitsPerPixel
= BitsPerPixel(iDepth
);
83 pPixmap
->drawable
.id
= 0;
84 pPixmap
->drawable
.serialNumber
= NEXT_SERIAL_NUMBER
;
85 pPixmap
->drawable
.x
= 0;
86 pPixmap
->drawable
.y
= 0;
87 pPixmap
->drawable
.width
= iWidth
;
88 pPixmap
->drawable
.height
= iHeight
;
91 pPixmap
->devPrivate
.ptr
= NULL
;
92 pPixmap
->usage_hint
= usage_hint
;
94 /* Pixmap privates are allocated by AllocatePixmap */
95 pPixmapPriv
= winGetPixmapPriv(pPixmap
);
97 /* Initialize pixmap privates */
98 pPixmapPriv
->hBitmap
= NULL
;
99 pPixmapPriv
->hdcSelected
= NULL
;
100 pPixmapPriv
->pbBits
= NULL
;
101 pPixmapPriv
->dwScanlineBytes
= PixmapBytePad(iWidth
, iDepth
);
103 /* Check for zero width or height pixmaps */
104 if (iWidth
== 0 || iHeight
== 0) {
105 /* Don't allocate a real pixmap, just set fields and return */
109 /* Create a DIB for the pixmap */
110 pPixmapPriv
->hBitmap
= winCreateDIBNativeGDI(iWidth
, iHeight
, iDepth
,
111 &pPixmapPriv
->pbBits
,
112 (BITMAPINFO
**) &pPixmapPriv
->
116 winDebug("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for "
118 pPixmapPriv
->hBitmap
, iWidth
, iHeight
, iDepth
, pScreen
);
125 * See Porting Layer Definition - p. 35
127 * See mfb/mfbpixmap.c - mfbDestroyPixmap()
131 winDestroyPixmapNativeGDI(PixmapPtr pPixmap
)
133 winPrivPixmapPtr pPixmapPriv
= NULL
;
136 winDebug("winDestroyPixmapNativeGDI ()\n");
139 /* Bail early if there is not a pixmap to destroy */
140 if (pPixmap
== NULL
) {
141 ErrorF("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
145 /* Get a handle to the pixmap privates */
146 pPixmapPriv
= winGetPixmapPriv(pPixmap
);
149 winDebug("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
150 pPixmapPriv
->hBitmap
);
153 /* Decrement reference count, return if nonzero */
155 if (pPixmap
->refcnt
!= 0)
158 /* Free GDI bitmap */
159 if (pPixmapPriv
->hBitmap
)
160 DeleteObject(pPixmapPriv
->hBitmap
);
162 /* Free the bitmap info header memory */
163 free(pPixmapPriv
->pbmih
);
164 pPixmapPriv
->pbmih
= NULL
;
166 /* Free the pixmap memory */
178 winModifyPixmapHeaderNativeGDI(PixmapPtr pPixmap
,
179 int iWidth
, int iHeight
,
181 int iBitsPerPixel
, int devKind
, pointer pPixData
)
183 FatalError("winModifyPixmapHeaderNativeGDI ()\n");
190 * See cfb/cfbpixmap.c
194 winXRotatePixmapNativeGDI(PixmapPtr pPix
, int rw
)
196 ErrorF("winXRotatePixmap()\n");
197 /* fill in this function, look at CFB */
202 * See cfb/cfbpixmap.c
205 winYRotatePixmapNativeGDI(PixmapPtr pPix
, int rh
)
207 ErrorF("winYRotatePixmap()\n");
208 /* fill in this function, look at CFB */
213 * See cfb/cfbpixmap.c
217 winCopyRotatePixmapNativeGDI(PixmapPtr psrcPix
, PixmapPtr
*ppdstPix
,
220 ErrorF("winCopyRotatePixmap()\n");
221 /* fill in this function, look at CFB */