aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/hw/xwin/winsetsp.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/hw/xwin/winsetsp.c')
-rw-r--r--xorg-server/hw/xwin/winsetsp.c57
1 files changed, 28 insertions, 29 deletions
diff --git a/xorg-server/hw/xwin/winsetsp.c b/xorg-server/hw/xwin/winsetsp.c
index 11108cb53..29f49abe1 100644
--- a/xorg-server/hw/xwin/winsetsp.c
+++ b/xorg-server/hw/xwin/winsetsp.c
@@ -34,6 +34,11 @@
#endif
#include "win.h"
+typedef struct mybitmap
+{
+ BITMAPINFOHEADER bmiHeader;
+ RGBQUAD bmiColors[256]; /* Maximum palette used in case of 8-bit per pixel */
+} mybitmap_t;
/* See Porting Layer Definition - p. 55 */
void
winSetSpansNativeGDI(DrawablePtr pDrawable,
@@ -46,7 +51,7 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
PixmapPtr pPixmap = NULL;
winPrivPixmapPtr pPixmapPriv = NULL;
HBITMAP hbmpOrig = NULL;
- BITMAPINFO *pbmi;
+ mybitmap_t bmi;
HRGN hrgn = NULL, combined = NULL;
int nbox;
BoxPtr pbox;
@@ -57,8 +62,6 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
if (!nbox)
return;
- pbmi = malloc(sizeof(BITMAPINFO) + sizeof(RGBQUAD));
-
combined = CreateRectRgn(pbox->x1, pbox->y1, pbox->x2, pbox->y2);
nbox--;
pbox++;
@@ -88,20 +91,19 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
"failed on pPixmapPriv->hBitmap\n");
while (iSpans--) {
- ZeroMemory(pbmi, sizeof(BITMAPINFO));
- pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- pbmi->bmiHeader.biWidth = *piWidths;
- pbmi->bmiHeader.biHeight = 1;
- pbmi->bmiHeader.biPlanes = 1;
- pbmi->bmiHeader.biBitCount = pDrawable->depth;
- pbmi->bmiHeader.biCompression = BI_RGB;
+ ZeroMemory (&bmi, sizeof (mybitmap_t));
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = *piWidths;
+ bmi.bmiHeader.biHeight = 1;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = pDrawable->depth;
+ bmi.bmiHeader.biCompression = BI_RGB;
/* Setup color table for mono DIBs */
if (pDrawable->depth == 1) {
- RGBQUAD *bmiColors = &(pbmi->bmiColors[0]);
- bmiColors[1].rgbBlue = 255;
- bmiColors[1].rgbGreen = 255;
- bmiColors[1].rgbRed = 255;
+ bmi.bmiColors[1].rgbBlue = 255;
+ bmi.bmiColors[1].rgbGreen = 255;
+ bmi.bmiColors[1].rgbRed = 255;
}
StretchDIBits(pGCPriv->hdcMem,
@@ -110,7 +112,7 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
0, 0,
*piWidths, 1,
pSrcs,
- (BITMAPINFO *) pbmi,
+ (BITMAPINFO *) &bmi,
DIB_RGB_COLORS, g_copyROP[pGC->alu]);
pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
@@ -132,20 +134,19 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
combined = NULL;
while (iSpans--) {
- ZeroMemory(pbmi, sizeof(BITMAPINFO));
- pbmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
- pbmi->bmiHeader.biWidth = *piWidths;
- pbmi->bmiHeader.biHeight = 1;
- pbmi->bmiHeader.biPlanes = 1;
- pbmi->bmiHeader.biBitCount = pDrawable->depth;
- pbmi->bmiHeader.biCompression = BI_RGB;
+ ZeroMemory (&bmi, sizeof (mybitmap_t));
+ bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+ bmi.bmiHeader.biWidth = *piWidths;
+ bmi.bmiHeader.biHeight = 1;
+ bmi.bmiHeader.biPlanes = 1;
+ bmi.bmiHeader.biBitCount = pDrawable->depth;
+ bmi.bmiHeader.biCompression = BI_RGB;
/* Setup color table for mono DIBs */
if (pDrawable->depth == 1) {
- RGBQUAD *bmiColors = &(pbmi->bmiColors[0]);
- bmiColors[1].rgbBlue = 255;
- bmiColors[1].rgbGreen = 255;
- bmiColors[1].rgbRed = 255;
+ bmi.bmiColors[1].rgbBlue = 255;
+ bmi.bmiColors[1].rgbGreen = 255;
+ bmi.bmiColors[1].rgbRed = 255;
}
StretchDIBits(pGCPriv->hdc,
@@ -154,7 +155,7 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
0, 0,
*piWidths, 1,
pSrcs,
- (BITMAPINFO *) pbmi,
+ (BITMAPINFO *) &bmi,
DIB_RGB_COLORS, g_copyROP[pGC->alu]);
pSrcs += PixmapBytePad(*piWidths, pDrawable->depth);
@@ -170,6 +171,4 @@ winSetSpansNativeGDI(DrawablePtr pDrawable,
FatalError("\nwinSetSpansNativeGDI - Unknown drawable type\n\n");
break;
}
-
- free(pbmi);
}