mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
Offloaded xbrz upscaling to background threads
This commit is contained in:
@@ -27,14 +27,16 @@ struct SDL_Palette;
|
||||
class SDLImageShared final : public ISharedImage, public std::enable_shared_from_this<SDLImageShared>, boost::noncopyable
|
||||
{
|
||||
//Surface without empty borders
|
||||
SDL_Surface * surf;
|
||||
SDL_Surface * surf = nullptr;
|
||||
|
||||
SDL_Palette * originalPalette;
|
||||
SDL_Palette * originalPalette = nullptr;
|
||||
//size of left and top borders
|
||||
Point margins;
|
||||
//total size including borders
|
||||
Point fullSize;
|
||||
|
||||
std::atomic_bool upscalingInProgress = false;
|
||||
|
||||
// Keep the original palette, in order to do color switching operation
|
||||
void savePalette();
|
||||
|
||||
@@ -47,8 +49,11 @@ public:
|
||||
SDLImageShared(const ImagePath & filename);
|
||||
//Create using existing surface, extraRef will increase refcount on SDL_Surface
|
||||
SDLImageShared(SDL_Surface * from);
|
||||
/// Creates image at specified scaling factor from source image
|
||||
SDLImageShared(const SDLImageShared * from, int integerScaleFactor, EScalingAlgorithm algorithm);
|
||||
~SDLImageShared();
|
||||
|
||||
void scaledDraw(SDL_Surface * where, SDL_Palette * palette, const Point & scaling, const Point & dest, const Rect * src, const ColorRGBA & colorMultiplier, uint8_t alpha, EImageBlitMode mode) const override;
|
||||
void draw(SDL_Surface * where, SDL_Palette * palette, const Point & dest, const Rect * src, const ColorRGBA & colorMultiplier, uint8_t alpha, EImageBlitMode mode) const override;
|
||||
|
||||
void exportBitmap(const boost::filesystem::path & path, SDL_Palette * palette) const override;
|
||||
@@ -56,6 +61,8 @@ public:
|
||||
bool isTransparent(const Point & coords) const override;
|
||||
Rect contentRect() const override;
|
||||
|
||||
bool isLoading() const override;
|
||||
|
||||
const SDL_Palette * getPalette() const override;
|
||||
|
||||
[[nodiscard]] std::shared_ptr<const ISharedImage> horizontalFlip() const override;
|
||||
|
||||
Reference in New Issue
Block a user