From: Derek Foreman Date: Sat, 1 Feb 2003 01:41:35 +0000 (+0000) Subject: properly support "cross endian" configurations X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=bbe129c40ea60af9640c9c6279b23a1b76faab23;p=chaz%2Fopenbox properly support "cross endian" configurations --- diff --git a/otk/truerendercontrol.cc b/otk/truerendercontrol.cc index 45f0f83a..059beacf 100644 --- a/otk/truerendercontrol.cc +++ b/otk/truerendercontrol.cc @@ -279,7 +279,21 @@ void TrueRenderControl::reduceDepth(XImage *im, pixel32 *data) const pixel16 *p = (pixel16 *)data; switch (im->bits_per_pixel) { case 32: - return; + if ((_red_offset != default_red_shift) || + (_blue_offset != default_blue_shift) || + (_green_offset != default_green_shift)) { + printf("cross endian conversion\n"); + for (y = 0; y < im->height; y++) { + for (x = 0; x < im->width; x++) { + r = (data[x] >> default_red_shift) & 0xFF; + g = (data[x] >> default_green_shift) & 0xFF; + b = (data[x] >> default_blue_shift) & 0xFF; + data[x] = (r << _red_offset) + (g << _green_offset) + (b << _blue_offset); + } + data += im->width; + } + } + return; case 16: for (y = 0; y < im->height; y++) { for (x = 0; x < im->width; x++) {