renderer: use CRegion foreach over getRects (#10980)
instead of allocating and returning a vector, use forEach to directly call a function on the rects.
This commit is contained in:
parent
43966cc787
commit
36a8b2226f
4 changed files with 37 additions and 41 deletions
|
|
@ -1273,10 +1273,10 @@ void CHyprOpenGLImpl::clear(const CHyprColor& color) {
|
|||
glClearColor(color.r, color.g, color.b, color.a);
|
||||
|
||||
if (!m_renderData.damage.empty()) {
|
||||
for (auto const& RECT : m_renderData.damage.getRects()) {
|
||||
m_renderData.damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glClear(GL_COLOR_BUFFER_BIT);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
scissor(nullptr);
|
||||
|
|
@ -1429,16 +1429,16 @@ void CHyprOpenGLImpl::renderRectWithDamage(const CBox& box, const CHyprColor& co
|
|||
damageClip.intersect(damage);
|
||||
|
||||
if (!damageClip.empty()) {
|
||||
for (auto const& RECT : damageClip.getRects()) {
|
||||
damageClip.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (auto const& RECT : damage.getRects()) {
|
||||
damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -1702,16 +1702,16 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP<CTexture> tex, const CB
|
|||
}
|
||||
|
||||
if (!damageClip.empty()) {
|
||||
for (auto const& RECT : damageClip.getRects()) {
|
||||
damageClip.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (auto const& RECT : damage.getRects()) {
|
||||
damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -1746,10 +1746,10 @@ void CHyprOpenGLImpl::renderTexturePrimitive(SP<CTexture> tex, const CBox& box)
|
|||
shader->setUniformInt(SHADER_TEX, 0);
|
||||
glBindVertexArray(shader->uniformLocations[SHADER_SHADER_VAO]);
|
||||
|
||||
for (auto const& RECT : m_renderData.damage.getRects()) {
|
||||
m_renderData.damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
|
||||
scissor(nullptr);
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -1789,10 +1789,10 @@ void CHyprOpenGLImpl::renderTextureMatte(SP<CTexture> tex, const CBox& box, CFra
|
|||
|
||||
glBindVertexArray(shader->uniformLocations[SHADER_SHADER_VAO]);
|
||||
|
||||
for (auto const& RECT : m_renderData.damage.getRects()) {
|
||||
m_renderData.damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
|
||||
scissor(nullptr);
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -1885,10 +1885,10 @@ CFramebuffer* CHyprOpenGLImpl::blurFramebufferWithDamage(float a, CRegion* origi
|
|||
glBindVertexArray(m_shaders->m_shBLURPREPARE.uniformLocations[SHADER_SHADER_VAO]);
|
||||
|
||||
if (!damage.empty()) {
|
||||
for (auto const& RECT : damage.getRects()) {
|
||||
damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT, false /* this region is already transformed */);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -1927,10 +1927,10 @@ CFramebuffer* CHyprOpenGLImpl::blurFramebufferWithDamage(float a, CRegion* origi
|
|||
glBindVertexArray(pShader->uniformLocations[SHADER_SHADER_VAO]);
|
||||
|
||||
if (!pDamage->empty()) {
|
||||
for (auto const& RECT : pDamage->getRects()) {
|
||||
pDamage->forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT, false /* this region is already transformed */);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -1988,10 +1988,10 @@ CFramebuffer* CHyprOpenGLImpl::blurFramebufferWithDamage(float a, CRegion* origi
|
|||
glBindVertexArray(m_shaders->m_shBLURFINISH.uniformLocations[SHADER_SHADER_VAO]);
|
||||
|
||||
if (!damage.empty()) {
|
||||
for (auto const& RECT : damage.getRects()) {
|
||||
damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT, false /* this region is already transformed */);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -2347,16 +2347,16 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr
|
|||
damageClip.intersect(m_renderData.damage);
|
||||
|
||||
if (!damageClip.empty()) {
|
||||
for (auto const& RECT : damageClip.getRects()) {
|
||||
damageClip.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (auto const& RECT : m_renderData.damage.getRects()) {
|
||||
m_renderData.damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -2438,16 +2438,16 @@ void CHyprOpenGLImpl::renderBorder(const CBox& box, const CGradientValueData& gr
|
|||
damageClip.intersect(m_renderData.damage);
|
||||
|
||||
if (!damageClip.empty()) {
|
||||
for (auto const& RECT : damageClip.getRects()) {
|
||||
damageClip.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (auto const& RECT : m_renderData.damage.getRects()) {
|
||||
m_renderData.damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
|
@ -2508,16 +2508,16 @@ void CHyprOpenGLImpl::renderRoundedShadow(const CBox& box, int round, float roun
|
|||
damageClip.intersect(m_renderData.damage);
|
||||
|
||||
if (!damageClip.empty()) {
|
||||
for (auto const& RECT : damageClip.getRects()) {
|
||||
damageClip.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
for (auto const& RECT : m_renderData.damage.getRects()) {
|
||||
m_renderData.damage.forEachRect([this](const auto& RECT) {
|
||||
scissor(&RECT);
|
||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
glBindVertexArray(0);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue