mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 06:27:45 +00:00
Start refactoring graphics system to have per-window backing stores.
It was fun for everyone to share a single framebuffer but it was also kinda really awful. Let's move towards having a "GraphicsBitmap" as the backing store for each Window. This is going to need a lot of refactoring so let's get started.
This commit is contained in:
parent
2735b7e50d
commit
9963da9005
21 changed files with 212 additions and 41 deletions
|
@ -5,6 +5,7 @@
|
|||
#include "AbstractScreen.h"
|
||||
#include "TerminalWidget.h"
|
||||
#include "EventLoop.h"
|
||||
#include "FrameBufferSDL.h"
|
||||
|
||||
extern TerminalWidget* g_tw;
|
||||
|
||||
|
@ -131,6 +132,17 @@ void WindowManager::repaint()
|
|||
handlePaintEvent(*make<PaintEvent>());
|
||||
}
|
||||
|
||||
void WindowManager::did_paint(Window& window)
|
||||
{
|
||||
auto& framebuffer = FrameBufferSDL::the();
|
||||
framebuffer.blit({ 0, 0 }, *m_rootWidget->backing());
|
||||
for (auto* window : m_windows) {
|
||||
ASSERT(window->backing());
|
||||
framebuffer.blit(window->position(), *window->backing());
|
||||
}
|
||||
framebuffer.flush();
|
||||
}
|
||||
|
||||
void WindowManager::removeWindow(Window& window)
|
||||
{
|
||||
if (!m_windows.contains(&window))
|
||||
|
@ -239,7 +251,6 @@ void WindowManager::processMouseEvent(MouseEvent& event)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void WindowManager::handlePaintEvent(PaintEvent& event)
|
||||
|
@ -255,6 +266,14 @@ void WindowManager::handlePaintEvent(PaintEvent& event)
|
|||
|
||||
for (auto* window : m_windows)
|
||||
window->event(event);
|
||||
|
||||
auto& framebuffer = FrameBufferSDL::the();
|
||||
framebuffer.blit({ 0, 0 }, *m_rootWidget->backing());
|
||||
for (auto* window : m_windows) {
|
||||
ASSERT(window->backing());
|
||||
framebuffer.blit(window->position(), *window->backing());
|
||||
}
|
||||
framebuffer.flush();
|
||||
}
|
||||
|
||||
void WindowManager::event(Event& event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue