mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:57:35 +00:00
Intense hacking on Widgets.
This commit is contained in:
parent
8c84f9749e
commit
6f37429f57
20 changed files with 290 additions and 5 deletions
30
Widgets/Painter.cpp
Normal file
30
Widgets/Painter.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
#include "Painter.h"
|
||||
#include "FrameBufferSDL.h"
|
||||
#include "Widget.h"
|
||||
#include <AK/Assertions.h>
|
||||
#include <SDL.h>
|
||||
|
||||
Painter::Painter(Widget& widget)
|
||||
: m_widget(widget)
|
||||
{
|
||||
}
|
||||
|
||||
Painter::~Painter()
|
||||
{
|
||||
int rc = SDL_UpdateWindowSurface(FrameBufferSDL::the().window());
|
||||
ASSERT(rc == 0);
|
||||
}
|
||||
|
||||
void Painter::fillRect(Rect rect, Color color)
|
||||
{
|
||||
rect.moveBy(m_widget.x(), m_widget.y());
|
||||
|
||||
SDL_Rect sdlRect;
|
||||
sdlRect.x = rect.x();
|
||||
sdlRect.y = rect.y();
|
||||
sdlRect.w = rect.width();
|
||||
sdlRect.h = rect.height();
|
||||
|
||||
int rc = SDL_FillRect(FrameBufferSDL::the().surface(), &sdlRect, color.value());
|
||||
ASSERT(rc == 0);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue