diff options
author | Michael Lutz <michi@icosahedron.de> | 2021-01-16 16:43:44 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2021-02-22 22:16:07 +0100 |
commit | 94d8acb7d007150606c0756060c6f0cf90ee7f70 (patch) | |
tree | 57d5c1399f5eaa8005daf0d85ae86cb10a48cda8 /src/blitter/32bpp_base.hpp | |
parent | ae7c63cc35362932500f42f4a11ae2160566b718 (diff) | |
download | openttd-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.hpp | 22 |
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 */ |