1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 03:47:34 +00:00

Optimize WindowManager::flush() with fast_dword_copy().

This commit is contained in:
Andreas Kling 2019-01-12 21:45:45 +01:00
parent 6b4e88b515
commit edc827077e
5 changed files with 40 additions and 35 deletions

View file

@ -346,10 +346,14 @@ void WindowManager::flush(const Rect& a_rect)
{
auto rect = Rect::intersection(a_rect, m_screen_rect);
for (int y = rect.top(); y <= rect.bottom(); ++y) {
auto* front_scanline = m_front_bitmap->scanline(y);
auto* back_scanline = m_back_bitmap->scanline(y);
memcpy(front_scanline + rect.x(), back_scanline + rect.x(), rect.width() * sizeof(RGBA32));
RGBA32* front_ptr = m_front_bitmap->scanline(rect.y()) + rect.x();
const RGBA32* back_ptr = m_back_bitmap->scanline(rect.y()) + rect.x();
size_t pitch = m_back_bitmap->pitch();
for (int y = 0; y < rect.height(); ++y) {
fast_dword_copy(front_ptr, back_ptr, rect.width());
front_ptr = (RGBA32*)((byte*)front_ptr + pitch);
back_ptr = (const RGBA32*)((const byte*)back_ptr + pitch);
}
m_framebuffer.flush();