Merge branch '63-add-badges-decals-e-g-for-favorites-completed-games-non-working-games-collections-and-folders' into 575-theme-add-a-modern-clean-switch-like-theme-as-an-official-theme-in-es-de-to-choose-from

# Conflicts:
#	es-core/src/components/BadgesComponent.cpp
#	es-core/src/components/BadgesComponent.h
#	es-core/src/components/ImageComponent.cpp
#	es-core/src/resources/TextureResource.cpp
#	es-core/src/resources/TextureResource.h
This commit is contained in:
Sophia Hadash 2021-09-27 00:42:20 +02:00
commit e1de215d1a
5 changed files with 8 additions and 8 deletions

View file

@ -49,6 +49,8 @@ BadgesComponent::~BadgesComponent() noexcept {
for (GuiComponent *c: mChildren)
c->clearChildren();
clearChildren();
mBadgeIcons.clear();
mImageComponents.clear();
}

View file

@ -45,7 +45,6 @@ private:
static const std::vector<std::string> mSlots;
std::map<std::string, std::string> mBadgeIcons;
std::map<std::string, ImageComponent> mImageComponents;
//static std::vector<BadgesComponent *> mInstances;
};
#endif // ES_APP_COMPONENTS_BADGES_COMPONENT_H

View file

@ -126,23 +126,22 @@ void ImageComponent::resize()
onSizeChanged();
}
void ImageComponent::setImage(std::string path, bool tile, bool linearMagnify, bool cacheSVG) {
void ImageComponent::setImage(std::string path, bool tile, bool linearMagnify, bool cacheImage) {
// Always load bundled graphic resources statically, unless mForceLoad has been set.
// This eliminates annoying texture pop-in problems that would otherwise occur.
if (!mForceLoad && (path[0] == ':') && (path[1] == '/')) {
mDynamic = false;
}
// Load the image texture. Enable caching for SVG as ImageComponent manages rasterization.
if (path.empty() || !ResourceManager::getInstance()->fileExists(path)) {
if (mDefaultPath.empty() || !ResourceManager::getInstance()->fileExists(mDefaultPath))
mTexture.reset();
else
mTexture =
TextureResource::get(mDefaultPath, tile, mForceLoad, mDynamic, linearMagnify, 1.0f, cacheSVG);
TextureResource::get(mDefaultPath, tile, mForceLoad, mDynamic, linearMagnify, 1.0f, cacheImage);
}
else {
mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, linearMagnify, 1.0f, cacheSVG);
mTexture = TextureResource::get(path, tile, mForceLoad, mDynamic, linearMagnify, 1.0f, cacheImage);
}
resize();

View file

@ -149,7 +149,7 @@ std::shared_ptr<TextureResource> TextureResource::get(const std::string &path,
bool dynamic,
bool linearMagnify,
float scaleDuringLoad,
bool cacheSVG)
bool cacheImage)
{
std::shared_ptr<ResourceManager>& rm = ResourceManager::getInstance();
@ -177,7 +177,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" || cacheSVG) {
if (key.first.substr(key.first.size() - 4, std::string::npos) != ".svg" || cacheImage) {
// 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);

View file

@ -31,7 +31,7 @@ public:
bool dynamic = true,
bool linearMagnify = false,
float scaleDuringLoad = 1.0f,
bool cacheSVG = false);
bool cacheImage = false);
void initFromPixels(const unsigned char *dataRGBA, size_t width, size_t height);
virtual void initFromMemory(const char* data, size_t length);