2024-12-22 17:12:09 +01:00
|
|
|
#include "RectPassElement.hpp"
|
|
|
|
|
#include "../OpenGL.hpp"
|
|
|
|
|
|
|
|
|
|
CRectPassElement::CRectPassElement(const CRectPassElement::SRectData& data_) : data(data_) {
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CRectPassElement::draw(const CRegion& damage) {
|
2025-01-02 21:58:23 +01:00
|
|
|
if (data.box.w <= 0 || data.box.h <= 0)
|
|
|
|
|
return;
|
|
|
|
|
|
2024-12-22 17:12:09 +01:00
|
|
|
if (data.color.a == 1.F || !data.blur)
|
2025-01-05 12:38:49 -06:00
|
|
|
g_pHyprOpenGL->renderRectWithDamage(&data.box, data.color, damage, data.round, data.roundingPower);
|
2024-12-22 17:12:09 +01:00
|
|
|
else
|
2025-01-05 12:38:49 -06:00
|
|
|
g_pHyprOpenGL->renderRectWithBlur(&data.box, data.color, data.round, data.roundingPower, data.blurA, data.xray);
|
2024-12-22 17:12:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CRectPassElement::needsLiveBlur() {
|
|
|
|
|
return data.color.a < 1.F && !data.xray && data.blur;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool CRectPassElement::needsPrecomputeBlur() {
|
|
|
|
|
return data.color.a < 1.F && data.xray && data.blur;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::optional<CBox> CRectPassElement::boundingBox() {
|
2025-01-23 22:59:06 +00:00
|
|
|
return data.box;
|
2024-12-22 17:12:09 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CRegion CRectPassElement::opaqueRegion() {
|
2025-01-23 22:59:06 +00:00
|
|
|
return data.color.a >= 1.F ? boundingBox()->expand(-data.round) : CRegion{};
|
2024-12-22 17:12:09 +01:00
|
|
|
}
|