summaryrefslogtreecommitdiff
path: root/src/blitter/32bpp_base.hpp
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2014-04-13 19:22:23 +0000
committerpeter1138 <peter1138@openttd.org>2014-04-13 19:22:23 +0000
commit209d3e2e9e95a0d096fd2c18b0d95597edab78f2 (patch)
tree4f4738577099ef79d94e703764277961efd7db6c /src/blitter/32bpp_base.hpp
parent5fe053988f5b6060a68244096e385dcbe01fc9db (diff)
downloadopenttd-209d3e2e9e95a0d096fd2c18b0d95597edab78f2.tar.xz
(svn r26463) -Fix (r10190ish): Add special handling for PALETTE_CRASH to work for non-8bpp-mapped sprites.
Diffstat (limited to 'src/blitter/32bpp_base.hpp')
-rw-r--r--src/blitter/32bpp_base.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp
index ca58f0353..26c3dee3f 100644
--- a/src/blitter/32bpp_base.hpp
+++ b/src/blitter/32bpp_base.hpp
@@ -113,6 +113,19 @@ public:
}
/**
+ * Make a colour dark grey, for specialized 32bpp remapping.
+ * @param r red component
+ * @param g green component
+ * @param b blue component
+ * @return the brightness value of the new colour, now dark grey.
+ */
+ static inline uint8 MakeDark(uint8 r, uint8 g, uint8 b)
+ {
+ /* Magic-numbers are ~66% of those used in MakeGrey() */
+ return ((r * 13063) + (g * 25647) + (b * 4981)) / 65536;
+ }
+
+ /**
* Make a colour grey - based.
* @param colour the colour to make grey.
* @return the new colour, now grey.