mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Removed the deprecated SVG force rasterization flag from the cache manager.
This commit is contained in:
parent
48a9571609
commit
2c86e4f99e
|
@ -166,14 +166,14 @@ void ImageComponent::setImage(const std::string& path, bool tile)
|
|||
// we perform the actual rasterization to have the cache entry updated with the proper
|
||||
// texture. For SVG images this requires that every call to setImage is made only after
|
||||
// a call to setResize or setMaxSize (so the requested size is known upfront).
|
||||
mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, mLinearInterpolation,
|
||||
false, 0, 0, mTileWidth, mTileHeight);
|
||||
mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, mLinearInterpolation, 0,
|
||||
0, mTileWidth, mTileHeight);
|
||||
|
||||
if (isScalable) {
|
||||
resize(false);
|
||||
mTexture.reset();
|
||||
mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, mLinearInterpolation,
|
||||
false, static_cast<size_t>(mSize.x),
|
||||
static_cast<size_t>(mSize.x),
|
||||
static_cast<size_t>(mSize.y), mTileWidth, mTileHeight);
|
||||
mTexture->rasterizeAt(mSize.x, mSize.y);
|
||||
onSizeChanged();
|
||||
|
|
|
@ -66,7 +66,7 @@ void NinePatchComponent::buildVertices()
|
|||
}
|
||||
|
||||
glm::vec2 texSize {relCornerSize * 3.0f};
|
||||
mTexture = TextureResource::get(mPath, false, false, false, false, false,
|
||||
mTexture = TextureResource::get(mPath, false, false, false, false,
|
||||
static_cast<size_t>(texSize.x), static_cast<size_t>(texSize.y));
|
||||
|
||||
mTexture->rasterizeAt(texSize.x, texSize.y);
|
||||
|
|
|
@ -38,7 +38,6 @@ TextureData::TextureData(bool tile)
|
|||
, mHasRGBAData {false}
|
||||
, mPendingRasterization {false}
|
||||
, mLinearMagnify {false}
|
||||
, mForceRasterization {false}
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -84,11 +83,9 @@ bool TextureData::initSVGFromMemory(const std::string& fileData)
|
|||
}
|
||||
}
|
||||
|
||||
// If there is no image size defined yet, then don't rasterize unless mForceRasterization has
|
||||
// been set.
|
||||
// If there is no image size defined yet, then don't rasterize.
|
||||
if (mSourceWidth == 0.0f && mSourceHeight == 0.0f) {
|
||||
if (!mForceRasterization)
|
||||
rasterize = false;
|
||||
rasterize = false;
|
||||
// Set a small temporary size that maintains the image aspect ratio.
|
||||
mSourceWidth = 64.0f;
|
||||
mSourceHeight = 64.0f * (svgImage->height / svgImage->width);
|
||||
|
|
|
@ -66,8 +66,6 @@ public:
|
|||
|
||||
// Whether to use linear filtering when magnifying the texture.
|
||||
void setLinearMagnify(bool setting) { mLinearMagnify = setting; }
|
||||
// Whether to rasterize the image even if a size has not been set yet.
|
||||
void setForceRasterization(bool setting) { mForceRasterization = setting; }
|
||||
|
||||
// Has the image been loaded but not yet been rasterized as the size was not known?
|
||||
const bool getPendingRasterization() { return mPendingRasterization; }
|
||||
|
@ -96,7 +94,6 @@ private:
|
|||
std::atomic<bool> mPendingRasterization;
|
||||
bool mLinearMagnify;
|
||||
bool mReloadable;
|
||||
bool mForceRasterization;
|
||||
};
|
||||
|
||||
#endif // ES_CORE_RESOURCES_TEXTURE_DATA_H
|
||||
|
|
|
@ -20,8 +20,7 @@ TextureResource::TextureResource(const std::string& path,
|
|||
bool tile,
|
||||
bool dynamic,
|
||||
bool linearMagnify,
|
||||
bool scalable,
|
||||
bool forceRasterization)
|
||||
bool scalable)
|
||||
: mTextureData {nullptr}
|
||||
, mForceLoad {false}
|
||||
{
|
||||
|
@ -35,7 +34,6 @@ TextureResource::TextureResource(const std::string& path,
|
|||
data->initFromPath(path);
|
||||
data->setTileSize(tileWidth, tileHeight);
|
||||
data->setLinearMagnify(linearMagnify);
|
||||
data->setForceRasterization(forceRasterization);
|
||||
// Force the texture manager to load it using a blocking load.
|
||||
sTextureDataManager.load(data, true);
|
||||
}
|
||||
|
@ -45,7 +43,6 @@ TextureResource::TextureResource(const std::string& path,
|
|||
data->initFromPath(path);
|
||||
data->setTileSize(tileWidth, tileHeight);
|
||||
data->setLinearMagnify(linearMagnify);
|
||||
data->setForceRasterization(forceRasterization);
|
||||
// Load it so we can read the width/height.
|
||||
data->load();
|
||||
}
|
||||
|
@ -156,7 +153,6 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path,
|
|||
bool forceLoad,
|
||||
bool dynamic,
|
||||
bool linearMagnify,
|
||||
bool forceRasterization,
|
||||
size_t width,
|
||||
size_t height,
|
||||
float tileWidth,
|
||||
|
@ -164,8 +160,8 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path,
|
|||
{
|
||||
const std::string canonicalPath {Utils::FileSystem::getCanonicalPath(path)};
|
||||
if (canonicalPath.empty()) {
|
||||
std::shared_ptr<TextureResource> tex(new TextureResource(
|
||||
"", tileWidth, tileHeight, tile, false, linearMagnify, false, forceRasterization));
|
||||
std::shared_ptr<TextureResource> tex(
|
||||
new TextureResource("", tileWidth, tileHeight, tile, false, linearMagnify, false));
|
||||
// Make sure we get properly deinitialized even though we do nothing on reinitialization.
|
||||
ResourceManager::getInstance().addReloadable(tex);
|
||||
return tex;
|
||||
|
@ -210,9 +206,8 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path,
|
|||
}
|
||||
|
||||
// Need to create it.
|
||||
std::shared_ptr<TextureResource> tex {std::shared_ptr<TextureResource>(
|
||||
new TextureResource(std::get<0>(key), tileWidth, tileHeight, tile, dynamic, linearMagnify,
|
||||
isScalable, forceRasterization))};
|
||||
std::shared_ptr<TextureResource> tex {std::shared_ptr<TextureResource>(new TextureResource(
|
||||
std::get<0>(key), tileWidth, tileHeight, tile, dynamic, linearMagnify, isScalable))};
|
||||
std::shared_ptr<TextureData> data {sTextureDataManager.get(tex.get())};
|
||||
|
||||
if (!isScalable || (isScalable && width != 0.0f && height != 0.0f)) {
|
||||
|
|
|
@ -31,7 +31,6 @@ public:
|
|||
bool forceLoad = false,
|
||||
bool dynamic = true,
|
||||
bool linearMagnify = false,
|
||||
bool forceRasterization = false,
|
||||
size_t width = 0,
|
||||
size_t height = 0,
|
||||
float tileWidth = 0.0f,
|
||||
|
@ -86,8 +85,7 @@ protected:
|
|||
bool tile,
|
||||
bool dynamic,
|
||||
bool linearMagnify,
|
||||
bool scalable,
|
||||
bool forceRasterization);
|
||||
bool scalable);
|
||||
virtual void unload(ResourceManager& rm);
|
||||
virtual void reload(ResourceManager& rm);
|
||||
|
||||
|
|
Loading…
Reference in a new issue