diff options
author | Andrei Karas <akaras@inbox.ru> | 2011-03-26 05:07:12 +0200 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2011-03-26 05:50:44 +0200 |
commit | 8403dcf857c9cc639e8162edd5d4df4af07274bc (patch) | |
tree | 2f127213e0df4691b06c549a8f20b3d5225b9220 /src/gui/widgets/window.cpp | |
parent | fc24490f1ecd186f3c294915fadee62c3053d841 (diff) | |
download | mv-8403dcf857c9cc639e8162edd5d4df4af07274bc.tar.gz mv-8403dcf857c9cc639e8162edd5d4df4af07274bc.tar.bz2 mv-8403dcf857c9cc639e8162edd5d4df4af07274bc.tar.xz mv-8403dcf857c9cc639e8162edd5d4df4af07274bc.zip |
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.
Diffstat (limited to 'src/gui/widgets/window.cpp')
-rw-r--r-- | src/gui/widgets/window.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
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*>(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_) |