mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
Kernel: VirtIO framebuffer should clamp pending dirty rects if needed
If we change to a resolution smaller than what any pending dirty rectangles contain, we need to clamp them to the new resolution.
This commit is contained in:
parent
8a6f69f2c8
commit
5ae42736f8
1 changed files with 8 additions and 0 deletions
|
@ -73,6 +73,14 @@ void FrameBufferDevice::create_buffer(Buffer& buffer, size_t framebuffer_offset,
|
|||
if (&buffer == m_current_buffer)
|
||||
flush_displayed_image(info.rect, buffer);
|
||||
|
||||
// Make sure we constrain the existing dirty rect (if any)
|
||||
if (buffer.dirty_rect.width != 0 || buffer.dirty_rect.height != 0) {
|
||||
auto dirty_right = buffer.dirty_rect.x + buffer.dirty_rect.width;
|
||||
auto dirty_bottom = buffer.dirty_rect.y + buffer.dirty_rect.height;
|
||||
buffer.dirty_rect.width = min(dirty_right, info.rect.x + info.rect.width) - buffer.dirty_rect.x;
|
||||
buffer.dirty_rect.height = min(dirty_bottom, info.rect.y + info.rect.height) - buffer.dirty_rect.y;
|
||||
}
|
||||
|
||||
info.enabled = 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue