From 87d6207c51eb673466e0fbd46d9b572adcd95bb5 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Mon, 27 Sep 2021 21:03:53 +0200 Subject: [PATCH] Removed lots of unnecessary help component texture resizing. --- es-core/src/components/HelpComponent.cpp | 2 +- es-core/src/components/ImageComponent.cpp | 5 +++-- es-core/src/components/ImageComponent.h | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/es-core/src/components/HelpComponent.cpp b/es-core/src/components/HelpComponent.cpp index 69c1ae32c..7b6c7197f 100644 --- a/es-core/src/components/HelpComponent.cpp +++ b/es-core/src/components/HelpComponent.cpp @@ -218,7 +218,7 @@ void HelpComponent::updateGrid() for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); it++) { auto icon = std::make_shared(mWindow); - icon->setImage(getIconTexture(it->first.c_str())); + icon->setImage(getIconTexture(it->first.c_str()), false); icon->setColorShift(isDimmed ? mStyle.iconColorDimmed : mStyle.iconColor); icon->setResize(0, height); icons.push_back(icon); diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index 600af7c22..f6c2d2af2 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -170,10 +170,11 @@ void ImageComponent::setImage(const char* data, size_t length, bool tile) resize(); } -void ImageComponent::setImage(const std::shared_ptr& texture) +void ImageComponent::setImage(const std::shared_ptr& texture, bool resizeTexture) { mTexture = texture; - resize(); + if (resizeTexture) + resize(); } void ImageComponent::setResize(float width, float height) diff --git a/es-core/src/components/ImageComponent.h b/es-core/src/components/ImageComponent.h index ca537c62f..159d65e3b 100644 --- a/es-core/src/components/ImageComponent.h +++ b/es-core/src/components/ImageComponent.h @@ -28,7 +28,7 @@ public: // 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& texture); + void setImage(const std::shared_ptr& texture, bool resizeTexture = true); void onSizeChanged() override { updateVertices(); }