slight optimization

This commit is contained in:
Jorijn van der Graaf 2025-11-25 02:10:18 +01:00
commit 4793d6f26a
6 changed files with 39 additions and 25 deletions

View file

@ -46,8 +46,8 @@ export namespace Crafter {
UiElement(std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
UiElement(UiElement&) = delete;
UiElement& operator=(UiElement&) = delete;
void UpdatePosition(WindowFramebuffer& window);
void UpdatePosition(WindowFramebuffer& window, UiElement& parent);
virtual void UpdatePosition(WindowFramebuffer& window) = 0;
virtual void UpdatePosition(WindowFramebuffer& window, UiElement& parent) = 0;
};
class UiElementMouse {
@ -91,6 +91,7 @@ export namespace Crafter {
class UiElementBufferBufferBase : public UiElementBuffer {
public:
std::vector<Pixel_BU8_GU8_RU8_AU8> buffer;
std::vector<Pixel_BU8_GU8_RU8_AU8> scaled;
UiElementBufferBufferBase() = default;
UiElementBufferBufferBase(std::uint_fast32_t width, std::uint_fast32_t height);
void Create(std::uint_fast32_t width, std::uint_fast32_t height) override;
@ -114,6 +115,8 @@ export namespace Crafter {
public:
UiElementBufferBuffer(std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
UiElementBufferBuffer(std::uint_fast32_t width, std::uint_fast32_t height, std::int_fast32_t anchorX, std::int_fast32_t anchorY, std::uint_fast32_t relativeWidth, std::uint_fast32_t relativeHeight, std::int_fast32_t anchorOffsetX = FractionalToMapped(0.5), std::int_fast32_t anchorOffsetY = FractionalToMapped(0.5), std::int_fast32_t z = 0, bool ignoreScaling = false);
void UpdatePosition(WindowFramebuffer& window) override;
void UpdatePosition(WindowFramebuffer& window, UiElement& parent) override;
};