diff options
author | Andrei Karas <akaras@inbox.ru> | 2017-05-24 22:58:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2017-05-24 23:37:03 +0300 |
commit | 3480f3ad939e2ae5d0191ed739a57e834658c32e (patch) | |
tree | 268acbda26a8a4e4849362f681e95ed8b4a6de16 /src/resources/dye/dyepalette.h | |
parent | c3699037bc32dd43ae1b5501261808eb3425697c (diff) | |
download | plus-3480f3ad939e2ae5d0191ed739a57e834658c32e.tar.gz plus-3480f3ad939e2ae5d0191ed739a57e834658c32e.tar.bz2 plus-3480f3ad939e2ae5d0191ed739a57e834658c32e.tar.xz plus-3480f3ad939e2ae5d0191ed739a57e834658c32e.zip |
Switch in replaceSColor into using custom despatcher.
Diffstat (limited to 'src/resources/dye/dyepalette.h')
-rw-r--r-- | src/resources/dye/dyepalette.h | 55 |
1 files changed, 14 insertions, 41 deletions
diff --git a/src/resources/dye/dyepalette.h b/src/resources/dye/dyepalette.h index d869e39c6..da165305e 100644 --- a/src/resources/dye/dyepalette.h +++ b/src/resources/dye/dyepalette.h @@ -25,11 +25,19 @@ #include "resources/dye/dyecolor.h" +#include "resources/dye/dyepaletteptr.h" + #include <string> #include <vector> #include "localconsts.h" +#define DYEPALETTE(palette, color) \ + ((palette).*DyePalette::funcReplace##color) + +#define DYEPALETTEP(palette, color) \ + ((palette)->*DyePalette::funcReplace##color) + /** * Class for performing a linear interpolation between colors. */ @@ -62,55 +70,14 @@ class DyePalette final /** * replace colors for SDL for S dye. */ - void replaceSColor(uint32_t *restrict pixels, - const int bufSize) const restrict2; - - /** - * replace colors for SDL for S dye. - */ void replaceSColorDefault(uint32_t *restrict pixels, const int bufSize) const restrict2; - /** - * replace colors for SDL for S dye. - */ - FUNCTION_SIMD_DEFAULT - void replaceSColorSimd(uint32_t *restrict pixels, - const int bufSize) const restrict2; - - /** - * replace colors for SDL for S dye. - */ - FUNCTION_SIMD_DEFAULT - void replaceSColorSse2(uint32_t *restrict pixels, - const int bufSize) const restrict2; - - /** - * replace colors for SDL for S dye. - */ - FUNCTION_SIMD_DEFAULT - void replaceSColorAvx2(uint32_t *restrict pixels, - const int bufSize) const restrict2; - #ifdef SIMD_SUPPORTED /** * replace colors for SDL for S dye. */ __attribute__ ((target ("sse2"))) - void replaceSColorSimd(uint32_t *restrict pixels, - const int bufSize) const restrict2; - - /** - * replace colors for SDL for S dye. - */ - __attribute__ ((target ("avx2"))) - void replaceSColorSimd(uint32_t *restrict pixels, - const int bufSize) const restrict2; - - /** - * replace colors for SDL for S dye. - */ - __attribute__ ((target ("sse2"))) void replaceSColorSse2(uint32_t *restrict pixels, const int bufSize) const restrict2; @@ -313,6 +280,12 @@ class DyePalette final const uint8_t blockSize, DyeColor &color) noexcept2; + static void initFunctions(); + + static DyeFunctionPtr funcReplaceSColor; + static DyeFunctionPtr funcReplaceSColorSse2; + static DyeFunctionPtr funcReplaceSColorAvx2; + #ifndef UNITTESTS private: #endif // UNITTESTS |