diff options
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 |