Removed a lot of unnecessary vertex roundings

This commit is contained in:
Leon Styhre 2023-09-07 21:38:34 +02:00
parent 848d19a80b
commit 8d8649273b
6 changed files with 0 additions and 25 deletions

View file

@ -583,10 +583,6 @@ void GIFAnimComponent::render(const glm::mat4& parentTrans)
vertices[3] = {{mSize.x, mSize.y}, {1.0f, 1.0f}, mColorShiftEnd}; vertices[3] = {{mSize.x, mSize.y}, {1.0f, 1.0f}, mColorShiftEnd};
// clang-format on // clang-format on
// Round vertices.
for (int i = 0; i < 4; ++i)
vertices[i].position = glm::round(vertices[i].position);
vertices->brightness = mBrightness; vertices->brightness = mBrightness;
vertices->saturation = mSaturation * mThemeSaturation; vertices->saturation = mSaturation * mThemeSaturation;
vertices->opacity = mOpacity * mThemeOpacity; vertices->opacity = mOpacity * mThemeOpacity;

View file

@ -874,11 +874,6 @@ void ImageComponent::updateVertices()
updateColors(); updateColors();
// We round the vertices already here in this component as we may otherwise end up with edge
// cases at sizes near 0.5.
for (int i {0}; i < 4; ++i)
mVertices[i].position = glm::round(mVertices[i].position);
if (mFlipX) { if (mFlipX) {
for (int i {0}; i < 4; ++i) for (int i {0}; i < 4; ++i)
mVertices[i].texcoord[0] = px - mVertices[i].texcoord[0]; mVertices[i].texcoord[0] = px - mVertices[i].texcoord[0];

View file

@ -574,10 +574,6 @@ void LottieAnimComponent::render(const glm::mat4& parentTrans)
vertices[3] = {{mSize.x, mSize.y}, {1.0f, 1.0f}, mColorShiftEnd}; vertices[3] = {{mSize.x, mSize.y}, {1.0f, 1.0f}, mColorShiftEnd};
// clang-format on // clang-format on
// Round vertices.
for (int i {0}; i < 4; ++i)
vertices[i].position = glm::round(vertices[i].position);
vertices->brightness = mBrightness; vertices->brightness = mBrightness;
vertices->saturation = mSaturation * mThemeSaturation; vertices->saturation = mSaturation * mThemeSaturation;
vertices->opacity = mOpacity * mThemeOpacity; vertices->opacity = mOpacity * mThemeOpacity;

View file

@ -129,10 +129,6 @@ void NinePatchComponent::buildVertices()
(*mVertices)[v + 4] = {{imgPos.x + imgSize.x, imgPos.y + imgSize.y}, {texPos.x + texSizeSlice.x, texPos.y + texSizeSlice.y}, 0}; (*mVertices)[v + 4] = {{imgPos.x + imgSize.x, imgPos.y + imgSize.y}, {texPos.x + texSizeSlice.x, texPos.y + texSizeSlice.y}, 0};
// clang-format on // clang-format on
// Round vertices.
for (int i {1}; i < 5; ++i)
(*mVertices)[v + i].position = glm::round((*mVertices)[v + i].position);
// Make duplicates of first and last vertex so this can be rendered as a triangle strip. // Make duplicates of first and last vertex so this can be rendered as a triangle strip.
(*mVertices)[v + 0] = (*mVertices)[v + 1]; (*mVertices)[v + 0] = (*mVertices)[v + 1];
(*mVertices)[v + 5] = (*mVertices)[v + 4]; (*mVertices)[v + 5] = (*mVertices)[v + 4];

View file

@ -199,10 +199,6 @@ void VideoFFmpegComponent::render(const glm::mat4& parentTrans)
vertices[2].color = mColorGradientHorizontal ? mColorShiftEnd : mColorShift; vertices[2].color = mColorGradientHorizontal ? mColorShiftEnd : mColorShift;
vertices[3].color = mColorShiftEnd; vertices[3].color = mColorShiftEnd;
// Round vertices.
for (int i {0}; i < 4; ++i)
vertices[i].position = glm::round(vertices[i].position);
if (mFadeIn < 1.0f || mThemeOpacity < 1.0f) if (mFadeIn < 1.0f || mThemeOpacity < 1.0f)
vertices->opacity = mOpacity * mThemeOpacity; vertices->opacity = mOpacity * mThemeOpacity;

View file

@ -486,10 +486,6 @@ void Renderer::drawRect(const float x,
vertices[3] = {{x + wL, y + hL}, {0.0f, 0.0f}, colorEnd}; vertices[3] = {{x + wL, y + hL}, {0.0f, 0.0f}, colorEnd};
// clang-format on // clang-format on
// Round vertices.
for (int i {0}; i < 4; ++i)
vertices[i].position = glm::round(vertices[i].position);
vertices->opacity = opacity; vertices->opacity = opacity;
vertices->dimming = dimming; vertices->dimming = dimming;