From f8648767e4882de9adb8f23c9bae8d5146dc3fd9 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 26 Feb 2009 20:08:04 +0000 Subject: fix graphics regression in Iceman caused by r38909 svn-id: r38914 --- engines/sci/gfx/gfx_tools.cpp | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/sci/gfx/gfx_tools.cpp b/engines/sci/gfx/gfx_tools.cpp index db6fa7f834..86229372ee 100644 --- a/engines/sci/gfx/gfx_tools.cpp +++ b/engines/sci/gfx/gfx_tools.cpp @@ -56,14 +56,21 @@ gfx_mode_t *gfx_new_mode(int xfact, int yfact, const Graphics::PixelFormat &form // And those are pretty weird, so I am not sure I interpreted them correctly. // They also seem somewhat inefficient and and should probably just be // replaced resp. rewritten from scratch. - mode->red_mask = format.ARGBToColor(0, 0xFF, 0, 0); - mode->green_mask = format.ARGBToColor(0, 0, 0xFF, 0); - mode->blue_mask = format.ARGBToColor(0, 0, 0, 0xFF); - mode->alpha_mask = format.ARGBToColor(0xFF, 0, 0, 0); - mode->red_shift = format.rLoss; - mode->green_shift = format.gLoss; - mode->blue_shift = format.bLoss; - mode->alpha_shift = format.aLoss; + if (format.bytesPerPixel > 1) { + mode->red_mask = format.ARGBToColor(0, 0xFF, 0, 0); + mode->green_mask = format.ARGBToColor(0, 0, 0xFF, 0); + mode->blue_mask = format.ARGBToColor(0, 0, 0, 0xFF); + mode->alpha_mask = format.ARGBToColor(0xFF, 0, 0, 0); + mode->red_shift = format.rLoss; + mode->green_shift = format.gLoss; + mode->blue_shift = format.bLoss; + mode->alpha_shift = format.aLoss; + } else { + mode->red_mask = mode->green_mask = mode->blue_mask = 0; + mode->alpha_mask = 0; + mode->red_shift = mode->green_shift = mode->blue_shift = 0; + mode->alpha_shift = 0; + } mode->flags = flags; if (palette) { -- cgit v1.2.3