|
|
@@ -19,6 +19,8 @@
|
|
|
|
|
|
#include "../../lib/GameConstants.h"
|
|
|
|
|
|
+#include <tbb/parallel_for.h>
|
|
|
+
|
|
|
#include <SDL_render.h>
|
|
|
#include <SDL_surface.h>
|
|
|
#include <SDL_version.h>
|
|
|
@@ -667,7 +669,14 @@ SDL_Surface * CSDL_Ext::scaleSurfaceIntegerFactor(SDL_Surface * surf, int factor
|
|
|
const uint32_t * srcPixels = static_cast<const uint32_t*>(intermediate->pixels);
|
|
|
uint32_t * dstPixels = static_cast<uint32_t*>(ret->pixels);
|
|
|
|
|
|
- xbrz::scale(factor, srcPixels, dstPixels, intermediate->w, intermediate->h, xbrz::ColorFormat::ARGB);
|
|
|
+ // avoid excessive granulation - xBRZ prefers at least 8-16 lines per task
|
|
|
+ // TODO: compare performance and size of images, recheck values for potentially better parameters
|
|
|
+ const int granulation = std::clamp(surf->h / 64 * 8, 8, 64);
|
|
|
+
|
|
|
+ tbb::parallel_for(tbb::blocked_range<size_t>(0, intermediate->h, granulation), [&](const tbb::blocked_range<size_t> & r)
|
|
|
+ {
|
|
|
+ xbrz::scale(factor, srcPixels, dstPixels, intermediate->w, intermediate->h, xbrz::ColorFormat::ARGB, {}, r.begin(), r.end());
|
|
|
+ });
|
|
|
|
|
|
SDL_FreeSurface(intermediate);
|
|
|
|