X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/blobdiff_plain/6a5fa4e03967ab980cdc7ef96a42400bc29b4414..06fa6a70a8ac0c94b675f748d91f968ed6c6578e:/src/sim/w_x.c diff --git a/src/sim/w_x.c b/src/sim/w_x.c index a6472a0..ef42536 100644 --- a/src/sim/w_x.c +++ b/src/sim/w_x.c @@ -327,28 +327,43 @@ FindXDisplay(Tk_Window tkwin) color->pixel; \ break; \ case 15: \ + if (xd->visual->red_mask == 0x7c00) { \ xd->pixels[i] = \ (((color->red >> (8 + 3)) & 0x1f) << (5 + 5)) | \ (((color->green >> (8 + 2)) & 0x1f) << (5)) | \ (((color->blue >> (8 + 3)) & 0x1f) << (0)); \ + } else { \ + (((color->blue >> (8 + 3)) & 0x1f) << (5 + 5)) | \ + (((color->green >> (8 + 2)) & 0x1f) << (5)) | \ + (((color->red >> (8 + 3)) & 0x1f) << (0)); \ + } \ break; \ case 16: \ + if (xd->visual->red_mask == 0xf800) { \ xd->pixels[i] = \ (((color->red >> (8 + 3)) & 0x1f) << (6 + 5)) | \ (((color->green >> (8 + 2)) & 0x3f) << (5)) | \ (((color->blue >> (8 + 3)) & 0x1f) << (0)); \ + } else { \ + xd->pixels[i] = \ + (((color->blue >> (8 + 3)) & 0x1f) << (6 + 5)) | \ + (((color->green >> (8 + 2)) & 0x3f) << (5)) | \ + (((color->red >> (8 + 3)) & 0x1f) << (0)); \ + } \ break; \ case 24: \ + case 32: \ + if (xd->visual->red_mask == 0xff0000) { \ xd->pixels[i] = \ ((color->red & 0xff) << 16) | \ ((color->green & 0xff) << 8) | \ ((color->blue & 0xff) << 0); \ - break; \ - case 32: \ + } else { \ xd->pixels[i] = \ - ((color->red & 0xff) << 16) | \ + ((color->blue & 0xff) << 16) | \ ((color->green & 0xff) << 8) | \ - ((color->blue & 0xff) << 0); \ + ((color->red & 0xff) << 0); \ + } \ break; \ } \ } \ @@ -488,6 +503,7 @@ SimView * InitNewView(SimView *view, char *title, int class, int w, int h) { int type, i; + int test = 1; int d = 8; unsigned long valuemask = 0; char *t; @@ -582,6 +598,10 @@ InitNewView(SimView *view, char *title, int class, int w, int h) view->type = X_Mem_View; } + view->x->needs_swap = !(*(unsigned char*) (&test)); + view->x->x_big_endian = (ImageByteOrder(view->x->dpy) == MSBFirst); + + GetPixmaps(view->x); view->pixels = view->x->pixels; @@ -591,8 +611,6 @@ InitNewView(SimView *view, char *title, int class, int w, int h) view->pan_x = w / 2; view->pan_y = h / 2; DoResizeView(view, w, h); - GetViewTiles(view); - return (view); } @@ -1138,7 +1156,7 @@ DoResizeView(SimView *view, int w, int h) view->pixel_bytes = 2; view->depth = 15; bitmap_pad = 16; - bitmap_depth = 16; + bitmap_depth = 15; view->line_bytes8 = ((view->m_width * view->pixel_bytes) + 3) & (~3); break; @@ -1156,7 +1174,7 @@ DoResizeView(SimView *view, int w, int h) view->pixel_bytes = 4; //view->pixel_bytes = 3; view->depth = 24; - bitmap_depth = 32; + bitmap_depth = 24; bitmap_pad = 32; view->line_bytes8 = ((view->m_width * 4) + 3) & (~3); @@ -1224,6 +1242,9 @@ DoResizeView(SimView *view, int w, int h) } } } + + GetViewTiles(view); + }