From f99569872f391ee0090348bf58d4a2a43c549eda Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 25 May 2015 17:05:47 +0300 Subject: Add basic support for draw controls method without batching (safeDraw). --- src/gui/gui.cpp | 18 +++++++++++++++--- src/gui/widgets/widget.h | 3 +++ 2 files changed, 18 insertions(+), 3 deletions(-) (limited to 'src/gui') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index d54a924f1..49b6d2774 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -83,6 +83,8 @@ #include "input/inputmanager.h" +#include "render/renderers.h" + #include "resources/imageset.h" #include "resources/resourcemanager.h" @@ -452,9 +454,19 @@ bool Gui::handleKeyInput() void Gui::draw() { BLOCK_START("Gui::draw 1") - mGraphics->pushClipArea(getTop()->getDimension()); - getTop()->draw(mGraphics); - touchManager.draw(); + Widget *const top = getTop(); + mGraphics->pushClipArea(top->getDimension()); + + if (isBatchDrawRenders(openGLMode)) + { + top->draw(mGraphics); + touchManager.draw(); + } + else + { + top->safeDraw(mGraphics); + touchManager.safeDraw(); + } int mouseX; int mouseY; diff --git a/src/gui/widgets/widget.h b/src/gui/widgets/widget.h index 8191754e5..86e54510f 100644 --- a/src/gui/widgets/widget.h +++ b/src/gui/widgets/widget.h @@ -122,6 +122,9 @@ class Widget notfinal : public Widget2 */ virtual void draw(Graphics* graphics) = 0; + virtual void safeDraw(Graphics* graphics) + { draw(graphics); } + /** * Called when a widget is given a chance to draw a frame around itself. * The frame is not considered a part of the widget, it only allows a frame -- cgit v1.2.3-70-g09d2