From 004f4e8ad24087051cafd5b79e9abfafa577f24d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 May 2015 18:12:50 +0300 Subject: Add safeDraw method into scrollarea. --- src/gui/widgets/scrollarea.cpp | 99 ++++++++++++++++++++++++------------------ 1 file changed, 57 insertions(+), 42 deletions(-) (limited to 'src/gui/widgets/scrollarea.cpp') 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(); -- cgit v1.2.3-60-g2f50