Fixed an issue where raster graphic images could get scaled incorrectly.

This commit is contained in:
Leon Styhre 2022-08-16 21:04:39 +02:00
parent ea8aac03f0
commit 967b98008b
3 changed files with 11 additions and 3 deletions

View file

@ -65,8 +65,9 @@ public:
void setForceRasterization(bool setting) { mForceRasterization = setting; }
// Has the image been loaded but not yet been rasterized as the size was not known?
bool getPendingRasterization() { return mPendingRasterization; }
const bool getPendingRasterization() { return mPendingRasterization; }
const bool getScalable() { return mScalable; }
std::vector<unsigned char>& getRawRGBAData() { return mDataRGBA; }
std::string getTextureFilePath() { return mPath; }
bool tiled() { return mTile; }

View file

@ -200,6 +200,8 @@ void TextureResource::rasterizeAt(float width, float height)
data = mTextureData;
else
data = sTextureDataManager.get(this);
if (mTextureData && mTextureData.get()->getScalable())
mSourceSize = glm::vec2 {static_cast<float>(width), static_cast<float>(height)};
data->setSourceSize(static_cast<float>(width), static_cast<float>(height));
if (mForceLoad || mTextureData != nullptr)

View file

@ -41,11 +41,16 @@ public:
std::vector<unsigned char> getRawRGBAData();
// Has the image been loaded but not yet been rasterized as the size was not known?
bool getPendingRasterization() const
const bool getPendingRasterization() const
{
return (mTextureData != nullptr ? mTextureData->getPendingRasterization() : false);
}
const bool getScalable() const
{
return (mTextureData != nullptr ? mTextureData->getScalable() : false);
}
void setLinearMagnify(bool setting) { mTextureData->setLinearMagnify(setting); }
std::string getTextureFilePath();