From 50cb30a8b13f3218a1dc933a4584466f4d616438 Mon Sep 17 00:00:00 2001 From: marha Date: Thu, 23 Feb 2012 12:34:50 +0100 Subject: Return error when bitsperpixel is less then 24 --- xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'xorg-server/hw') diff --git a/xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c b/xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c index 4633d4867..c5b799079 100644 --- a/xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c +++ b/xorg-server/hw/xwin/swrastwgl_dri/swrastwgl_dri.c @@ -49,6 +49,7 @@ struct __DRIdrawableRec HBITMAP hBitmap; int winWidth; int winHeight; + int bitsPerPixel; VOID *bits; void *driverPrivate; @@ -290,6 +291,7 @@ void setupDIB(__DRIdrawable * pdp) bmiSize = sizeof(*bmInfo); bitsPerPixel = GetDeviceCaps(pdp->hDC, BITSPIXEL); + pdp->bitsPerPixel=bitsPerPixel; switch (bitsPerPixel) { case 8: @@ -915,6 +917,15 @@ static __DRIscreen *driCreateNewScreen(int scrn, const __DRIextension **extensio static const __DRIextension *emptyExtensionList[] = { NULL }; __DRIscreen *psp; + HDC hDc = GetDC(NULL); + int bitsPerPixel= GetDeviceCaps(hDc, BITSPIXEL); + ReleaseDC(NULL, hDc); + if (bitsPerPixel<24) + { + PRINTF(__FUNCTION__": bitsPerPixel not supported %d\n", bitsPerPixel); + return NULL; + } + psp = calloc(sizeof(struct __DRIscreenRec),1); if (!psp) return NULL; -- cgit v1.2.3