vtl: make videotimeline work with new cairo canvas
authorRobin Gareus <robin@gareus.org>
Sat, 6 Apr 2013 02:09:58 +0000 (04:09 +0200)
committerRobin Gareus <robin@gareus.org>
Sat, 6 Apr 2013 02:10:27 +0000 (04:10 +0200)
timeline thumbnail display, moving (drag/drop) and zoom works.

There still some crashes e.g. resizing the height of the timeline
and with off-screen image buffering when zooming in.
Likely due to concurrency issues:
VideoImageFrame::exposeimg() and direct access of the pixbuf:
"Assertion `!_bounding_box_dirty' failed." in canvas/item.cc:191

more work is needed..

gtk2_ardour/editor_canvas.cc
gtk2_ardour/editor_rulers.cc
gtk2_ardour/editor_videotimeline.cc
gtk2_ardour/video_image_frame.cc
gtk2_ardour/video_image_frame.h
gtk2_ardour/video_timeline.cc
gtk2_ardour/video_timeline.h

index 4b9b21dc5cbd345b3506fce30bd09fd6b8c693bb..48aeb1aeb32d45908571323676f4128b41cb9432 100644 (file)
@@ -151,20 +151,13 @@ Editor::initialize_canvas ()
        marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, timebar_height));
        cd_marker_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple (0.0, 0.0));
 #ifdef WITH_VIDEOTIMELINE
-       videotl_group = new ArdourCanvas::Group (_time_markers_group, 0.0, 0.0);
+       videotl_group = new ArdourCanvas::Group (_time_markers_group, ArdourCanvas::Duple(0.0, 0.0));
 #endif
 
 
 #ifdef WITH_VIDEOTIMELINE
-       videotl_bar_group = new ArdourCanvas::Group (track_canvas->root ());
-       if (Profile->get_sae()) {
-               videotl_bar = new ArdourCanvas::Rectangle (videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height - 1));
-               videotl_bar->property_outline_pixels() = 1;
-       } else {
-               videotl_bar = new ArdourCanvas::Rectangle (videotl_bar_group, 0.0, 0.0, phys_width, (timebar_height * videotl_bar_height));
-               videotl_bar->property_outline_pixels() = 0;
-       }
-       videotl_bar->property_outline_what() = (0x1 | 0x8);
+       videotl_bar_group = new ArdourCanvas::Group (_time_bars_canvas->root ());
+       videotl_bar = new ArdourCanvas::Rectangle (videotl_bar_group, ArdourCanvas::Rect (0.0, 0.0, 100,(timebar_height * videotl_bar_height)));
        ARDOUR_UI::instance()->video_timeline = new VideoTimeLine(this, videotl_bar_group, (timebar_height * videotl_bar_height));
 #endif
 
index 5047feb1cbe6c4895db7a55e988eacae32a3766e..dd13e153b52b395a7a5c12870e7813d2ce417814 100644 (file)
@@ -791,13 +791,13 @@ Editor::update_ruler_visibility ()
 #ifdef WITH_VIDEOTIMELINE
 
        if (ruler_video_action->get_active()) {
-               old_unit_pos = videotl_group->property_y();
+               old_unit_pos = videotl_group->position().y;
                if (tbpos != old_unit_pos) {
-                       videotl_group->move ( 0.0, tbpos - old_unit_pos);
+                       videotl_group->move (ArdourCanvas::Duple (0.0, tbpos - old_unit_pos));
                }
-               old_unit_pos = videotl_bar_group->property_y();
+               old_unit_pos = videotl_bar_group->position().y;
                if (tbgpos != old_unit_pos) {
-                       videotl_bar_group->move ( 0.0, tbgpos - old_unit_pos);
+                       videotl_bar_group->move (ArdourCanvas::Duple (0.0, tbgpos - old_unit_pos));
                }
                videotl_bar_group->show();
                videotl_group->show();
index 564e3016e78be7d2f6cedd8e65e8664269de757c..a4a0b1b2109a25a16b33a229dfb9468cd529d38f 100644 (file)
@@ -28,8 +28,7 @@
 
 #include "ardour_ui.h"
 #include "editor.h"
-#include "simplerect.h"
-#include "canvas_impl.h"
+#include "canvas/rectangle.h"
 #include "editing.h"
 #include "audio_time_axis.h"
 #include "video_image_frame.h"
@@ -49,7 +48,7 @@ Editor::set_video_timeline_height (const int h)
   videotl_bar_height = h;
        const double nh = (videotl_bar_height * timebar_height - ((ARDOUR::Profile->get_sae())?1.0:0.0));
        videotl_label.set_size_request (-1, (int)timebar_height * videotl_bar_height);
-       videotl_bar->property_y2().set_value(nh);
+       videotl_bar->set_y1(nh);
        ARDOUR_UI::instance()->video_timeline->set_height(videotl_bar_height * timebar_height);
        update_ruler_visibility();
 }
index cc964c7e43e0cc8231c517ed671757a8900418f6..f04a23bf04b5dc81f0016b36da55181d1733eb87 100644 (file)
@@ -26,8 +26,7 @@
 #include "video_image_frame.h"
 #include "public_editor.h"
 #include "utils.h"
-#include "canvas_impl.h"
-#include "simpleline.h"
+#include "canvas/group.h"
 #include "rgb_macros.h"
 #include "utils_videotl.h"
 
@@ -60,20 +59,20 @@ VideoImageFrame::VideoImageFrame (PublicEditor& ed, ArdourCanvas::Group& parent,
 #endif
 
        unit_position = editor.frame_to_unit (frame_position);
-       group = new Group (parent, unit_position, 1.0);
-       img_pixbuf = new ArdourCanvas::Pixbuf(*group);
+       group = new ArdourCanvas::Group (_parent, ArdourCanvas::Duple(unit_position, 1.0));
+       img_pixbuf = new ArdourCanvas::Pixbuf(group);
 
        Glib::RefPtr<Gdk::Pixbuf> img;
 
        img = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, clip_width, clip_height);
        img->fill(RGBA_TO_UINT(0,0,0,255));
-       img_pixbuf->property_pixbuf() = img;
+       img_pixbuf->set(img);
 
        draw_line();
-       video_draw_cross(img_pixbuf->property_pixbuf());
+       video_draw_cross(img_pixbuf->pixbuf());
+       img_pixbuf->set(img_pixbuf->pixbuf());
 
-       group->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
-       //img_pixbuf->signal_event().connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
+       group->Event.connect (sigc::bind (sigc::mem_fun (editor, &PublicEditor::canvas_videotl_bar_event), _parent));
 }
 
 VideoImageFrame::~VideoImageFrame ()
@@ -89,7 +88,7 @@ void
 VideoImageFrame::set_position (framepos_t frame)
 {
        double new_unit_position = editor.frame_to_unit (frame);
-       group->move (new_unit_position - unit_position, 0.0);
+       group->move (ArdourCanvas::Duple (new_unit_position - unit_position, 0.0));
        frame_position = frame;
        unit_position = new_unit_position;
 }
@@ -119,16 +118,17 @@ VideoImageFrame::set_videoframe (framepos_t videoframenumber, int re)
 #if 0 /* dummy mode: print framenumber */
        gchar buf[16];
        snprintf (buf, sizeof(buf), "%li", (long int) videoframenumber);
-       img_pixbuf->property_pixbuf() = pixbuf_from_ustring(g_strdup (buf), get_font_for_style (N_("MarkerText")), 80, 60, Gdk::Color ("#C0C0C0"));
+       img_pixbuf->pixbuf() = pixbuf_from_ustring(g_strdup (buf), get_font_for_style (N_("MarkerText")), 80, 60, Gdk::Color ("#C0C0C0"));
        return;
 #endif
 #if 1 /* draw "empty frame" while we request the data */
        Glib::RefPtr<Gdk::Pixbuf> img;
-       img = img_pixbuf->property_pixbuf();
+       img = img_pixbuf->pixbuf();
        img->fill(RGBA_TO_UINT(0,0,0,255));
-       video_draw_cross(img_pixbuf->property_pixbuf());
+       video_draw_cross(img_pixbuf->pixbuf());
        draw_line();
        cut_rightend();
+       img_pixbuf->set(img);
        exposeimg();
 #endif
        /* request video-frame from decoder in background thread */
@@ -139,7 +139,7 @@ void
 VideoImageFrame::draw_line ()
 {
        Glib::RefPtr<Gdk::Pixbuf> img;
-       img = img_pixbuf->property_pixbuf();
+       img = img_pixbuf->pixbuf();
 
        int rowstride = img->get_rowstride();
        int clip_height = img->get_height();
@@ -160,7 +160,7 @@ VideoImageFrame::cut_rightend ()
 {
        if (rightend < 0 ) { return; }
        Glib::RefPtr<Gdk::Pixbuf> img;
-       img = img_pixbuf->property_pixbuf();
+       img = img_pixbuf->pixbuf();
 
        int rowstride = img->get_rowstride();
        int clip_height = img->get_height();
@@ -222,12 +222,13 @@ VideoImageFrame::http_download_done (char *data){
        if (!data) {
                /* Image request failed (HTTP error or timeout) */
                Glib::RefPtr<Gdk::Pixbuf> img;
-               img = img_pixbuf->property_pixbuf();
+               img = img_pixbuf->pixbuf();
                img->fill(RGBA_TO_UINT(128,0,0,255));
-               video_draw_cross(img_pixbuf->property_pixbuf());
+               video_draw_cross(img_pixbuf->pixbuf());
                cut_rightend();
                draw_line();
                cut_rightend();
+               img_pixbuf->set(img);
                /* TODO: mark as invalid:
                 * video_frame_number = -1;
                 * TODO: but prevent live-loops when calling update again
@@ -239,11 +240,12 @@ VideoImageFrame::http_download_done (char *data){
 #else // RGB
                tmp = Gdk::Pixbuf::create_from_data ((guint8*) data, Gdk::COLORSPACE_RGB, false, 8, clip_width, clip_height, clip_width*3);
 #endif
-               img = img_pixbuf->property_pixbuf();
+               img = img_pixbuf->pixbuf();
                tmp->copy_area (0, 0, clip_width, clip_height, img, 0, 0);
                free(data);
                draw_line();
                cut_rightend();
+               img_pixbuf->set(img);
        }
 
        exposeimg();
index 6988274d7e136d86954c2addc7aa1690054ce162..403eff9cf9cb9fc54d2406d0492ad8b2f54d12f6 100644 (file)
@@ -34,7 +34,8 @@
 #include "ardour/ardour.h"
 #include "pbd/signals.h"
 
-#include "canvas.h"
+#include "canvas/group.h"
+#include "canvas/pixbuf.h"
 
 namespace ARDOUR {
        class TempoSection;
index 9cd9d35315790f7dc48526d0d2cabac6da40da8b..8360ef75d4e2dbf5166c27f5938bc3d8d944601b 100644 (file)
@@ -30,8 +30,6 @@
 #include "public_editor.h"
 #include "gui_thread.h"
 #include "utils.h"
-#include "canvas_impl.h"
-#include "simpleline.h"
 #include "utils_videotl.h"
 #include "rgb_macros.h"
 #include "video_timeline.h"
index ab1a9a92d85e0b85799edc0116ec7974ee742cf1..8775a64265951e351729a2ca181fae7ee352e0bd 100644 (file)
@@ -31,7 +31,7 @@
 #include "video_image_frame.h"
 #include "video_monitor.h"
 #include "pbd/signals.h"
-#include "canvas.h"
+#include "canvas/group.h"
 
 namespace ARDOUR {
        class Session;