mirror of
https://github.com/gnustep/libs-back.git
synced 2025-04-22 23:42:16 +00:00
Avoid unnecessary runtime check in the fix for #28590.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@29358 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4ea7b58019
commit
4311e19de6
4 changed files with 15 additions and 20 deletions
|
@ -51,10 +51,9 @@ struct XWindowBuffer_depth_info_s
|
|||
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;
|
||||
/* The byte order used for the buffer. This must be either MSBFirst or
|
||||
LSBFirst. */
|
||||
int byte_order;
|
||||
};
|
||||
|
||||
/*
|
||||
|
|
|
@ -638,7 +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;
|
||||
di.byte_order = ImageByteOrder(window->display);
|
||||
|
||||
ASSIGN(wi, [XWindowBuffer windowBufferForWindow: window depthInfo: &di]);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,11 @@
|
|||
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;
|
||||
#if GS_WORDS_BIGENDIAN
|
||||
di.byte_order = MSBFirst;
|
||||
#else
|
||||
di.byte_order = LSBFirst;
|
||||
#endif
|
||||
|
||||
ASSIGN(wi, [XWindowBuffer windowBufferForWindow: GSWINDEVICE depthInfo: &di]);
|
||||
|
||||
|
|
|
@ -391,20 +391,12 @@ no_xshm:
|
|||
|
||||
/* 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
|
||||
}
|
||||
native byte order of the client for the backend image, hence
|
||||
we must set the image's byte order here. Without this, 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). */
|
||||
wi->ximage->byte_order = wi->DI.byte_order;
|
||||
wi->ximage->data = malloc(wi->ximage->height * wi->ximage->bytes_per_line);
|
||||
if (!wi->ximage->data)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue