aboutsummaryrefslogtreecommitdiffstats
path: root/src/menu/drawable_control.cpp
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/menu/drawable_control.cpp30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/menu/drawable_control.cpp b/src/menu/drawable_control.cpp
index e67b4002..4d0d9c3c 100644
--- a/src/menu/drawable_control.cpp
+++ b/src/menu/drawable_control.cpp
@@ -62,18 +62,19 @@ namespace usdx
bool DrawableControl::get_clipping_required(void) const
{
+ boost::shared_lock<boost::shared_mutex> lock(clipping_required_mutex);
return clipping_required;
}
void DrawableControl::set_clipping_required(const bool value)
{
- boost::mutex::scoped_lock lock(clipping_required_mutex);
+ boost::unique_lock<boost::shared_mutex> lock(clipping_required_mutex);
clipping_required = value;
}
void DrawableControl::draw(void)
{
- boost::mutex::scoped_lock lock(background_mutex);
+ boost::shared_lock<boost::shared_mutex> lock(background_mutex);
if (background) {
background->repaint();
}
@@ -82,16 +83,16 @@ namespace usdx
void DrawableControl::repaint(void)
{
{
- // position
- boost::mutex::scoped_lock lock(position_mutex);
+ boost::shared_lock<boost::shared_mutex> lock(position_mutex);
glTranslatef(position.get_x(), position.get_y(), 0.0f);
}
- boost::mutex::scoped_lock clipping_lock(clipping_required_mutex);
+ boost::shared_lock<boost::shared_mutex> clipping_lock(clipping_required_mutex);
if (clipping_required) {
clipping_lock.unlock();
- boost::mutex::scoped_lock lock(size_mutex);
+ 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();
}
@@ -103,58 +104,64 @@ namespace usdx
void DrawableControl::set_position(const Point<int>& position)
{
- boost::mutex::scoped_lock lock(position_mutex);
+ boost::unique_lock<boost::shared_mutex> lock(position_mutex);
this->position = position;
}
void DrawableControl::set_position(int left, int top)
{
- boost::mutex::scoped_lock lock(position_mutex);
+ boost::unique_lock<boost::shared_mutex> lock(position_mutex);
this->position = Point<int>(left, top);
}
const Point<int>& DrawableControl::get_position(void) const
{
+ boost::shared_lock<boost::shared_mutex> lock(position_mutex);
return position;
}
int DrawableControl::get_left(void) const
{
+ boost::shared_lock<boost::shared_mutex> lock(position_mutex);
return position.get_x();
}
int DrawableControl::get_top(void) const
{
+ boost::shared_lock<boost::shared_mutex> lock(position_mutex);
return position.get_y();
}
void DrawableControl::set_size(const Dimension<int> &size)
{
- boost::mutex::scoped_lock lock(size_mutex);
+ boost::unique_lock<boost::shared_mutex> lock(size_mutex);
this->size = size;
}
void DrawableControl::set_size(int width, int height)
{
- boost::mutex::scoped_lock lock(size_mutex);
+ boost::unique_lock<boost::shared_mutex> lock(size_mutex);
this->size = Dimension<int>(width, height);
}
const Dimension<int>& DrawableControl::get_size(void) const
{
+ boost::shared_lock<boost::shared_mutex> lock(size_mutex);
return size;
}
int DrawableControl::get_width(void) const
{
+ boost::shared_lock<boost::shared_mutex> lock(size_mutex);
return size.get_width();
}
int DrawableControl::get_height(void) const
{
+ boost::shared_lock<boost::shared_mutex> lock(size_mutex);
return size.get_height();
}
@@ -180,7 +187,7 @@ namespace usdx
void DrawableControl::set_background(Background* background)
{
- boost::mutex::scoped_lock lock(background_mutex);
+ boost::unique_lock<boost::shared_mutex> lock(background_mutex);
if (this->background) {
delete this->background;
}
@@ -190,6 +197,7 @@ namespace usdx
const Background* DrawableControl::get_background(void) const
{
+ boost::shared_lock<boost::shared_mutex> lock(background_mutex);
return background;
}
};