From 2a3189f3e9cad900f6d25075931cdb5d8e14bed3 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sun, 28 Apr 2013 21:23:07 +0200 Subject: Some more rendering optimisations and a win32 resize fix. --- plugingui/window.cc | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugingui/window.cc b/plugingui/window.cc index 2426d9e..580a3c6 100644 --- a/plugingui/window.cc +++ b/plugingui/window.cc @@ -32,6 +32,7 @@ #include #include +#include #ifdef X11 #include "nativewindow_x11.h" @@ -44,7 +45,7 @@ GUI::Window *gwindow = NULL; GUI::Window::Window(GlobalContext *gctx) - : Widget(NULL), wpixbuf(1000, 1000), back(":bg.png"), logo(":logo.png") + : Widget(NULL), wpixbuf(100, 100), back(":bg.png"), logo(":logo.png") { gwindow = this; @@ -80,6 +81,8 @@ void GUI::Window::setCaption(std::string caption) void GUI::Window::repaintEvent(GUI::RepaintEvent *e) { + if(!visible()) return; + Painter p(this); p.drawImageStretched(0,0, &back, width(), height()); p.drawImage(width() - logo.width(), @@ -89,6 +92,14 @@ void GUI::Window::repaintEvent(GUI::RepaintEvent *e) void GUI::Window::resize(int width, int height) { if(width < 1 || height < 1) return; + +#ifdef WIN32 + // Fix to force buffer size reallocation + // FIXME: This should've been done indirectly through a WM_SIZE message in the + // EventHandler... + resized(width, height); +#endif + native->resize(width, height); Widget::resize(width, height); } @@ -161,6 +172,8 @@ void GUI::Window::updateBuffer() void GUI::Window::resized(size_t w, size_t h) { + if(_width == w && _height == h) return; + _width = w; _height = h; wpixbuf.realloc(w, h); -- cgit v1.2.3