From bcf73580728e5b4ad55b37c0998a761c1f080f6d Mon Sep 17 00:00:00 2001 From: dan Date: Tue, 15 May 2001 11:26:12 +0000 Subject: [PATCH] Fixed problem with alpha images showing a blue tint on big endian machines --- ChangeLog | 1 + wrlib/convert.c | 24 ++++++++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index c8557da1..a3837098 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ - removed FocusFollowMouse from wmaker and WPrefs +- fixed problem with alpha images showing a blue tint on big endian machines Changes since version 0.64.0: ............................. diff --git a/wrlib/convert.c b/wrlib/convert.c index 3df11f03..1e74563f 100644 --- a/wrlib/convert.c +++ b/wrlib/convert.c @@ -803,20 +803,32 @@ hermesConvert(RContext *context, RImage *image) /* The masks look weird for images with alpha. but they work this way. * wth does hermes do internally? */ - source.r = 0xff0000; - source.g = 0x00ff00; - source.b = 0x0000ff; - source.a = 0x000000; source.bits = (HAS_ALPHA(image) ? 32 : 24); + if (ximage->image->byte_order==LSBFirst) { + source.r = 0xff0000; + source.g = 0x00ff00; + source.b = 0x0000ff; + } else { + if (source.bits == 32) { + source.r = 0xff000000; + source.g = 0x00ff0000; + source.b = 0x0000ff00; + } else { + source.r = 0xff0000; + source.g = 0x00ff00; + source.b = 0x0000ff; + } + } + source.a = 0; /* Don't care about alpha */ source.indexed = 0; source.has_colorkey = 0; /* This is a hack and certainly looks weird, but it works :P * it assumes though that green is inbetween red and blue (the mask) */ if (ximage->image->byte_order==LSBFirst) { - dest.b = context->visual->red_mask; - dest.g = context->visual->green_mask; dest.r = context->visual->blue_mask; + dest.g = context->visual->green_mask; + dest.b = context->visual->red_mask; } else { dest.r = context->visual->red_mask; dest.g = context->visual->green_mask; -- 2.11.4.GIT