summaryrefslogtreecommitdiff
path: root/src/render/Texture.cpp
diff options
context:
space:
mode:
authorTom Englund <tomenglund26@gmail.com>2025-07-30 11:54:09 +0200
committerGitHub <noreply@github.com>2025-07-30 11:54:09 +0200
commit36a8b2226f42c28092cb8f2d65c0a5ff0da4414f (patch)
treee1a37fe842b35e8b1d2f53ced3c8422b1e371964 /src/render/Texture.cpp
parent43966cc787c4a8844ac1e7affaadeedde8f4cc60 (diff)
renderer: use CRegion foreach over getRects (#10980)
instead of allocating and returning a vector, use forEach to directly call a function on the rects.
Diffstat (limited to 'src/render/Texture.cpp')
-rw-r--r--src/render/Texture.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/render/Texture.cpp b/src/render/Texture.cpp
index a6e29eaf..b9797751 100644
--- a/src/render/Texture.cpp
+++ b/src/render/Texture.cpp
@@ -118,14 +118,12 @@ void CTexture::update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, cons
bind();
- auto rects = damage.copy().intersect(CBox{{}, m_size}).getRects();
-
if (format->flipRB) {
setTexParameter(GL_TEXTURE_SWIZZLE_R, GL_BLUE);
setTexParameter(GL_TEXTURE_SWIZZLE_B, GL_RED);
}
- for (auto const& rect : rects) {
+ damage.copy().intersect(CBox{{}, m_size}).forEachRect([&format, &stride, &pixels](const auto& rect) {
GLCALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, stride / format->bytesPerBlock));
GLCALL(glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, rect.x1));
GLCALL(glPixelStorei(GL_UNPACK_SKIP_ROWS_EXT, rect.y1));
@@ -133,7 +131,7 @@ void CTexture::update(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, cons
int width = rect.x2 - rect.x1;
int height = rect.y2 - rect.y1;
GLCALL(glTexSubImage2D(GL_TEXTURE_2D, 0, rect.x1, rect.y1, width, height, format->glFormat, format->glType, pixels));
- }
+ });
GLCALL(glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, 0));
GLCALL(glPixelStorei(GL_UNPACK_SKIP_PIXELS_EXT, 0));