* 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 <paul@worldnet.att.net>).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@20033 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Adam Fedor 2004-09-08 16:22:00 +00:00
parent b1d769a07f
commit 0f4e4f317e
4 changed files with 44 additions and 3 deletions

View file

@ -1,3 +1,12 @@
2004-09-08 Adam Fedor <fedor@gnu.org>
* 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 <paul@worldnet.att.net>).
2004-09-05 00:05 Alexander Malmberg <alexander@malmberg.org>
* Tools/GNUmakefile.preamble: Compile with -Wall.

View file

@ -42,6 +42,7 @@ typedef enum {
XGDM_FAST16,
XGDM_FAST32,
XGDM_FAST32_BGR,
XGDM_FAST8,
XGDM_PORTABLE
} XGDrawMechanism;

View file

@ -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 "

View file

@ -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