diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-05-25 18:12:50 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-05-25 18:12:50 +0300 |
commit | 004f4e8ad24087051cafd5b79e9abfafa577f24d (patch) | |
tree | 3fc51552e443ae298858bae520fd2d5c38532c85 /src/gui | |
parent | 9569e469a481076bdbc330377bf8445eb32fbaa6 (diff) | |
download | mv-004f4e8ad24087051cafd5b79e9abfafa577f24d.tar.gz mv-004f4e8ad24087051cafd5b79e9abfafa577f24d.tar.bz2 mv-004f4e8ad24087051cafd5b79e9abfafa577f24d.tar.xz mv-004f4e8ad24087051cafd5b79e9abfafa577f24d.zip |
Add safeDraw method into scrollarea.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/scrollarea.cpp | 99 | ||||
-rw-r--r-- | src/gui/widgets/scrollarea.h | 2 |
2 files changed, 59 insertions, 42 deletions
diff --git a/src/gui/widgets/scrollarea.cpp b/src/gui/widgets/scrollarea.cpp index 924546329..3da38aaeb 100644 --- a/src/gui/widgets/scrollarea.cpp +++ b/src/gui/widgets/scrollarea.cpp @@ -318,63 +318,78 @@ void ScrollArea::draw(Graphics *graphics) BLOCK_START("ScrollArea::draw") if (mVBarVisible || mHBarVisible) { - if (isBatchDrawRenders(openGLMode)) - { - if (!mOpaque) - updateCalcFlag(graphics); - // need add caching or remove calc calls. -// if (mRedraw) - { - mVertexes->clear(); - if (mVBarVisible) - { - if (mShowButtons) - { - calcButton(graphics, UP); - calcButton(graphics, DOWN); - } - calcVBar(graphics); - calcVMarker(graphics); - } - - if (mHBarVisible) - { - if (mShowButtons) - { - calcButton(graphics, LEFT); - calcButton(graphics, RIGHT); - } - calcHBar(graphics); - calcHMarker(graphics); - } - graphics->finalize(mVertexes); - } - graphics->drawTileCollection(mVertexes); - } - else + if (!mOpaque) + updateCalcFlag(graphics); + // need add caching or remove calc calls. +// if (mRedraw) { + mVertexes->clear(); if (mVBarVisible) { if (mShowButtons) { - drawButton(graphics, UP); - drawButton(graphics, DOWN); + calcButton(graphics, UP); + calcButton(graphics, DOWN); } - drawVBar(graphics); - drawVMarker(graphics); + calcVBar(graphics); + calcVMarker(graphics); } if (mHBarVisible) { if (mShowButtons) { - drawButton(graphics, LEFT); - drawButton(graphics, RIGHT); + calcButton(graphics, LEFT); + calcButton(graphics, RIGHT); } - drawHBar(graphics); - drawHMarker(graphics); + calcHBar(graphics); + calcHMarker(graphics); } + graphics->finalize(mVertexes); + } + graphics->drawTileCollection(mVertexes); + } + + updateAlpha(); + + if (mRedraw) + { + const bool redraw = graphics->getRedraw(); + graphics->setRedraw(true); + drawChildren(graphics); + graphics->setRedraw(redraw); + } + else + { + drawChildren(graphics); + } + mRedraw = false; + BLOCK_END("ScrollArea::draw") +} + +void ScrollArea::safeDraw(Graphics *graphics) +{ + BLOCK_START("ScrollArea::draw") + if (mVBarVisible) + { + if (mShowButtons) + { + drawButton(graphics, UP); + drawButton(graphics, DOWN); + } + drawVBar(graphics); + drawVMarker(graphics); + } + + if (mHBarVisible) + { + if (mShowButtons) + { + drawButton(graphics, LEFT); + drawButton(graphics, RIGHT); } + drawHBar(graphics); + drawHMarker(graphics); } updateAlpha(); diff --git a/src/gui/widgets/scrollarea.h b/src/gui/widgets/scrollarea.h index 74f86f3a2..d0e3bca92 100644 --- a/src/gui/widgets/scrollarea.h +++ b/src/gui/widgets/scrollarea.h @@ -139,6 +139,8 @@ class ScrollArea final : public BasicContainer, */ void draw(Graphics *graphics) override final; + void safeDraw(Graphics *graphics) override final; + /** * Draws the background and border of the scroll area. */ |