mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:37:46 +00:00
LibSoftGPU: Use memcpy
instead of a loop to blit the color buffer
Looking at `Tubes` before and after this change, comparing the original loop to the one using `memcpy`, including the time for `memcpy` itself, resulted in ~15% fewer samples in profiles on my machine.
This commit is contained in:
parent
bfb4e08612
commit
e9d2f9a95e
1 changed files with 1 additions and 4 deletions
|
@ -42,10 +42,7 @@ public:
|
||||||
for (int y = target.bottom(); y >= target.top(); --y) {
|
for (int y = target.bottom(); y >= target.top(); --y) {
|
||||||
auto const* buffer_scanline = scanline(source_y++);
|
auto const* buffer_scanline = scanline(source_y++);
|
||||||
auto* bitmap_scanline = bitmap.scanline(y);
|
auto* bitmap_scanline = bitmap.scanline(y);
|
||||||
|
memcpy(bitmap_scanline + target.left(), buffer_scanline, sizeof(u32) * target.width());
|
||||||
int source_x = 0;
|
|
||||||
for (int x = target.left(); x <= target.right(); ++x)
|
|
||||||
bitmap_scanline[x] = buffer_scanline[source_x++];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue