From cec1d9ea562e3d52c98f1219db5e186943f2f0d6 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 12 Feb 2017 11:07:22 +0100 Subject: Refactor/introduce widget and windiow redraw/dirty mechanism to eradicate unnecessary rendering passes during event handling. --- plugingui/painter.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) (limited to 'plugingui/painter.cc') diff --git a/plugingui/painter.cc b/plugingui/painter.cc index 3e6fa48..4e7e8ba 100644 --- a/plugingui/painter.cc +++ b/plugingui/painter.cc @@ -29,6 +29,12 @@ #include #include +#include "pixelbuffer.h" +#include "font.h" +#include "drawable.h" +#include "image.h" +#include "canvas.h" + namespace GUI { @@ -36,14 +42,11 @@ Painter::Painter(Canvas& canvas) : canvas(canvas) , pixbuf(canvas.GetPixelBuffer()) { - canvas.beginPaint(); colour = Colour(0.0f, 0.0f, 0.0f, 0.5f); } Painter::~Painter() { - canvas.endPaint(); - flush(); } void Painter::setColour(const Colour& colour) @@ -161,7 +164,7 @@ void Painter::drawRectangle(int x1, int y1, int x2, int y2) void Painter::drawFilledRectangle(int x1, int y1, int x2, int y2) { - for(int y = y1; y < y2; ++y) + for(int y = y1; y <= y2; ++y) { drawLine(x1, y, x2, y); } @@ -543,12 +546,4 @@ void Painter::drawBar(int x, int y, const Bar& bar, int width, int height) bar.right->width(), height); } -void Painter::flush() -{ -#ifdef X11 - // Send the "DrawLine" request to the server - //XFlush(gctx->display); -#endif/*X11*/ -} - } // GUI:: -- cgit v1.2.3