renderer: Add supercircular window corners (#8943)

renderer: Add supercircular shadows and borders

config: Add rounding_power to default and example configs

rule: add `roundingpower` window rule
This commit is contained in:
Pollux 2025-01-05 12:38:49 -06:00 committed by GitHub
parent b0bae15499
commit a5c14370c1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 228 additions and 173 deletions

View file

@ -7,9 +7,9 @@ CBorderPassElement::CBorderPassElement(const CBorderPassElement::SBorderData& da
void CBorderPassElement::draw(const CRegion& damage) {
if (data.hasGrad2)
g_pHyprOpenGL->renderBorder(&data.box, data.grad1, data.grad2, data.lerp, data.round, data.borderSize, data.a, data.outerRound);
g_pHyprOpenGL->renderBorder(&data.box, data.grad1, data.grad2, data.lerp, data.round, data.roundingPower, data.borderSize, data.a, data.outerRound);
else
g_pHyprOpenGL->renderBorder(&data.box, data.grad1, data.round, data.borderSize, data.a, data.outerRound);
g_pHyprOpenGL->renderBorder(&data.box, data.grad1, data.round, data.roundingPower, data.borderSize, data.a, data.outerRound);
}
bool CBorderPassElement::needsLiveBlur() {
@ -18,4 +18,4 @@ bool CBorderPassElement::needsLiveBlur() {
bool CBorderPassElement::needsPrecomputeBlur() {
return false;
}
}

View file

@ -12,6 +12,7 @@ class CBorderPassElement : public IPassElement {
bool hasGrad2 = false;
float lerp = 0.F, a = 1.F;
int round = 0, borderSize = 1, outerRound = -1;
float roundingPower = 2.F;
};
CBorderPassElement(const SBorderData& data_);

View file

@ -10,9 +10,9 @@ void CRectPassElement::draw(const CRegion& damage) {
return;
if (data.color.a == 1.F || !data.blur)
g_pHyprOpenGL->renderRectWithDamage(&data.box, data.color, damage, data.round);
g_pHyprOpenGL->renderRectWithDamage(&data.box, data.color, damage, data.round, data.roundingPower);
else
g_pHyprOpenGL->renderRectWithBlur(&data.box, data.color, data.round, data.blurA, data.xray);
g_pHyprOpenGL->renderRectWithBlur(&data.box, data.color, data.round, data.roundingPower, data.blurA, data.xray);
}
bool CRectPassElement::needsLiveBlur() {

View file

@ -6,7 +6,8 @@ class CRectPassElement : public IPassElement {
struct SRectData {
CBox box;
CHyprColor color;
int round = 0;
int round = 0;
float roundingPower = 2.0f;
bool blur = false, xray = false;
float blurA = 1.F;
};
@ -26,4 +27,4 @@ class CRectPassElement : public IPassElement {
private:
SRectData data;
};
};

View file

@ -88,12 +88,15 @@ void CSurfacePassElement::draw(const CRegion& damage) {
if (MISALIGNEDFSV1)
g_pHyprOpenGL->m_RenderData.useNearestNeighbor = true;
float rounding = data.rounding;
float rounding = data.rounding;
float roundingPower = data.roundingPower;
rounding -= 1; // to fix a border issue
if (data.dontRound)
rounding = 0;
if (data.dontRound) {
rounding = 0;
roundingPower = 2.0f;
}
const bool WINDOWOPAQUE = data.pWindow && data.pWindow->m_pWLSurface->resource() == data.surface ? data.pWindow->opaque() : false;
const bool CANDISABLEBLEND = ALPHA >= 1.f && OVERALL_ALPHA >= 1.f && rounding == 0 && WINDOWOPAQUE;
@ -108,14 +111,14 @@ void CSurfacePassElement::draw(const CRegion& damage) {
// to what we do for misaligned surfaces (blur the entire thing and then render shit without blur)
if (data.surfaceCounter == 0 && !data.popup) {
if (BLUR)
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, ALPHA, data.surface, rounding, data.blockBlurOptimization, data.fadeAlpha, OVERALL_ALPHA);
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, ALPHA, data.surface, rounding, roundingPower, data.blockBlurOptimization, data.fadeAlpha, OVERALL_ALPHA);
else
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, ALPHA * OVERALL_ALPHA, rounding, false, true);
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, ALPHA * OVERALL_ALPHA, rounding, roundingPower, false, true);
} else {
if (BLUR && data.popup)
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, ALPHA, data.surface, rounding, true, data.fadeAlpha, OVERALL_ALPHA);
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, ALPHA, data.surface, rounding, roundingPower, true, data.fadeAlpha, OVERALL_ALPHA);
else
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, ALPHA * OVERALL_ALPHA, rounding, false, true);
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, ALPHA * OVERALL_ALPHA, rounding, roundingPower, false, true);
}
if (!g_pHyprRenderer->m_bBlockSurfaceFeedback)

View file

@ -35,6 +35,9 @@ class CSurfacePassElement : public IPassElement {
// for custom round values
int rounding = -1; // -1 means not set
// for custom rounding powers
float roundingPower = 2.0f;
// for blurring
bool blur = false;
bool blockBlurOptimization = false;
@ -79,4 +82,4 @@ class CSurfacePassElement : public IPassElement {
SRenderData data;
CBox getTexBox();
};
};

View file

@ -18,7 +18,8 @@ void CTexPassElement::draw(const CRegion& damage) {
if (data.replaceProjection)
g_pHyprOpenGL->m_RenderData.monitorProjection = *data.replaceProjection;
g_pHyprOpenGL->renderTextureInternalWithDamage(data.tex, &data.box, data.a, data.damage.empty() ? damage : data.damage, data.round, data.syncTimeline, data.syncPoint);
g_pHyprOpenGL->renderTextureInternalWithDamage(data.tex, &data.box, data.a, data.damage.empty() ? damage : data.damage, data.round, data.roundingPower, data.syncTimeline,
data.syncPoint);
if (data.replaceProjection)
g_pHyprOpenGL->m_RenderData.monitorProjection = g_pHyprOpenGL->m_RenderData.pMonitor->projMatrix;
}

View file

@ -13,8 +13,9 @@ class CTexPassElement : public IPassElement {
CBox box;
float a = 1.F;
CRegion damage;
int round = 0;
bool flipEndFrame = false;
int round = 0;
float roundingPower = 2.0f;
bool flipEndFrame = false;
SP<CSyncTimeline> syncTimeline;
int64_t syncPoint = 0;
std::optional<Mat3x3> replaceProjection;
@ -36,4 +37,4 @@ class CTexPassElement : public IPassElement {
private:
SRenderData data;
};
};