Fixed an issue where SVG images would sometimes not get rasterized.

This commit is contained in:
Leon Styhre 2023-02-16 00:00:45 +01:00
parent 14ac905e09
commit c9848d694b
2 changed files with 8 additions and 4 deletions

View file

@ -64,12 +64,14 @@ void ImageComponent::setImage(const std::string& path, bool tile)
// Create an initial blank texture if needed.
if (path.empty() || !ResourceManager::getInstance().fileExists(path)) {
if (mDefaultPath.empty() || !ResourceManager::getInstance().fileExists(mDefaultPath))
if (mDefaultPath.empty() || !ResourceManager::getInstance().fileExists(mDefaultPath)) {
mTexture.reset();
else
}
else {
mTexture = TextureResource::get(mDefaultPath, tile, mForceLoad, mDynamic,
mLinearInterpolation, mMipmapping);
resize(true);
resize(true);
}
}
else {
// For raster images we just load and resize but for SVG images we first need to resize

View file

@ -282,7 +282,9 @@ float TextureData::sourceHeight()
void TextureData::setSourceSize(float width, float height)
{
if (mScalable) {
if (mSourceWidth != width || mSourceHeight != height) {
// Ugly hack to make sure SVG images matching the temporary size 64x64 get rasterized.
const bool tempSizeMatch {mPendingRasterization && width == 64 && height == 64};
if (tempSizeMatch || mSourceWidth != width || mSourceHeight != height) {
mSourceWidth = width;
mSourceHeight = height;
releaseVRAM();