expand bounding box of all objects by 0.5 before computing intersection for render...
authorPaul Davis <paul@linuxaudiosystems.com>
Thu, 24 Oct 2013 21:14:12 +0000 (17:14 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Thu, 24 Oct 2013 21:14:12 +0000 (17:14 -0400)
libs/canvas/canvas.cc
libs/canvas/group.cc

index 908af16065990264f4c769068a0cb0f80901dc1b..f13a007d56312341cf8c57b22f1fdfc86594f2c7 100644 (file)
@@ -83,6 +83,13 @@ Canvas::render (Rect const & area, Cairo::RefPtr<Cairo::Context> const & context
 
                _root.render (*draw, context);
        }
+#if 0
+       /* debug render area */
+       Rect r = _root.item_to_window (area);
+       context->rectangle (r.x0, r.y0, r.x1 - r.x0, r.y1 - r.y0);
+       context->set_source_rgba (1.0, 0.0, 0.0, 1.0);
+       context->stroke ();
+#endif
 }
 
 ostream&
@@ -205,11 +212,11 @@ Canvas::item_moved (Item* item, boost::optional<Rect> pre_change_parent_bounding
                 * to be in parent coordinate space since the bounding box of
                 * an item does not change when moved. If we use
                 * item->item_to_canvas() on the old bounding box, we will be
+
                 * using the item's new position, and so will compute the wrong
                 * invalidation area. If we use the parent (which has not
                 * moved, then this will work.
                 */
-
                queue_draw_item_area (item->parent(), pre_change_parent_bounding_box.get ());
        }
 
@@ -341,27 +348,27 @@ GtkCanvas::enter_leave_items (Duple const & point, int state)
         * we have entered it
         */
 
-       cerr << "E/L: " << items.size() << " to check at " << point << endl;
+       //cerr << "E/L: " << items.size() << " to check at " << point << endl;
 #ifdef CANVAS_DEBUG
        for (vector<Item const*>::const_reverse_iterator i = items.rbegin(); i != items.rend(); ++i) {
-               cerr << '\t' << (*i)->whatami() << ' ' << (*i)->name << " ignore ? " << (*i)->ignore_events() << " current ? " << (_current_item == (*i)) << endl;
+               //cerr << '\t' << (*i)->whatami() << ' ' << (*i)->name << " ignore ? " << (*i)->ignore_events() << " current ? " << (_current_item == (*i)) << endl;
        }
 #endif
-       cerr << "------------\n";
+       //cerr << "------------\n";
 
        for (vector<Item const*>::const_reverse_iterator i = items.rbegin(); i != items.rend(); ++i) {
 
                Item const *  new_item = *i;
 #ifdef CANVAS_DEBUG
-               cerr << "\tE/L check out " << new_item->whatami() << ' ' << new_item->name << " ignore ? " << new_item->ignore_events() << " current ? " << (_current_item == new_item) << endl;
+               //cerr << "\tE/L check out " << new_item->whatami() << ' ' << new_item->name << " ignore ? " << new_item->ignore_events() << " current ? " << (_current_item == new_item) << endl;
 #endif
                if (new_item->ignore_events()) {
-                       cerr << "continue1\n";
+                       //cerr << "continue1\n";
                        continue;
                }
 
                if (_current_item == new_item) {
-                       cerr << "continue2\n";
+                       //cerr << "continue2\n";
                        continue;
                }
 
@@ -379,7 +386,7 @@ GtkCanvas::enter_leave_items (Duple const & point, int state)
                        break;
                }
 
-               cerr << "Loop around again\n";
+               //cerr << "Loop around again\n";
        }
 }
 
index 6a43c3afd8d08dda3365d692435a27858af3ad97..37da7c4bfce49974be8566ce97e1a60df047a6df 100644 (file)
@@ -88,7 +88,7 @@ Group::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
                if (!(*i)->visible ()) {
 #ifdef CANVAS_DEBUG
                        if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
-                               // cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] invisible - skipped\n";
+                               cerr << _canvas->render_indent() << "Item " << (*i)->whatami() << " [" << (*i)->name << "] invisible - skipped\n";
                        }
 #endif
                        continue;
@@ -104,15 +104,24 @@ Group::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const
 #endif
                        continue;
                }
-
+               
                Rect item = (*i)->item_to_window (item_bbox.get());
+               item.expand (0.5);
                boost::optional<Rect> draw = item.intersection (area);
                
                if (draw) {
 #ifdef CANVAS_DEBUG
                        if (DEBUG_ENABLED(PBD::DEBUG::CanvasRender)) {
-                               cerr << string_compose ("%1render %2 %3 item = %4 intersect = %5\n", _canvas->render_indent(), (*i)->whatami(),
-                                                       (*i)->name, item, draw.get());
+                               cerr << _canvas->render_indent() << " render "
+                                    << ' ' 
+                                    << (*i)->whatami()
+                                    << ' '
+                                    << (*i)->name
+                                    << " item = " 
+                                    << item
+                                    << " intersect = "
+                                    << draw.get()
+                                    << endl;
                        }
 #endif