summaryrefslogtreecommitdiff
path: root/libs/canvas/image.cc
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2013-04-15 22:34:36 -0400
committerPaul Davis <paul@linuxaudiosystems.com>2013-04-15 22:34:36 -0400
commitbe23e48e7f11a806eef043313606d62856abeb40 (patch)
tree05867d22fb858985d66e6fbb04e7a3cae58b12d4 /libs/canvas/image.cc
parent37dd7e952bd084cd35a4c4f67949890ee3e7c152 (diff)
add some comments to Canvas::Image and ensure that the canvas redraws after a put_image() call is handled in the GUI thread
Diffstat (limited to 'libs/canvas/image.cc')
-rw-r--r--libs/canvas/image.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/libs/canvas/image.cc b/libs/canvas/image.cc
index 22ef042cfb..26bc35eb37 100644
--- a/libs/canvas/image.cc
+++ b/libs/canvas/image.cc
@@ -60,6 +60,8 @@ Image::compute_bounding_box () const
boost::shared_ptr<Image::Data>
Image::get_image ()
{
+ /* can be called by any thread */
+
int stride = Cairo::ImageSurface::format_stride_for_width (_format, _width);
boost::shared_ptr<Data> d (new Data (boost::shared_array<uint8_t> (new uint8_t[stride*_height]), _width, _height, stride, _format));
@@ -69,6 +71,8 @@ Image::get_image ()
void
Image::put_image (boost::shared_ptr<Data> d)
{
+ /* can be called by any thread */
+
_pending = d;
DataReady (); /* EMIT SIGNAL */
}
@@ -77,8 +81,13 @@ void
Image::accept_data ()
{
/* must be executed in gui thread */
+
+ begin_change ();
+
_current = _pending;
_pending.reset ();
_need_render = true;
+
+ end_change (); // notify canvas that we need redrawing
}