diff options
author | rubidium <rubidium@openttd.org> | 2014-01-02 23:52:13 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2014-01-02 23:52:13 +0000 |
commit | 4c84d13454414b84b72540265b793aeec938cdd3 (patch) | |
tree | a69300b5060379854a96a10bbe1fa786011403dc /src/blitter/32bpp_sse2.cpp | |
parent | 78df732a7b7e987b66c85eeb243ce5e0dd59d3a6 (diff) | |
download | openttd-4c84d13454414b84b72540265b793aeec938cdd3.tar.xz |
(svn r26214) -Add: specialised animated SSE4 blitter (MJP)
With 32bpp base set about 15-20% faster in the Draw function (slower with 8bpp base set). Overall, with 32bpp base set, about 5% faster.
Diffstat (limited to 'src/blitter/32bpp_sse2.cpp')
-rw-r--r-- | src/blitter/32bpp_sse2.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/blitter/32bpp_sse2.cpp b/src/blitter/32bpp_sse2.cpp index 09c0ffa8a..52f37d690 100644 --- a/src/blitter/32bpp_sse2.cpp +++ b/src/blitter/32bpp_sse2.cpp @@ -200,7 +200,7 @@ void Blitter_32bppSSE2::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL } } -Sprite *Blitter_32bppSSE2::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) +Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) { /* First uint32 of a line = ~1 & the number of transparent pixels from the left. * Second uint32 of a line = the number of transparent pixels from the right. @@ -252,10 +252,10 @@ Sprite *Blitter_32bppSSE2::Encode(const SpriteLoader::Sprite *sprite, AllocatorP if (src->m != 0) { /* Get brightest value (or default brightness if it's a black pixel). */ const uint8 rgb_max = max(src->r, max(src->g, src->b)); - dst_mv->v = (rgb_max == 0) ? DEFAULT_BRIGHTNESS : rgb_max; + dst_mv->v = (rgb_max == 0) ? Blitter_32bppBase::DEFAULT_BRIGHTNESS : rgb_max; /* Pre-convert the mapping channel to a RGB value. */ - const Colour colour = AdjustBrightness(LookupColourInPalette(src->m), dst_mv->v); + const Colour colour = AdjustBrightness(Blitter_32bppBase::LookupColourInPalette(src->m), dst_mv->v); dst_rgba->r = colour.r; dst_rgba->g = colour.g; dst_rgba->b = colour.b; @@ -263,7 +263,7 @@ Sprite *Blitter_32bppSSE2::Encode(const SpriteLoader::Sprite *sprite, AllocatorP dst_rgba->r = src->r; dst_rgba->g = src->g; dst_rgba->b = src->b; - dst_mv->v = DEFAULT_BRIGHTNESS; + dst_mv->v = Blitter_32bppBase::DEFAULT_BRIGHTNESS; } } else { dst_rgba->data = 0; @@ -310,10 +310,10 @@ inline Colour Blitter_32bppSSE2::AdjustBrightness(Colour colour, uint8 brightnes /* Shortcut for normal brightness. */ if (brightness == DEFAULT_BRIGHTNESS) return colour; - return this->ReallyAdjustBrightness(colour, brightness); + return Blitter_32bppSSE2::ReallyAdjustBrightness(colour, brightness); } -Colour Blitter_32bppSSE2::ReallyAdjustBrightness(Colour colour, uint8 brightness) +/* static */ Colour Blitter_32bppSSE2::ReallyAdjustBrightness(Colour colour, uint8 brightness) { ALIGN(16) uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32; c16 *= brightness; |