mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-03-06 14:27:43 +00:00
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:
commit
e1de215d1a
es-core/src
|
@ -49,6 +49,8 @@ BadgesComponent::~BadgesComponent() noexcept {
|
|||
for (GuiComponent *c: mChildren)
|
||||
c->clearChildren();
|
||||
clearChildren();
|
||||
mBadgeIcons.clear();
|
||||
mImageComponents.clear();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue