diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-12-01 19:20:32 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-12-01 22:58:18 +0300 |
commit | 8b27b94feb7edb3ff821a7f4cf4bcb97dd9f1082 (patch) | |
tree | 964557d875a7d994cb2125f0fd10c30a6fc38b03 /src/gui/widgets/window.cpp | |
parent | 212f1eaecc51ca4a112d0e1e22b4a02faec838f3 (diff) | |
download | ManaVerse-8b27b94feb7edb3ff821a7f4cf4bcb97dd9f1082.tar.gz ManaVerse-8b27b94feb7edb3ff821a7f4cf4bcb97dd9f1082.tar.bz2 ManaVerse-8b27b94feb7edb3ff821a7f4cf4bcb97dd9f1082.tar.xz ManaVerse-8b27b94feb7edb3ff821a7f4cf4bcb97dd9f1082.zip |
Add batch drawing to window.
Diffstat (limited to 'src/gui/widgets/window.cpp')
-rw-r--r-- | src/gui/widgets/window.cpp | 90 |
1 files changed, 64 insertions, 26 deletions
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp index ecf8f0f99..ba6d982c8 100644 --- a/src/gui/widgets/window.cpp +++ b/src/gui/widgets/window.cpp @@ -70,13 +70,14 @@ Window::Window(const std::string &caption, const bool modal, mMinWinHeight(40), mMaxWinWidth(mainGraphics->mWidth), mMaxWinHeight(mainGraphics->mHeight), - mVertexes(new GraphicsVertexes()), + mVertexes(new ImageCollection), mCaptionOffsetX(7), mCaptionOffsetY(5), mCaptionAlign(gcn::Graphics::LEFT), mTitlePadding(4), mGripPadding(2), mResizeHandles(-1), + mOldResizeHandles(-1), mRedraw(true), mPlayVisibleSound(false), mCaptionFont(getFont()) @@ -190,15 +191,71 @@ void Window::draw(gcn::Graphics *graphics) Graphics *const g = static_cast<Graphics*>(graphics); bool update = false; - if (mRedraw) + if (openGLMode != 2) { - mRedraw = false; - update = true; - g->calcWindow(mVertexes, 0, 0, mDimension.width, - mDimension.height, mSkin->getBorder()); + if (mResizeHandles != mOldResizeHandles) + { + mRedraw = true; + mOldResizeHandles = mResizeHandles; + } + if (mRedraw) + { + mRedraw = false; + update = true; + mVertexes->clear(); + g->calcWindow(mVertexes, 0, 0, mDimension.width, + mDimension.height, mSkin->getBorder()); + + // Draw Close Button + if (mCloseButton) + { + const Image *const button = mSkin->getCloseImage( + mResizeHandles == CLOSE); + if (button) + g->calcTile(mVertexes, button, mCloseRect.x, mCloseRect.y); + } + // Draw Sticky Button + if (mStickyButton) + { + const Image *const button = mSkin->getStickyImage(mSticky); + if (button) + { + g->calcTile(mVertexes, button, + mStickyRect.x, mStickyRect.y); + } + } + + if (mGrip) + g->calcTile(mVertexes, mGrip, mGripRect.x, mGripRect.y); + + } + + g->drawTile(mVertexes); } + else + { + g->drawImageRect(0, 0, mDimension.width, + mDimension.height, mSkin->getBorder()); + + // Draw Close Button + if (mCloseButton) + { + const Image *const button = mSkin->getCloseImage( + mResizeHandles == CLOSE); + if (button) + g->drawImage(button, mCloseRect.x, mCloseRect.y); + } + // Draw Sticky Button + if (mStickyButton) + { + const Image *const button = mSkin->getStickyImage(mSticky); + if (button) + g->drawImage(button, mStickyRect.x, mStickyRect.y); + } - g->drawImageRect2(mVertexes, mSkin->getBorder()); + if (mGrip) + g->drawImage(mGrip, mGripRect.x, mGripRect.y); + } // Draw title if (mShowTitle) @@ -209,25 +266,6 @@ void Window::draw(gcn::Graphics *graphics) static_cast<gcn::Graphics::Alignment>(mCaptionAlign)); } - // Draw Close Button - if (mCloseButton) - { - const Image *const button = mSkin->getCloseImage( - mResizeHandles == CLOSE); - if (button) - g->drawImage(button, mCloseRect.x, mCloseRect.y); - } - // Draw Sticky Button - if (mStickyButton) - { - const Image *const button = mSkin->getStickyImage(mSticky); - if (button) - g->drawImage(button, mStickyRect.x, mStickyRect.y); - } - - if (mGrip) - g->drawImage(mGrip, mGripRect.x, mGripRect.y); - if (update) { g->setRedraw(update); |