summaryrefslogtreecommitdiff
path: root/src/gui/widgets/basiccontainer.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-05-25 21:47:57 +0300
committerAndrei Karas <akaras@inbox.ru>2015-05-25 21:47:57 +0300
commit1f4410ab9ac4064ff0cfb0fd31b4e942bee82277 (patch)
tree4b1089f8ba8b33b26fe74911d31ed2ae0f933824 /src/gui/widgets/basiccontainer.cpp
parentbea613d8ba11a64ccf36a01735f2839894ca9476 (diff)
downloadplus-1f4410ab9ac4064ff0cfb0fd31b4e942bee82277.tar.gz
plus-1f4410ab9ac4064ff0cfb0fd31b4e942bee82277.tar.bz2
plus-1f4410ab9ac4064ff0cfb0fd31b4e942bee82277.tar.xz
plus-1f4410ab9ac4064ff0cfb0fd31b4e942bee82277.zip
Add method safeDrawChildren for safe OpenGL renderer.
Diffstat (limited to 'src/gui/widgets/basiccontainer.cpp')
-rw-r--r--src/gui/widgets/basiccontainer.cpp45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/gui/widgets/basiccontainer.cpp b/src/gui/widgets/basiccontainer.cpp
index 6d09cb64b..cd1dac0a2 100644
--- a/src/gui/widgets/basiccontainer.cpp
+++ b/src/gui/widgets/basiccontainer.cpp
@@ -324,10 +324,47 @@ void BasicContainer::drawChildren(Graphics* graphics)
graphics->pushClipArea(widget->mDimension);
BLOCK_START("BasicContainer::drawChildren 2")
- if (isBatchDrawRenders(openGLMode))
- widget->draw(graphics);
- else
- widget->safeDraw(graphics);
+ widget->draw(graphics);
+ BLOCK_END("BasicContainer::drawChildren 2")
+ graphics->popClipArea();
+ }
+ }
+
+ graphics->popClipArea();
+ BLOCK_END("BasicContainer::drawChildren")
+}
+
+void BasicContainer::safeDrawChildren(Graphics* graphics)
+{
+ BLOCK_START("BasicContainer::drawChildren")
+ graphics->pushClipArea(getChildrenArea());
+
+ FOR_EACH (WidgetListConstIterator, iter, mWidgets)
+ {
+ Widget *const widget = *iter;
+ if (widget->isVisibleLocal())
+ {
+ // If the widget has a frame,
+ // draw it before drawing the widget
+ if (widget->mFrameSize > 0)
+ {
+ Rect rec = widget->mDimension;
+ const int frame = widget->mFrameSize;
+ const int frame2 = frame * 2;
+ rec.x -= frame;
+ rec.y -= frame;
+ rec.width += frame2;
+ rec.height += frame2;
+ graphics->pushClipArea(rec);
+ BLOCK_START("BasicContainer::drawChildren 1")
+ widget->drawFrame(graphics);
+ BLOCK_END("BasicContainer::drawChildren 1")
+ graphics->popClipArea();
+ }
+
+ graphics->pushClipArea(widget->mDimension);
+ BLOCK_START("BasicContainer::drawChildren 2")
+ widget->safeDraw(graphics);
BLOCK_END("BasicContainer::drawChildren 2")
graphics->popClipArea();
}