aboutsummaryrefslogtreecommitdiff
path: root/graphics
diff options
context:
space:
mode:
authorMax Horn2006-04-17 11:09:21 +0000
committerMax Horn2006-04-17 11:09:21 +0000
commit2732ed3dcec40664a988c6ca43fff7996781624e (patch)
treed6c976d8da8960b1943229a6309f4be6477fdf80 /graphics
parentd7944e839b09b620b1d6c5af248208b4c01d7ae6 (diff)
downloadscummvm-rg350-2732ed3dcec40664a988c6ca43fff7996781624e.tar.gz
scummvm-rg350-2732ed3dcec40664a988c6ca43fff7996781624e.tar.bz2
scummvm-rg350-2732ed3dcec40664a988c6ca43fff7996781624e.zip
Fixed (A)RGBToColor templates
svn-id: r21969
Diffstat (limited to 'graphics')
-rw-r--r--graphics/colormasks.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/graphics/colormasks.h b/graphics/colormasks.h
index 06a791c50d..16ebafc020 100644
--- a/graphics/colormasks.h
+++ b/graphics/colormasks.h
@@ -220,17 +220,17 @@ struct ColorMasks<8888> {
template<class T>
uint32 RGBToColor(uint8 r, uint8 g, uint8 b) {
return T::kAlphaMask |
- ((r << T::kRedShift) & T::kRedMask) |
- ((g << T::kGreenShift) & T::kGreenMask) |
- ((b << T::kBlueShift) & T::kBlueMask);
+ (((r << T::kRedShift) >> (8 - T::kRedBits)) & T::kRedMask) |
+ (((g << T::kGreenShift) >> (8 - T::kGreenBits)) & T::kGreenMask) |
+ (((b << T::kBlueShift) >> (8 - T::kBlueBits)) & T::kBlueMask);
}
template<class T>
uint32 ARGBToColor(uint8 a, uint8 r, uint8 g, uint8 b) {
- return ((a << T::kAlphaShift) & T::kAlphaMask) |
- ((r << T::kRedShift) & T::kRedMask) |
- ((g << T::kGreenShift) & T::kGreenMask) |
- ((b << T::kBlueShift) & T::kBlueMask);
+ return (((a << T::kAlphaShift) >> (8 - T::kAlphaBits)) & T::kAlphaMask) |
+ (((r << T::kRedShift) >> (8 - T::kRedBits)) & T::kRedMask) |
+ (((g << T::kGreenShift) >> (8 - T::kGreenBits)) & T::kGreenMask) |
+ (((b << T::kBlueShift) >> (8 - T::kBlueBits)) & T::kBlueMask);
}
template<class T>