mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 23:55:38 +00:00
Reverted the SVG caching logic.
This commit is contained in:
parent
50f2af0077
commit
7321bf8f36
|
@ -72,11 +72,9 @@ protected:
|
|||
|
||||
private:
|
||||
void updateInfoPanel();
|
||||
|
||||
const std::string getImagePath(FileData* file);
|
||||
|
||||
void initMDLabels();
|
||||
|
||||
void initMDValues();
|
||||
|
||||
ImageComponent mMarquee;
|
||||
|
|
|
@ -30,19 +30,19 @@ BadgesComponent::BadgesComponent(Window* window)
|
|||
|
||||
mImageComponents = std::map<std::string, ImageComponent>();
|
||||
ImageComponent mImageFavorite = ImageComponent(window);
|
||||
mImageFavorite.setImage(mBadgeIcons[SLOT_FAVORITE], false, true, true);
|
||||
mImageFavorite.setImage(mBadgeIcons[SLOT_FAVORITE], false, true);
|
||||
mImageComponents.insert({SLOT_FAVORITE, mImageFavorite});
|
||||
ImageComponent mImageCompleted = ImageComponent(window);
|
||||
mImageCompleted.setImage(mBadgeIcons[SLOT_COMPLETED], false, true, true);
|
||||
mImageCompleted.setImage(mBadgeIcons[SLOT_COMPLETED], false, true);
|
||||
mImageComponents.insert({SLOT_COMPLETED, mImageCompleted});
|
||||
ImageComponent mImageKids = ImageComponent(window);
|
||||
mImageKids.setImage(mBadgeIcons[SLOT_KIDS], false, true, true);
|
||||
mImageKids.setImage(mBadgeIcons[SLOT_KIDS], false, true);
|
||||
mImageComponents.insert({SLOT_KIDS, mImageKids});
|
||||
ImageComponent mImageBroken = ImageComponent(window);
|
||||
mImageBroken.setImage(mBadgeIcons[SLOT_BROKEN], false, true, true);
|
||||
mImageBroken.setImage(mBadgeIcons[SLOT_BROKEN], false, true);
|
||||
mImageComponents.insert({SLOT_BROKEN, mImageBroken});
|
||||
ImageComponent mImageAltEmu = ImageComponent(window);
|
||||
mImageAltEmu.setImage(mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR], false, true, true);
|
||||
mImageAltEmu.setImage(mBadgeIcons[SLOT_ALTERNATIVE_EMULATOR], false, true);
|
||||
mImageComponents.insert({SLOT_ALTERNATIVE_EMULATOR, mImageAltEmu});
|
||||
}
|
||||
|
||||
|
@ -99,7 +99,7 @@ void BadgesComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
if (properties & PATH && elem->has(slot) &&
|
||||
mBadgeIcons[slot] != elem->get<std::string>(slot)) {
|
||||
mBadgeIcons[slot] = elem->get<std::string>(slot);
|
||||
mImageComponents.find(slot)->second.setImage(mBadgeIcons[slot], false, true, true);
|
||||
mImageComponents.find(slot)->second.setImage(mBadgeIcons[slot], false, true);
|
||||
imgChanged = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ void ImageComponent::resize()
|
|||
onSizeChanged();
|
||||
}
|
||||
|
||||
void ImageComponent::setImage(std::string path, bool tile, bool linearMagnify, bool cacheImage)
|
||||
void ImageComponent::setImage(std::string path, bool tile, bool linearMagnify)
|
||||
{
|
||||
// Always load bundled graphic resources statically, unless mForceLoad has been set.
|
||||
// This eliminates annoying texture pop-in problems that would otherwise occur.
|
||||
|
@ -150,12 +150,11 @@ void ImageComponent::setImage(std::string path, bool tile, bool linearMagnify, b
|
|||
if (mDefaultPath.empty() || !ResourceManager::getInstance()->fileExists(mDefaultPath))
|
||||
mTexture.reset();
|
||||
else
|
||||
mTexture = TextureResource::get(mDefaultPath, tile, mForceLoad, mDynamic, linearMagnify,
|
||||
1.0f, cacheImage);
|
||||
mTexture =
|
||||
TextureResource::get(mDefaultPath, tile, mForceLoad, mDynamic, linearMagnify);
|
||||
}
|
||||
else {
|
||||
mTexture =
|
||||
TextureResource::get(path, tile, mForceLoad, mDynamic, linearMagnify, 1.0f, cacheImage);
|
||||
mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, linearMagnify);
|
||||
}
|
||||
|
||||
resize();
|
||||
|
|
|
@ -18,20 +18,15 @@ class ImageComponent : public GuiComponent
|
|||
{
|
||||
public:
|
||||
ImageComponent(Window* window, bool forceLoad = false, bool dynamic = true);
|
||||
virtual ~ImageComponent() {};
|
||||
virtual ~ImageComponent() {}
|
||||
|
||||
void setDefaultImage(std::string path) { mDefaultPath = path; }
|
||||
|
||||
// Loads the image at the given filepath. Will tile if tile is true (retrieves texture
|
||||
// as tiling, creates vertices accordingly).
|
||||
void setImage(std::string path,
|
||||
bool tile = false,
|
||||
bool linearMagnify = false,
|
||||
bool cacheSVG = false);
|
||||
|
||||
void setImage(std::string path, bool tile = false, bool linearMagnify = false);
|
||||
// Loads an image from memory.
|
||||
void setImage(const char* data, size_t length, bool tile = false);
|
||||
|
||||
// Use an already existing texture.
|
||||
void setImage(const std::shared_ptr<TextureResource>& texture, bool resizeTexture = true);
|
||||
|
||||
|
|
|
@ -148,8 +148,7 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path,
|
|||
bool forceLoad,
|
||||
bool dynamic,
|
||||
bool linearMagnify,
|
||||
float scaleDuringLoad,
|
||||
bool cacheImage)
|
||||
float scaleDuringLoad)
|
||||
{
|
||||
std::shared_ptr<ResourceManager>& rm = ResourceManager::getInstance();
|
||||
|
||||
|
@ -177,7 +176,7 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string& path,
|
|||
std::shared_ptr<TextureData> data = sTextureDataManager.get(tex.get());
|
||||
|
||||
// Is it an SVG?
|
||||
if (key.first.substr(key.first.size() - 4, std::string::npos) != ".svg" || cacheImage) {
|
||||
if (key.first.substr(key.first.size() - 4, std::string::npos) != ".svg") {
|
||||
// Probably not. Add it to our map. We don't add SVGs because 2 SVGs might be
|
||||
// rasterized at different sizes.
|
||||
sTextureMap[key] = std::weak_ptr<TextureResource>(tex);
|
||||
|
|
|
@ -30,9 +30,7 @@ public:
|
|||
bool forceLoad = false,
|
||||
bool dynamic = true,
|
||||
bool linearMagnify = false,
|
||||
float scaleDuringLoad = 1.0f,
|
||||
bool cacheImage = false);
|
||||
|
||||
float scaleDuringLoad = 1.0f);
|
||||
void initFromPixels(const unsigned char* dataRGBA, size_t width, size_t height);
|
||||
virtual void initFromMemory(const char* data, size_t length);
|
||||
static void manualUnload(std::string path, bool tile);
|
||||
|
|
Loading…
Reference in a new issue