Removed lots of unnecessary help component texture resizing.

This commit is contained in:
Leon Styhre 2021-09-27 21:03:53 +02:00
parent 081fbc5665
commit 87d6207c51
3 changed files with 5 additions and 4 deletions

View file

@ -218,7 +218,7 @@ void HelpComponent::updateGrid()
for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); it++) { for (auto it = mPrompts.cbegin(); it != mPrompts.cend(); it++) {
auto icon = std::make_shared<ImageComponent>(mWindow); auto icon = std::make_shared<ImageComponent>(mWindow);
icon->setImage(getIconTexture(it->first.c_str())); icon->setImage(getIconTexture(it->first.c_str()), false);
icon->setColorShift(isDimmed ? mStyle.iconColorDimmed : mStyle.iconColor); icon->setColorShift(isDimmed ? mStyle.iconColorDimmed : mStyle.iconColor);
icon->setResize(0, height); icon->setResize(0, height);
icons.push_back(icon); icons.push_back(icon);

View file

@ -170,9 +170,10 @@ void ImageComponent::setImage(const char* data, size_t length, bool tile)
resize(); resize();
} }
void ImageComponent::setImage(const std::shared_ptr<TextureResource>& texture) void ImageComponent::setImage(const std::shared_ptr<TextureResource>& texture, bool resizeTexture)
{ {
mTexture = texture; mTexture = texture;
if (resizeTexture)
resize(); resize();
} }

View file

@ -28,7 +28,7 @@ public:
// Loads an image from memory. // Loads an image from memory.
void setImage(const char* data, size_t length, bool tile = false); void setImage(const char* data, size_t length, bool tile = false);
// Use an already existing texture. // Use an already existing texture.
void setImage(const std::shared_ptr<TextureResource>& texture); void setImage(const std::shared_ptr<TextureResource>& texture, bool resizeTexture = true);
void onSizeChanged() override { updateVertices(); } void onSizeChanged() override { updateVertices(); }