renderer: minor alpha improvements

This commit is contained in:
Vaxry 2024-02-20 16:29:23 +00:00
parent b9c88e8600
commit 40802b9672
2 changed files with 7 additions and 5 deletions

View file

@ -128,7 +128,7 @@ CRenderer::SRenderFeedback CRenderer::renderLock(const CSessionLockSurface& surf
glClear(GL_COLOR_BUFFER_BIT);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
SRenderFeedback feedback;
@ -162,6 +162,8 @@ CRenderer::SRenderFeedback CRenderer::renderLock(const CSessionLockSurface& surf
feedback.needsFrame = feedback.needsFrame || !asyncResourceGatherer->ready || bga < 1.0;
glDisable(GL_BLEND);
return feedback;
}

View file

@ -103,10 +103,10 @@ bool CPasswordInputField::draw(const SRenderData& data) {
float passAlpha = g_pHyprlock->passwordCheckWaiting() ? 0.5 : 1.0;
CColor outerCol = outer;
outer.a = fade.a * data.opacity;
outer.a *= fade.a * data.opacity;
CColor innerCol = inner;
innerCol.a = fade.a * data.opacity;
CColor fontCol = font;
innerCol.a *= fade.a * data.opacity;
CColor fontCol = font;
fontCol.a *= fade.a * data.opacity * passAlpha;
g_pRenderer->renderRect(outerBox, outerCol, outerBox.h / 2.0);
@ -144,7 +144,7 @@ bool CPasswordInputField::draw(const SRenderData& data) {
Vector2D currentPos = inputFieldBox.pos() + Vector2D{PASS_SPACING * 4, inputFieldBox.h / 2.f - PASS_SIZE / 2.f} +
Vector2D{(PASS_SIZE + PASS_SPACING) * std::floor(dots.currentAmount), 0};
CBox box{currentPos, Vector2D{PASS_SIZE, PASS_SIZE}};
fontCol.a = (dots.currentAmount - std::floor(dots.currentAmount)) * data.opacity;
fontCol.a *= (dots.currentAmount - std::floor(dots.currentAmount)) * data.opacity;
g_pRenderer->renderRect(box, fontCol, PASS_SIZE / 2.0);
}
}