From 8403dcf857c9cc639e8162edd5d4df4af07274bc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 26 Mar 2011 05:07:12 +0200 Subject: Precalculation vertexes for improving draw speed. Implemented in Software and fast OpenGL backends. Not all controls using this mode because some limitations. Known issue: impossible compile without opengl. Will be fixed in next commits. --- src/gui/widgets/window.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/gui/widgets/window.cpp') diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index 1037296b6..8c33b4787 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -24,6 +24,7 @@ #include "client.h" #include "configuration.h" +#include "graphicsvertexes.h" #include "log.h" #include "gui/gui.h" @@ -60,7 +61,9 @@ Window::Window(const std::string &caption, bool modal, Window *parent, mMinWinWidth(100), mMinWinHeight(40), mMaxWinWidth(graphics->getWidth()), - mMaxWinHeight(graphics->getHeight()) + mMaxWinHeight(graphics->getHeight()), + mVertexes(new GraphicsVertexes()), + mRedraw(true) { logger->log("Window::Window(\"%s\")", caption.c_str()); @@ -106,6 +109,8 @@ Window::~Window() // need mWidgets.clean ? removeWidgetListener(this); + delete mVertexes; + mVertexes = 0; instances--; @@ -125,7 +130,19 @@ void Window::draw(gcn::Graphics *graphics) Graphics *g = static_cast(graphics); - g->drawImageRect(0, 0, getWidth(), getHeight(), mSkin->getBorder()); + if (mRedraw) + { + mRedraw = false; + g->calcWindow(mVertexes, 0, 0, getWidth(), + getHeight(), mSkin->getBorder()); + } + + g->drawImageRect2(mVertexes, mSkin->getBorder()); + +/* + g->drawImageRect(0, 0, getWidth(), + getHeight(), mSkin->getBorder()); +*/ // Draw title if (mShowTitle) @@ -303,12 +320,19 @@ void Window::widgetResized(const gcn::Event &event _UNUSED_) getHeight() - mGrip->getHeight() - area.y); } + if (mLayout) { int w = area.width; int h = area.height; mLayout->reflow(w, h); } + mRedraw = true; +} + +void Window::widgetMoved(const gcn::Event& event _UNUSED_) +{ + mRedraw = true; } void Window::widgetHidden(const gcn::Event &event _UNUSED_) -- cgit v1.2.3-60-g2f50