diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-16 14:20:04 -0400 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2013-04-16 14:20:04 -0400 |
commit | ef60401d92fa2300a419544dae47375d72217ae8 (patch) | |
tree | de1977498159f235bb8eeb47bfae6046c5a3bc10 /libs/canvas/image.cc | |
parent | ccc9b6adee762bc1e899bf5bcba7941d2e7d6db4 (diff) |
(hopefully) fix double-buffering design of ArdourCanvas::Image
Diffstat (limited to 'libs/canvas/image.cc')
-rw-r--r-- | libs/canvas/image.cc | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/libs/canvas/image.cc b/libs/canvas/image.cc index 26bc35eb37..71a5df64dd 100644 --- a/libs/canvas/image.cc +++ b/libs/canvas/image.cc @@ -35,19 +35,20 @@ Image::Image (Group* group, Cairo::Format fmt, int width, int height) void Image::render (Rect const& area, Cairo::RefPtr<Cairo::Context> context) const { - if (_current) { - _surface = Cairo::ImageSurface::create (_current->data.get(), - _current->format, - _current->width, - _current->height, - _current->stride); + if (_need_render && _pending) { + _surface = Cairo::ImageSurface::create (_pending->data.get(), + _pending->format, + _pending->width, + _pending->height, + _pending->stride); + _current = _pending; } - _current.reset (); - - context->set_source (_surface, 0, 0); - context->rectangle (area.x0, area.y0, area.width(), area.height()); - context->fill (); + if (_surface) { + context->set_source (_surface, 0, 0); + context->rectangle (area.x0, area.y0, area.width(), area.height()); + context->fill (); + } } void @@ -83,11 +84,7 @@ 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 } |