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
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue