From 36a8b2226f42c28092cb8f2d65c0a5ff0da4414f Mon Sep 17 00:00:00 2001 From: Tom Englund Date: Wed, 30 Jul 2025 11:54:09 +0200 Subject: renderer: use CRegion foreach over getRects (#10980) instead of allocating and returning a vector, use forEach to directly call a function on the rects. --- src/protocols/core/Compositor.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/protocols/core') diff --git a/src/protocols/core/Compositor.cpp b/src/protocols/core/Compositor.cpp index 10b554f6..bbb76cb2 100644 --- a/src/protocols/core/Compositor.cpp +++ b/src/protocols/core/Compositor.cpp @@ -606,14 +606,14 @@ void CWLSurfaceResource::updateCursorShm(CRegion damage) { if (const auto RECTS = damage.getRects(); RECTS.size() == 1 && RECTS.at(0).x2 == buf->size.x && RECTS.at(0).y2 == buf->size.y) memcpy(shmData.data(), pixelData, bufLen); else { - for (auto& box : damage.getRects()) { + damage.forEachRect([&pixelData, &shmData](const auto& box) { for (auto y = box.y1; y < box.y2; ++y) { // bpp is 32 INSALLAH auto begin = 4 * box.y1 * (box.x2 - box.x1) + box.x1; auto len = 4 * (box.x2 - box.x1); memcpy((uint8_t*)shmData.data() + begin, (uint8_t*)pixelData + begin, len); } - } + }); } } -- cgit v1.2.3