diff --git a/ChangeLog b/ChangeLog index a2ca483..101155a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2010-01-22 Wolfgang Lux + + * Source/x11/XWindowBuffer.m (+windowBufferForWindow:depthInfo:): + * Source/art/ARTGState.m (-GSSetDevice:): + * Source/cairo/XGCairoXImageSurface.m (-initWithDevice:): + Fix bug #28590 (with a little help from Fred Kiefer). + 2010-01-21 15:45-EST Riccardo Mottola Committed by: Gregory John Casamento @@ -7,7 +14,7 @@ 2010-01-14 Wolfgang Lux - * Source/x11/XGServerEvent.m (-processEvent:): + * Source/x11/XGServerEvent.m (-processEvent:): * Source/x11/XGServerWindow.m (-_wm_state:, -_ewmh_state, -_checkStyle, -_rootWindowForScreen:, -window::::, -nativeWindow:::::): Revise detection of window miniaturization and deminiaturization based on diff --git a/Headers/x11/XWindowBuffer.h b/Headers/x11/XWindowBuffer.h index 89e2a74..4ba2025 100644 --- a/Headers/x11/XWindowBuffer.h +++ b/Headers/x11/XWindowBuffer.h @@ -50,6 +50,11 @@ struct XWindowBuffer_depth_info_s holds the alpha value. */ BOOL inline_alpha; int inline_alpha_ofs; + + /* If the buffer stores the data with the client's native byte order, + this should be YES. Normally, an XImage uses the byte order of the + X server. */ + BOOL byte_order_from_client; }; /* diff --git a/Source/art/ARTGState.m b/Source/art/ARTGState.m index 1901a4c..ad3a4f3 100644 --- a/Source/art/ARTGState.m +++ b/Source/art/ARTGState.m @@ -638,6 +638,7 @@ draw_info_t ART_DI; di.bytes_per_pixel = DI.bytes_per_pixel; di.inline_alpha = DI.inline_alpha; di.inline_alpha_ofs = DI.inline_alpha_ofs; + di.byte_order_from_client = NO; ASSIGN(wi, [XWindowBuffer windowBufferForWindow: window depthInfo: &di]); } diff --git a/Source/cairo/XGCairoXImageSurface.m b/Source/cairo/XGCairoXImageSurface.m index 39894a7..3db696b 100644 --- a/Source/cairo/XGCairoXImageSurface.m +++ b/Source/cairo/XGCairoXImageSurface.m @@ -53,6 +53,8 @@ di.bytes_per_pixel = 4; di.inline_alpha = YES; di.inline_alpha_ofs = 0; + /* The cairo image surface uses the client's byte order (cf. bug #28590). */ + di.byte_order_from_client = YES; ASSIGN(wi, [XWindowBuffer windowBufferForWindow: GSWINDEVICE depthInfo: &di]); diff --git a/Source/x11/XWindowBuffer.m b/Source/x11/XWindowBuffer.m index ab9f564..4a27fbb 100644 --- a/Source/x11/XWindowBuffer.m +++ b/Source/x11/XWindowBuffer.m @@ -389,6 +389,22 @@ no_xshm: wi->window->xframe.size.height, 8, 0); + /* Normally, the data of an XImage is saved with the X server's + byte order. However, some backends (notably cairo) use the + native byte order of the client for the backend image. Since + XCreateImage sets up the image with the X server's byte order, + we must correct the byte order for those backends. Otherwise, + GNUstep applications would display wrong colors on an X server + that is running on a machine with a different byte order than + the client (bug #28590). */ + if (wi->DI.byte_order_from_client) + { +#if GS_WORDS_BIGENDIAN + wi->ximage->byte_order = MSBFirst; +#else + wi->ximage->byte_order = LSBFirst; +#endif + } wi->ximage->data = malloc(wi->ximage->height * wi->ximage->bytes_per_line); if (!wi->ximage->data) {