summaryrefslogtreecommitdiff
path: root/src/blitter
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-07-17 23:43:47 +0000
committersmatz <smatz@openttd.org>2008-07-17 23:43:47 +0000
commit69cb2f088feb3549c63ddb747ee11c781b49e86c (patch)
treec7c0dcbf07d421f36efed88f543c50476bb5a74a /src/blitter
parent6e1aaa2c69dbd89442287733d43efdc07a8241cf (diff)
downloadopenttd-69cb2f088feb3549c63ddb747ee11c781b49e86c.tar.xz
(svn r13721) -Codechange: one less multiplication for colour mixing in 32bpp blitters (GeekToo)
Diffstat (limited to 'src/blitter')
-rw-r--r--src/blitter/32bpp_base.hpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp
index 1e9ae1d16..e69a7cbfd 100644
--- a/src/blitter/32bpp_base.hpp
+++ b/src/blitter/32bpp_base.hpp
@@ -54,9 +54,9 @@ public:
/* The 256 is wrong, it should be 255, but 256 is much faster... */
return ComposeColour(0xFF,
- (r * a + cr * (256 - a)) / 256,
- (g * a + cg * (256 - a)) / 256,
- (b * a + cb * (256 - a)) / 256);
+ ((int)(r - cr) * a) / 256 + cr,
+ ((int)(g - cg) * a) / 256 + cg,
+ ((int)(b - cb) * a) / 256 + cb);
}
/**
@@ -79,15 +79,8 @@ public:
uint r = GB(colour, 16, 8);
uint g = GB(colour, 8, 8);
uint b = GB(colour, 0, 8);
- uint cr = GB(current, 16, 8);
- uint cg = GB(current, 8, 8);
- uint cb = GB(current, 0, 8);
- /* The 256 is wrong, it should be 255, but 256 is much faster... */
- return ComposeColour(0xFF,
- (r * a + cr * (256 - a)) / 256,
- (g * a + cg * (256 - a)) / 256,
- (b * a + cb * (256 - a)) / 256);
+ return ComposeColourRGBANoCheck(r, g, b, a, current);
}
/**