From e3672baa9a0d62ffcc1cb693cbb94644755b6d58 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 May 2015 17:21:15 +0300 Subject: Add safeDraw method into popup. --- src/gui/widgets/popup.cpp | 40 +++++++++++++++++++++++----------------- src/gui/widgets/popup.h | 2 ++ 2 files changed, 25 insertions(+), 17 deletions(-) (limited to 'src/gui/widgets') diff --git a/src/gui/widgets/popup.cpp b/src/gui/widgets/popup.cpp index 7383ac94b..2e9b3b99b 100644 --- a/src/gui/widgets/popup.cpp +++ b/src/gui/widgets/popup.cpp @@ -108,33 +108,39 @@ void Popup::draw(Graphics *graphics) if (mSkin) { - if (isBatchDrawRenders(openGLMode)) + if (mRedraw) { - if (mRedraw) - { - mRedraw = false; - mVertexes->clear(); - graphics->calcWindow(mVertexes, - 0, 0, - mDimension.width, mDimension.height, - mSkin->getBorder()); - } - // need cache or remove calc call. - graphics->finalize(mVertexes); - graphics->drawTileCollection(mVertexes); - } - else - { - graphics->drawImageRect(0, 0, + mRedraw = false; + mVertexes->clear(); + graphics->calcWindow(mVertexes, + 0, 0, mDimension.width, mDimension.height, mSkin->getBorder()); } + // need cache or remove calc call. + graphics->finalize(mVertexes); + graphics->drawTileCollection(mVertexes); } drawChildren(graphics); BLOCK_END("Popup::draw") } +void Popup::safeDraw(Graphics *graphics) +{ + BLOCK_START("Popup::safeDraw") + + if (mSkin) + { + graphics->drawImageRect(0, 0, + mDimension.width, mDimension.height, + mSkin->getBorder()); + } + + drawChildren(graphics); + BLOCK_END("Popup::safeDraw") +} + Rect Popup::getChildrenArea() { const int pad2 = mPadding * 2; diff --git a/src/gui/widgets/popup.h b/src/gui/widgets/popup.h index f39a92ec0..d1dbb4829 100644 --- a/src/gui/widgets/popup.h +++ b/src/gui/widgets/popup.h @@ -78,6 +78,8 @@ class Popup notfinal : public Container, */ void draw(Graphics *graphics) override; + void safeDraw(Graphics *graphics) override; + /** * Sets the size of this popup. */ -- cgit v1.2.3-60-g2f50