mirror of
https://github.com/vcmi/vcmi.git
synced 2025-04-23 12:08:45 +02:00
Fix corrupted display of H3 fonts when xbrz is in use
This commit is contained in:
parent
3965c6a0a1
commit
a4052d0cf4
@ -252,7 +252,7 @@ SDLImageShared::SDLImageShared(const SDLImageShared * from, int integerScaleFact
|
|||||||
|
|
||||||
upscalingInProgress = true;
|
upscalingInProgress = true;
|
||||||
|
|
||||||
auto scaler = std::make_shared<SDLImageScaler>(from->surf, Rect(from->margins, from->fullSize));
|
auto scaler = std::make_shared<SDLImageScaler>(from->surf, Rect(from->margins, from->fullSize), true);
|
||||||
|
|
||||||
const auto & scalingTask = [this, algorithm, scaler]()
|
const auto & scalingTask = [this, algorithm, scaler]()
|
||||||
{
|
{
|
||||||
@ -278,7 +278,7 @@ std::shared_ptr<const ISharedImage> SDLImageShared::scaleTo(const Point & size,
|
|||||||
if (palette && surf->format->palette)
|
if (palette && surf->format->palette)
|
||||||
SDL_SetSurfacePalette(surf, palette);
|
SDL_SetSurfacePalette(surf, palette);
|
||||||
|
|
||||||
SDLImageScaler scaler(surf, Rect(margins, fullSize));
|
SDLImageScaler scaler(surf, Rect(margins, fullSize), true);
|
||||||
|
|
||||||
scaler.scaleSurface(size, EScalingAlgorithm::XBRZ_ALPHA);
|
scaler.scaleSurface(size, EScalingAlgorithm::XBRZ_ALPHA);
|
||||||
|
|
||||||
|
@ -196,16 +196,25 @@ void SDLImageScaler::scaleSurfaceIntegerFactor(int factor, EScalingAlgorithm alg
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDLImageScaler::SDLImageScaler(SDL_Surface * surf)
|
SDLImageScaler::SDLImageScaler(SDL_Surface * surf)
|
||||||
:SDLImageScaler(surf, Rect(0,0,surf->w, surf->h))
|
:SDLImageScaler(surf, Rect(0,0,surf->w, surf->h), false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
SDLImageScaler::SDLImageScaler(SDL_Surface * surf, const Rect & virtualDimensions)
|
SDLImageScaler::SDLImageScaler(SDL_Surface * surf, const Rect & virtualDimensions, bool optimizeImage)
|
||||||
{
|
{
|
||||||
|
if (optimizeImage)
|
||||||
|
{
|
||||||
SDLImageOptimizer optimizer(surf, virtualDimensions);
|
SDLImageOptimizer optimizer(surf, virtualDimensions);
|
||||||
optimizer.optimizeSurface(screen);
|
optimizer.optimizeSurface(screen);
|
||||||
intermediate = optimizer.acquireResultSurface();
|
intermediate = optimizer.acquireResultSurface();
|
||||||
virtualDimensionsInput = optimizer.getResultDimensions();
|
virtualDimensionsInput = optimizer.getResultDimensions();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
intermediate = surf;
|
||||||
|
intermediate->refcount += 1;
|
||||||
|
virtualDimensionsInput = virtualDimensions;
|
||||||
|
}
|
||||||
|
|
||||||
if (intermediate == surf)
|
if (intermediate == surf)
|
||||||
{
|
{
|
||||||
|
@ -43,7 +43,7 @@ class SDLImageScaler : boost::noncopyable
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
SDLImageScaler(SDL_Surface * surf);
|
SDLImageScaler(SDL_Surface * surf);
|
||||||
SDLImageScaler(SDL_Surface * surf, const Rect & virtualDimensions);
|
SDLImageScaler(SDL_Surface * surf, const Rect & virtualDimensions, bool optimizeImage);
|
||||||
~SDLImageScaler();
|
~SDLImageScaler();
|
||||||
|
|
||||||
/// Performs upscaling or downscaling to a requested dimensions
|
/// Performs upscaling or downscaling to a requested dimensions
|
||||||
|
Loading…
x
Reference in New Issue
Block a user