From 0cae5fc6e40e246d4e83999a100d3ef1a76b2f5d Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Wed, 14 Aug 2019 22:50:38 +0300 Subject: [PATCH] - removed type punning from xBRZ scaler integration it was a hack that wouldn't work with xBRZ 1.7 --- src/gamedata/textures/hires/hqresize.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/gamedata/textures/hires/hqresize.cpp b/src/gamedata/textures/hires/hqresize.cpp index 82a4d8817bb..fe2a16c779b 100644 --- a/src/gamedata/textures/hires/hqresize.cpp +++ b/src/gamedata/textures/hires/hqresize.cpp @@ -302,8 +302,8 @@ static unsigned char *hqNxHelper( void (HQX_CALLCONV *hqNxFunction) ( unsigned*, } - -static unsigned char *xbrzHelper( void (*xbrzFunction) ( size_t, const uint32_t*, uint32_t*, int, int, xbrz::ColorFormat, const xbrz::ScalerCfg&, int, int ), +template +static unsigned char *xbrzHelper( void (*xbrzFunction) ( size_t, const uint32_t*, uint32_t*, int, int, xbrz::ColorFormat, const ConfigType&, int, int ), const int N, unsigned char *inputBuffer, const int inWidth, @@ -326,23 +326,22 @@ static unsigned char *xbrzHelper( void (*xbrzFunction) ( size_t, const uint32_t* parallel_for(inHeight, thresholdHeight, [=](int sliceY) { xbrzFunction(N, reinterpret_cast(inputBuffer), reinterpret_cast(newBuffer), - inWidth, inHeight, xbrz::ColorFormat::ARGB, xbrz::ScalerCfg(), sliceY, sliceY + thresholdHeight); + inWidth, inHeight, xbrz::ColorFormat::ARGB, ConfigType(), sliceY, sliceY + thresholdHeight); }); } else { xbrzFunction(N, reinterpret_cast(inputBuffer), reinterpret_cast(newBuffer), - inWidth, inHeight, xbrz::ColorFormat::ARGB, xbrz::ScalerCfg(), 0, std::numeric_limits::max()); + inWidth, inHeight, xbrz::ColorFormat::ARGB, ConfigType(), 0, std::numeric_limits::max()); } delete[] inputBuffer; return newBuffer; } -static void xbrzOldScale(size_t factor, const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight, xbrz::ColorFormat colFmt, const xbrz::ScalerCfg& cfg, int yFirst, int yLast) +static void xbrzOldScale(size_t factor, const uint32_t* src, uint32_t* trg, int srcWidth, int srcHeight, xbrz::ColorFormat colFmt, const xbrz_old::ScalerCfg& cfg, int yFirst, int yLast) { - static_assert(sizeof(xbrz::ScalerCfg) == sizeof(xbrz_old::ScalerCfg), "ScalerCfg classes have different layout"); - xbrz_old::scale(factor, src, trg, srcWidth, srcHeight, reinterpret_cast(cfg), yFirst, yLast); + xbrz_old::scale(factor, src, trg, srcWidth, srcHeight, cfg, yFirst, yLast); }