aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Sulfrian <alexander@sulfrian.net>2012-09-05 18:38:57 +0200
committerAlexander Sulfrian <alexander@sulfrian.net>2013-01-13 22:40:53 +0100
commitb4df2ee169fd31d40c86fcea0d472d7376074b10 (patch)
tree22fee2efaaa71e4c738a0048a3f4872f679cedfe
parent8405e8fb43392e7d0f9c77863e5789df05ec1df6 (diff)
downloadusdx-b4df2ee169fd31d40c86fcea0d472d7376074b10.tar.gz
usdx-b4df2ee169fd31d40c86fcea0d472d7376074b10.tar.xz
usdx-b4df2ee169fd31d40c86fcea0d472d7376074b10.zip
menu/drawable_control: always cache modelview matrix
Some controls modify the modelview matrix during drawing their contents. Restore it afterwards, so that other parts could be drawn easily on top.
-rw-r--r--src/menu/drawable_control.cpp29
1 files changed, 17 insertions, 12 deletions
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp
index 4d0d9c3c..298abdfe 100644
--- a/src/menu/drawable_control.cpp
+++ b/src/menu/drawable_control.cpp
@@ -27,6 +27,7 @@
#include "drawable_control.hpp"
#include "container.hpp"
#include "clipping_helper.hpp"
+#include "modelview_matrix_cache.hpp"
namespace usdx
{
@@ -87,18 +88,22 @@ namespace usdx
glTranslatef(position.get_x(), position.get_y(), 0.0f);
}
- boost::shared_lock<boost::shared_mutex> clipping_lock(clipping_required_mutex);
- if (clipping_required) {
- clipping_lock.unlock();
-
- boost::shared_lock<boost::shared_mutex> size_lock(size_mutex);
- boost::shared_lock<boost::shared_mutex> position_lock(position_mutex);
- ClippingHelper clipping(parent, Rectangle<int>(position, size));
- Drawable::repaint();
- }
- else {
- clipping_lock.unlock();
- Drawable::repaint();
+ {
+ ModelviewMatrixCache c;
+
+ boost::shared_lock<boost::shared_mutex> clipping_lock(clipping_required_mutex);
+ if (clipping_required) {
+ clipping_lock.unlock();
+
+ boost::shared_lock<boost::shared_mutex> size_lock(size_mutex);
+ boost::shared_lock<boost::shared_mutex> position_lock(position_mutex);
+ ClippingHelper clipping(parent, Rectangle<int>(position, size));
+ Drawable::repaint();
+ }
+ else {
+ clipping_lock.unlock();
+ Drawable::repaint();
+ }
}
}