diff --git a/ChangeLog b/ChangeLog index d8cce00..db294d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2004-09-08 Adam Fedor + + * Headers/x11/XGServer.h: Add 8bit fast drawing. + * Source/x11/XGServer.m ([XGScreenContext + -initForDisplay:screen:]): For 8bit, test for RGB_BEST_MAP. + * Source/xlib/XGBitmap.m (_pixmap_combine_alpha, + _bitmap_combine_alpha, _pixmap_read_alpha): Add 8 bit case. + (patch from Paul Secchia ). + 2004-09-05 00:05 Alexander Malmberg * Tools/GNUmakefile.preamble: Compile with -Wall. diff --git a/Headers/x11/XGServer.h b/Headers/x11/XGServer.h index 0e6470e..696e904 100644 --- a/Headers/x11/XGServer.h +++ b/Headers/x11/XGServer.h @@ -42,6 +42,7 @@ typedef enum { XGDM_FAST16, XGDM_FAST32, XGDM_FAST32_BGR, + XGDM_FAST8, XGDM_PORTABLE } XGDrawMechanism; diff --git a/Source/x11/XGServer.m b/Source/x11/XGServer.m index c556919..3b38c6d 100644 --- a/Source/x11/XGServer.m +++ b/Source/x11/XGServer.m @@ -241,6 +241,25 @@ _parse_display_name(NSString *name, int *dn, int *sn) drawMechanism = XGDM_PORTABLE; } } + else if (rcontext->depth == 8) + { + drawMechanism = XGDM_FAST8; + r = 2; + g = 3; + b = 1; + testColor.pixel = (((r << 3) + g) << 2) + b; + XQueryColor(rcontext->dpy, rcontext->cmap, &testColor); + if (((testColor.red >> 13) != r) + || ((testColor.green >> 13) != g) + || ((testColor.blue >> 14) != b)) + { + NSLog(@"WARNING - XGServer is unable to use the " + @"fast algorithm for writing to an 8-bit display on " + @"this host - the most likely reason being " + @"the StandardColormap RGB_BEST_MAP has not been installed."); + drawMechanism = XGDM_PORTABLE; + } + } else { NSLog(@"WARNING - XGServer is unable to use a " diff --git a/Source/xlib/XGBitmap.m b/Source/xlib/XGBitmap.m index 5ff0c7d..1a58ce7 100644 --- a/Source/xlib/XGBitmap.m +++ b/Source/xlib/XGBitmap.m @@ -136,7 +136,8 @@ _pixmap_combine_alpha(RContext *context, if (drawMechanism == XGDM_FAST15 || drawMechanism == XGDM_FAST16 || drawMechanism == XGDM_FAST32 - || drawMechanism == XGDM_FAST32_BGR) + || drawMechanism == XGDM_FAST32_BGR + || drawMechanism == XGDM_FAST8) { VARIABLES_DECLARATION; unsigned row; @@ -155,6 +156,9 @@ _pixmap_combine_alpha(RContext *context, case XGDM_FAST32_BGR: InitRGBShiftsAndMasks(0,8,8,8,16,8,0,8); break; + case XGDM_FAST8: + InitRGBShiftsAndMasks(5,3,2,3,0,2,0,8); + break; default: NSLog(@"Huh? Backend confused about XGDrawMechanism"); //Try something. With a bit of luck we see @@ -907,7 +911,8 @@ _bitmap_combine_alpha(RContext *context, if (drawMechanism == XGDM_FAST15 || drawMechanism == XGDM_FAST16 || drawMechanism == XGDM_FAST32 - || drawMechanism == XGDM_FAST32_BGR) + || drawMechanism == XGDM_FAST32_BGR + || drawMechanism == XGDM_FAST8) { VARIABLES_DECLARATION; unsigned row; @@ -926,6 +931,9 @@ _bitmap_combine_alpha(RContext *context, case XGDM_FAST32_BGR: InitRGBShiftsAndMasks(0,8,8,8,16,8,0,8); break; + case XGDM_FAST8: + InitRGBShiftsAndMasks(5,3,2,3,0,2,0,8); + break; default: NSLog(@"Huh? Backend confused about XGDrawMechanism"); //Try something. With a bit of luck we see @@ -1186,7 +1194,8 @@ _pixmap_read_alpha(RContext *context, if (drawMechanism == XGDM_FAST15 || drawMechanism == XGDM_FAST16 || drawMechanism == XGDM_FAST32 - || drawMechanism == XGDM_FAST32_BGR) + || drawMechanism == XGDM_FAST32_BGR + || drawMechanism == XGDM_FAST8) { VARIABLES_DECLARATION; unsigned row; @@ -1205,6 +1214,9 @@ _pixmap_read_alpha(RContext *context, case XGDM_FAST32_BGR: InitRGBShiftsAndMasks(0,8,8,8,16,8,0,8); break; + case XGDM_FAST8: + InitRGBShiftsAndMasks(5,3,2,3,0,2,0,8); + break; default: NSLog(@"Huh? Backend confused about XGDrawMechanism"); //Try something. With a bit of luck we see