mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 02:12:09 -05:00
30 lines
630 B
C++
30 lines
630 B
C++
#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);
|
|
}
|