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
31
/* $XFree86: xc/programs/Xserver/hw/xwin/winpixmap.c,v 1.10 2002/10/17 08:18:24 alanh Exp $ */
33
#ifdef HAVE_XWIN_CONFIG_H
34
#include <xwin-config.h>
40
* References to external symbols
43
extern int g_iPixmapPrivateIndex;
52
winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw);
55
winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh);
58
winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
63
/* See Porting Layer Definition - p. 34 */
64
/* See mfb/mfbpixmap.c - mfbCreatePixmap() */
66
winCreatePixmapNativeGDI (ScreenPtr pScreen,
67
int iWidth, int iHeight,
70
winPrivPixmapPtr pPixmapPriv = NULL;
71
PixmapPtr pPixmap = NULL;
73
/* Allocate pixmap memory */
74
pPixmap = AllocatePixmap (pScreen, 0);
77
ErrorF ("winCreatePixmapNativeGDI () - Couldn't allocate a pixmap\n");
82
winDebug ("winCreatePixmap () - w %d h %d d %d bw %d\n",
83
iWidth, iHeight, iDepth,
84
PixmapBytePad (iWidth, iDepth));
87
/* Setup pixmap values */
88
pPixmap->drawable.type = DRAWABLE_PIXMAP;
89
pPixmap->drawable.class = 0;
90
pPixmap->drawable.pScreen = pScreen;
91
pPixmap->drawable.depth = iDepth;
92
pPixmap->drawable.bitsPerPixel = BitsPerPixel (iDepth);
93
pPixmap->drawable.id = 0;
94
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
95
pPixmap->drawable.x = 0;
96
pPixmap->drawable.y = 0;
97
pPixmap->drawable.width = iWidth;
98
pPixmap->drawable.height = iHeight;
101
pPixmap->devPrivate.ptr = NULL;
103
/* Pixmap privates are allocated by AllocatePixmap */
104
pPixmapPriv = winGetPixmapPriv (pPixmap);
106
/* Initialize pixmap privates */
107
pPixmapPriv->hBitmap = NULL;
108
pPixmapPriv->hdcSelected = NULL;
109
pPixmapPriv->pbBits = NULL;
110
pPixmapPriv->dwScanlineBytes = PixmapBytePad (iWidth, iDepth);
112
/* Check for zero width or height pixmaps */
113
if (iWidth == 0 || iHeight == 0)
115
/* Don't allocate a real pixmap, just set fields and return */
119
/* Create a DIB for the pixmap */
120
pPixmapPriv->hBitmap = winCreateDIBNativeGDI (iWidth, iHeight, iDepth,
121
&pPixmapPriv->pbBits,
122
(BITMAPINFO **) &pPixmapPriv->pbmih);
125
winDebug ("winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for " \
127
pPixmapPriv->hBitmap, iWidth, iHeight, iDepth, pScreen);
135
* See Porting Layer Definition - p. 35
137
* See mfb/mfbpixmap.c - mfbDestroyPixmap()
141
winDestroyPixmapNativeGDI (PixmapPtr pPixmap)
143
winPrivPixmapPtr pPixmapPriv = NULL;
146
winDebug ("winDestroyPixmapNativeGDI ()\n");
149
/* Bail early if there is not a pixmap to destroy */
152
ErrorF ("winDestroyPixmapNativeGDI () - No pixmap to destroy\n");
156
/* Get a handle to the pixmap privates */
157
pPixmapPriv = winGetPixmapPriv (pPixmap);
160
winDebug ("winDestroyPixmapNativeGDI - pPixmapPriv->hBitmap: %08x\n",
161
pPixmapPriv->hBitmap);
164
/* Decrement reference count, return if nonzero */
166
if (pPixmap->refcnt != 0)
169
/* Free GDI bitmap */
170
if (pPixmapPriv->hBitmap) DeleteObject (pPixmapPriv->hBitmap);
172
/* Free the bitmap info header memory */
173
if (pPixmapPriv->pbmih != NULL)
175
free (pPixmapPriv->pbmih);
176
pPixmapPriv->pbmih = NULL;
179
/* Free the pixmap memory */
192
winModifyPixmapHeaderNativeGDI (PixmapPtr pPixmap,
193
int iWidth, int iHeight,
199
FatalError ("winModifyPixmapHeaderNativeGDI ()\n");
207
* See cfb/cfbpixmap.c
211
winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw)
213
ErrorF ("winXRotatePixmap()\n");
214
/* fill in this function, look at CFB */
220
* See cfb/cfbpixmap.c
223
winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh)
225
ErrorF ("winYRotatePixmap()\n");
226
/* fill in this function, look at CFB */
232
* See cfb/cfbpixmap.c
236
winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix,
239
ErrorF ("winCopyRotatePixmap()\n");
240
/* fill in this function, look at CFB */