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>
39 * References to external symbols
42 extern int g_iPixmapPrivateIndex
;
51 winXRotatePixmapNativeGDI (PixmapPtr pPix
, int rw
);
54 winYRotatePixmapNativeGDI (PixmapPtr pPix
, int rh
);
57 winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix
, PixmapPtr
*ppdstPix
,
62 /* See Porting Layer Definition - p. 34 */
63 /* See mfb/mfbpixmap.c - mfbCreatePixmap() */
65 winCreatePixmapNativeGDI (ScreenPtr pScreen
,
66 int iWidth
, int iHeight
,
69 winPrivPixmapPtr pPixmapPriv
= NULL
;
70 PixmapPtr pPixmap
= NULL
;
72 /* Allocate pixmap memory */
73 pPixmap
= AllocatePixmap (pScreen
, 0);
76 ErrorF ("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
81 winDebug ("winCreatePixmap () - w %d h %d d %d bw %d\n",
82 iWidth
, iHeight
, iDepth
,
83 PixmapBytePad (iWidth
, iDepth
));
86 /* Setup pixmap values */
87 pPixmap
->drawable
.type
= DRAWABLE_PIXMAP
;
88 pPixmap
->drawable
.class = 0;
89 pPixmap
->drawable
.pScreen
= pScreen
;
90 pPixmap
->drawable
.depth
= iDepth
;
91 pPixmap
->drawable
.bitsPerPixel
= BitsPerPixel (iDepth
);
92 pPixmap
->drawable
.id
= 0;
93 pPixmap
->drawable
.serialNumber
= NEXT_SERIAL_NUMBER
;
94 pPixmap
->drawable
.x
= 0;
95 pPixmap
->drawable
.y
= 0;
96 pPixmap
->drawable
.width
= iWidth
;
97 pPixmap
->drawable
.height
= iHeight
;
100 pPixmap
->devPrivate
.ptr
= NULL
;
102 /* Pixmap privates are allocated by AllocatePixmap */
103 pPixmapPriv
= winGetPixmapPriv (pPixmap
);
105 /* Initialize pixmap privates */
106 pPixmapPriv
->hBitmap
= NULL
;
107 pPixmapPriv
->hdcSelected
= NULL
;
108 pPixmapPriv
->pbBits
= NULL
;
109 pPixmapPriv
->dwScanlineBytes
= PixmapBytePad (iWidth
, iDepth
);
111 /* Check for zero width or height pixmaps */
112 if (iWidth
== 0 || iHeight
== 0)
114 /* Don't allocate a real pixmap, just set fields and return */
118 /* Create a DIB for the pixmap */
119 pPixmapPriv
->hBitmap
= winCreateDIBNativeGDI (iWidth
, iHeight
, iDepth
,
120 &pPixmapPriv
->pbBits
,
121 (BITMAPINFO
**) &pPixmapPriv
->pbmih
);
124 winDebug ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \
126 pPixmapPriv
->hBitmap
, iWidth
, iHeight
, iDepth
, pScreen
);
134 * See Porting Layer Definition - p. 35
136 * See mfb/mfbpixmap.c - mfbDestroyPixmap()
140 winDestroyPixmapNativeGDI (PixmapPtr pPixmap
)
142 winPrivPixmapPtr pPixmapPriv
= NULL
;
145 winDebug ("winDestroyPixmapNativeGDI ()\n");
148 /* Bail early if there is not a pixmap to destroy */
151 ErrorF ("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
155 /* Get a handle to the pixmap privates */
156 pPixmapPriv
= winGetPixmapPriv (pPixmap
);
159 winDebug ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
160 pPixmapPriv
->hBitmap
);
163 /* Decrement reference count, return if nonzero */
165 if (pPixmap
->refcnt
!= 0)
168 /* Free GDI bitmap */
169 if (pPixmapPriv
->hBitmap
) DeleteObject (pPixmapPriv
->hBitmap
);
171 /* Free the bitmap info header memory */
172 if (pPixmapPriv
->pbmih
!= NULL
)
174 free (pPixmapPriv
->pbmih
);
175 pPixmapPriv
->pbmih
= NULL
;
178 /* Free the pixmap memory */
191 winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap
,
192 int iWidth
, int iHeight
,
198 FatalError ("winModifyPixmapHeaderNativeGDI ()\n");
206 * See cfb/cfbpixmap.c
210 winXRotatePixmapNativeGDI (PixmapPtr pPix
, int rw
)
212 ErrorF ("winXRotatePixmap()\n");
213 /* fill in this function, look at CFB */
219 * See cfb/cfbpixmap.c
222 winYRotatePixmapNativeGDI (PixmapPtr pPix
, int rh
)
224 ErrorF ("winYRotatePixmap()\n");
225 /* fill in this function, look at CFB */
231 * See cfb/cfbpixmap.c
235 winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix
, PixmapPtr
*ppdstPix
,
238 ErrorF ("winCopyRotatePixmap()\n");
239 /* fill in this function, look at CFB */