1
Fork 0
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:
Andreas Kling 2018-10-10 16:49:36 +02:00
parent 8c84f9749e
commit 6f37429f57
20 changed files with 290 additions and 5 deletions

30
Widgets/Painter.cpp Normal file
View 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);
}