Fixed a rounding issue for the ImageComponent debug overlay.

This commit is contained in:
Leon Styhre 2022-09-09 17:56:41 +02:00
parent 2a4d9d334d
commit 807cf7b057

View file

@ -334,11 +334,13 @@ void ImageComponent::render(const glm::mat4& parentTrans)
if (mTexture && mOpacity > 0.0f) {
if (Settings::getInstance()->getBool("DebugImage")) {
glm::vec2 targetSizePos {(mTargetSize - mSize) * mOrigin * glm::vec2 {-1.0f}};
glm::vec2 targetSizePos {
glm::round((mTargetSize - mSize) * mOrigin * glm::vec2 {-1.0f})};
mRenderer->drawRect(targetSizePos.x, targetSizePos.y, mTargetSize.x, mTargetSize.y,
0xFF000033, 0xFF000033);
if (mClipRegion == glm::vec4 {0.0f, 0.0f, 0.0f, 0.0f})
mRenderer->drawRect(0.0f, 0.0f, mSize.x, mSize.y, 0xFF000033, 0xFF000033);
mRenderer->drawRect(0.0f, 0.0f, std::round(mSize.x), std::round(mSize.y),
0xFF000033, 0xFF000033);
else
mRenderer->drawRect(mClipRegion.x, mClipRegion.y, mClipRegion.z - mClipRegion.x,
mClipRegion.w - mClipRegion.y, 0xFF000033, 0xFF000033);