From ed69e46b4299e1357c93c912d81e6b40b0882a96 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Tue, 30 Aug 2022 20:26:48 +0200 Subject: [PATCH] Fixed some issues where bundled SVG images would not get cached at the correct resolution. --- es-app/src/MediaViewer.cpp | 2 +- es-app/src/guis/GuiCollectionSystemsOptions.cpp | 6 +++--- es-app/src/guis/GuiGamelistFilter.cpp | 2 +- es-app/src/guis/GuiMenu.cpp | 2 +- es-app/src/guis/GuiMetaDataEd.cpp | 8 ++++---- es-app/src/guis/GuiSettings.cpp | 2 +- es-core/src/components/MenuComponent.cpp | 2 +- es-core/src/components/OptionListComponent.h | 2 +- es-core/src/components/SwitchComponent.cpp | 4 ++-- es-core/src/components/primary/CarouselComponent.h | 2 +- es-core/src/guis/GuiInputConfig.cpp | 2 +- 11 files changed, 17 insertions(+), 17 deletions(-) diff --git a/es-app/src/MediaViewer.cpp b/es-app/src/MediaViewer.cpp index fa8e19391..b1ea2582a 100644 --- a/es-app/src/MediaViewer.cpp +++ b/es-app/src/MediaViewer.cpp @@ -278,9 +278,9 @@ void MediaViewer::showImage(int index) if (!mImageFiles.empty() && static_cast(mImageFiles.size()) >= index) { mImage = new ImageComponent(false, false); - mImage->setImage(mImageFiles[index]); mImage->setOrigin(0.5f, 0.5f); mImage->setPosition(Renderer::getScreenWidth() / 2.0f, Renderer::getScreenHeight() / 2.0f); mImage->setMaxSize(Renderer::getScreenWidth(), Renderer::getScreenHeight()); + mImage->setImage(mImageFiles[index]); } } diff --git a/es-app/src/guis/GuiCollectionSystemsOptions.cpp b/es-app/src/guis/GuiCollectionSystemsOptions.cpp index b4d4c01a0..eb3c99436 100644 --- a/es-app/src/guis/GuiCollectionSystemsOptions.cpp +++ b/es-app/src/guis/GuiCollectionSystemsOptions.cpp @@ -165,9 +165,9 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) auto themeCollection = std::make_shared( "CREATE NEW CUSTOM COLLECTION FROM THEME", Font::get(FONT_SIZE_MEDIUM), 0x777777FF); auto bracketThemeCollection = std::make_shared(); - bracketThemeCollection->setImage(":/graphics/arrow.svg"); bracketThemeCollection->setResize( glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()}); + bracketThemeCollection->setImage(":/graphics/arrow.svg"); row.addElement(themeCollection, true); row.addElement(bracketThemeCollection, false); row.makeAcceptInputHandler([this, unusedFolders] { @@ -198,9 +198,9 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) auto newCollection = std::make_shared("CREATE NEW CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF); auto bracketNewCollection = std::make_shared(); - bracketNewCollection->setImage(":/graphics/arrow.svg"); bracketNewCollection->setResize( glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()}); + bracketNewCollection->setImage(":/graphics/arrow.svg"); row.addElement(newCollection, true); row.addElement(bracketNewCollection, false); auto createCollectionCall = [this](const std::string& newVal) { @@ -234,9 +234,9 @@ GuiCollectionSystemsOptions::GuiCollectionSystemsOptions(std::string title) auto deleteCollection = std::make_shared( "DELETE CUSTOM COLLECTION", Font::get(FONT_SIZE_MEDIUM), 0x777777FF); auto bracketDeleteCollection = std::make_shared(); - bracketDeleteCollection->setImage(":/graphics/arrow.svg"); bracketDeleteCollection->setResize( glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()}); + bracketDeleteCollection->setImage(":/graphics/arrow.svg"); row.addElement(deleteCollection, true); row.addElement(bracketDeleteCollection, false); row.makeAcceptInputHandler([this, customSystems] { diff --git a/es-app/src/guis/GuiGamelistFilter.cpp b/es-app/src/guis/GuiGamelistFilter.cpp index fc2e11445..e492b276c 100644 --- a/es-app/src/guis/GuiGamelistFilter.cpp +++ b/es-app/src/guis/GuiGamelistFilter.cpp @@ -112,8 +112,8 @@ void GuiGamelistFilter::addFiltersToMenu() row.addElement(spacer, false); auto bracket = std::make_shared(); - bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()}); + bracket->setImage(":/graphics/arrow.svg"); row.addElement(bracket, false); mTextFilterField->setValue(mFilterIndex->getTextFilter()); diff --git a/es-app/src/guis/GuiMenu.cpp b/es-app/src/guis/GuiMenu.cpp index 25dcff3bb..7b22be950 100644 --- a/es-app/src/guis/GuiMenu.cpp +++ b/es-app/src/guis/GuiMenu.cpp @@ -980,9 +980,9 @@ void GuiMenu::openOtherOptions() auto media_directory = std::make_shared("GAME MEDIA DIRECTORY", Font::get(FONT_SIZE_MEDIUM), 0x777777FF); auto bracketMediaDirectory = std::make_shared(); - bracketMediaDirectory->setImage(":/graphics/arrow.svg"); bracketMediaDirectory->setResize( glm::vec2 {0.0f, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()}); + bracketMediaDirectory->setImage(":/graphics/arrow.svg"); rowMediaDir.addElement(media_directory, true); rowMediaDir.addElement(bracketMediaDirectory, false); std::string titleMediaDir = "ENTER GAME MEDIA DIRECTORY"; diff --git a/es-app/src/guis/GuiMetaDataEd.cpp b/es-app/src/guis/GuiMetaDataEd.cpp index ac7b1ed9d..8565b7d8d 100644 --- a/es-app/src/guis/GuiMetaDataEd.cpp +++ b/es-app/src/guis/GuiMetaDataEd.cpp @@ -197,8 +197,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md, row.addElement(spacer, false); auto bracket = std::make_shared(); - bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()}); + bracket->setImage(":/graphics/arrow.svg"); row.addElement(bracket, false); const std::string title {it->displayPrompt}; @@ -279,8 +279,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md, row.addElement(spacer, false); auto bracket = std::make_shared(); - bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()}); + bracket->setImage(":/graphics/arrow.svg"); row.addElement(bracket, false); const std::string title {it->displayPrompt}; @@ -415,8 +415,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md, row.addElement(spacer, false); auto bracket = std::make_shared(); - bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()}); + bracket->setImage(":/graphics/arrow.svg"); row.addElement(bracket, false); const std::string title {it->displayPrompt}; @@ -521,8 +521,8 @@ GuiMetaDataEd::GuiMetaDataEd(MetaDataList* md, row.addElement(spacer, false); auto bracket = std::make_shared(); - bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()}); + bracket->setImage(":/graphics/arrow.svg"); row.addElement(bracket, false); bool multiLine {it->type == MD_MULTILINE_STRING}; diff --git a/es-app/src/guis/GuiSettings.cpp b/es-app/src/guis/GuiSettings.cpp index ae42ab6bf..306288310 100644 --- a/es-app/src/guis/GuiSettings.cpp +++ b/es-app/src/guis/GuiSettings.cpp @@ -169,8 +169,8 @@ void GuiSettings::addEditableTextComponent(const std::string label, row.addElement(spacer, false); auto bracket = std::make_shared(); - bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(glm::vec2 {0.0f, lbl->getFont()->getLetterHeight()}); + bracket->setImage(":/graphics/arrow.svg"); row.addElement(bracket, false); // OK callback (apply new value to ed). diff --git a/es-core/src/components/MenuComponent.cpp b/es-core/src/components/MenuComponent.cpp index 62884ba43..0b6e808e1 100644 --- a/es-core/src/components/MenuComponent.cpp +++ b/es-core/src/components/MenuComponent.cpp @@ -186,7 +186,7 @@ std::shared_ptr makeButtonGrid( std::shared_ptr makeArrow() { auto bracket = std::make_shared(); - bracket->setImage(":/graphics/arrow.svg"); bracket->setResize(0, std::round(Font::get(FONT_SIZE_MEDIUM)->getLetterHeight())); + bracket->setImage(":/graphics/arrow.svg"); return bracket; } diff --git a/es-core/src/components/OptionListComponent.h b/es-core/src/components/OptionListComponent.h index aa042cafe..1224078c6 100644 --- a/es-core/src/components/OptionListComponent.h +++ b/es-core/src/components/OptionListComponent.h @@ -460,8 +460,8 @@ private: if (mParent->mMultiSelect) { // Add checkbox. auto checkbox = std::make_shared(); - checkbox->setImage(it->selected ? CHECKED_PATH : UNCHECKED_PATH); checkbox->setResize(0, font->getLetterHeight()); + checkbox->setImage(it->selected ? CHECKED_PATH : UNCHECKED_PATH); row.addElement(checkbox, false); if (mParent->mMultiExclusiveSelect && hasSelectedRow && !(*it).selected) diff --git a/es-core/src/components/SwitchComponent.cpp b/es-core/src/components/SwitchComponent.cpp index 375554869..be84cd2db 100644 --- a/es-core/src/components/SwitchComponent.cpp +++ b/es-core/src/components/SwitchComponent.cpp @@ -16,8 +16,8 @@ SwitchComponent::SwitchComponent(bool state) , mColorOriginalValue {DEFAULT_COLORSHIFT} , mColorChangedValue {DEFAULT_COLORSHIFT} { - mImage.setImage(":/graphics/off.svg"); mImage.setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight()); + mImage.setImage(":/graphics/off.svg"); mSize = mImage.getSize(); } @@ -68,8 +68,8 @@ void SwitchComponent::setValue(const std::string& statestring) void SwitchComponent::onStateChanged() { - mImage.setImage(mState ? ":/graphics/on.svg" : ":/graphics/off.svg"); mImage.setResize(mSize); + mImage.setImage(mState ? ":/graphics/on.svg" : ":/graphics/off.svg"); // Change the color of the switch to reflect the changes. if (mState == mOriginalValue) diff --git a/es-core/src/components/primary/CarouselComponent.h b/es-core/src/components/primary/CarouselComponent.h index 76c2cc0bc..b43e95d7f 100644 --- a/es-core/src/components/primary/CarouselComponent.h +++ b/es-core/src/components/primary/CarouselComponent.h @@ -306,8 +306,8 @@ void CarouselComponent::updateEntry(Entry& entry, const std::shared_ptr(false, true); item->setLinearInterpolation(mLinearInterpolation); - item->setImage(entry.data.itemPath); item->setMaxSize(mItemSize * mItemScale); + item->setImage(entry.data.itemPath); item->applyTheme(theme, "system", "", ThemeFlags::ALL); item->setRotateByTargetSize(true); entry.data.item = item; diff --git a/es-core/src/guis/GuiInputConfig.cpp b/es-core/src/guis/GuiInputConfig.cpp index 591a09866..24520d723 100644 --- a/es-core/src/guis/GuiInputConfig.cpp +++ b/es-core/src/guis/GuiInputConfig.cpp @@ -84,9 +84,9 @@ GuiInputConfig::GuiInputConfig(InputConfig* target, // Icon. auto icon = std::make_shared(); + icon->setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 1.25f); icon->setImage(sGuiInputConfigList[i].icon); icon->setColorShift(0x777777FF); - icon->setResize(0, Font::get(FONT_SIZE_MEDIUM)->getLetterHeight() * 1.25f); row.addElement(icon, false); // Spacer between icon and text.