summaryrefslogtreecommitdiff
path: root/src/blitter/32bpp_base.hpp
diff options
context:
space:
mode:
authorMichael Lutz <michi@icosahedron.de>2021-01-16 16:43:44 +0100
committerMichael Lutz <michi@icosahedron.de>2021-02-22 22:16:07 +0100
commit94d8acb7d007150606c0756060c6f0cf90ee7f70 (patch)
tree57d5c1399f5eaa8005daf0d85ae86cb10a48cda8 /src/blitter/32bpp_base.hpp
parentae7c63cc35362932500f42f4a11ae2160566b718 (diff)
downloadopenttd-94d8acb7d007150606c0756060c6f0cf90ee7f70.tar.xz
Add: A 32 bpp blitter that uses the animation buffer from the video backend to speed up palette animation.
Diffstat (limited to 'src/blitter/32bpp_base.hpp')
-rw-r--r--src/blitter/32bpp_base.hpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp
index f09719450..9d80ec2ce 100644
--- a/src/blitter/32bpp_base.hpp
+++ b/src/blitter/32bpp_base.hpp
@@ -125,6 +125,18 @@ public:
}
/**
+ * Make a colour dark grey, for specialized 32bpp remapping.
+ * @param colour the colour to make dark.
+ * @return the new colour, now darker.
+ */
+ static inline Colour MakeDark(Colour colour)
+ {
+ uint8 d = MakeDark(colour.r, colour.g, colour.b);
+
+ return Colour(d, d, d);
+ }
+
+ /**
* Make a colour grey - based.
* @param colour the colour to make grey.
* @return the new colour, now grey.
@@ -154,6 +166,16 @@ public:
return ReallyAdjustBrightness(colour, brightness);
}
+
+ static inline uint8 GetColourBrightness(Colour colour)
+ {
+ uint8 rgb_max = std::max(colour.r, std::max(colour.g, colour.b));
+
+ /* Black pixel (8bpp or old 32bpp image), so use default value */
+ if (rgb_max == 0) rgb_max = DEFAULT_BRIGHTNESS;
+
+ return rgb_max;
+ }
};
#endif /* BLITTER_32BPP_BASE_HPP */