From c2a05373bff436737034d97540715d6c6a7e3581 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Mon, 15 Nov 1999 14:30:15 +0000 Subject: [PATCH] patch from Tom Surace for 16 color mode git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4570 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/xpm/create.c | 1 + src/xpm/simx.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/xpm/create.c b/src/xpm/create.c index 1b1e592182..a33b3200d4 100644 --- a/src/xpm/create.c +++ b/src/xpm/create.c @@ -1447,6 +1447,7 @@ MSWSetImagePixels(Display *dc, XImage *image, unsigned int width, unsigned int h for (x = 0; x < width; x++) { SetPixel(*dc, x, y, (pixels[*(data++)] ? RGB(255,255,255) : 0)); /* data is [x+y*width] */ } + } } } else diff --git a/src/xpm/simx.c b/src/xpm/simx.c index b3e3fb1369..6b8ef57b91 100644 --- a/src/xpm/simx.c +++ b/src/xpm/simx.c @@ -119,7 +119,12 @@ XDefaultScreen(Display *d) } /* I get only 1 plane but 8 bits per pixel, - so I think BITSPIXEL should be depth */ + so I think BITSPIXEL should be depth + + TRS: I assume that all "displays" have the same number of + planes later in the code, which is based on the assumption + that the display variable is ignored below. :) + */ int XDefaultDepth(Display *display, Screen *screen) { @@ -261,8 +266,12 @@ XCreateImage(Display *d, Visual *v, if (img) { /* *img = CreateCompatibleBitmap(*d, width, height); */ + #if !defined(__VISAGECPP__) /* fixme for OS/2 */ - img->bitmap = CreateBitmap(width, height, 1 /* plane */ , + /* create the bitmap with the same number of planes as the default display + * (otherwise it wouldn't work for 16 color mode) */ + img->bitmap = CreateBitmap(width, height, + GetDeviceCaps(*d, PLANES), depth /* bits per pixel */ , NULL); #endif img->width = width; -- 2.45.2