From 22b07e0233a29d9633ffa825a79503befaf2e16e Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Mon, 5 Oct 2015 16:17:49 +0200 Subject: NOOP, remove trailing tabs/whitespace. --- libs/canvas/arc.cc | 20 ++-- libs/canvas/arrow.cc | 18 ++-- libs/canvas/benchmark/benchmark.h | 2 +- libs/canvas/benchmark/items_at_point.cc | 6 +- libs/canvas/benchmark/render_from_log.cc | 6 +- libs/canvas/benchmark/render_parts.cc | 6 +- libs/canvas/benchmark/render_whole.cc | 4 +- libs/canvas/canvas.cc | 56 +++++----- libs/canvas/canvas/arc.h | 2 +- libs/canvas/canvas/arrow.h | 4 +- libs/canvas/canvas/canvas.h | 8 +- libs/canvas/canvas/circle.h | 2 +- libs/canvas/canvas/colors.h | 10 +- libs/canvas/canvas/fill.h | 2 +- libs/canvas/canvas/flag.h | 4 +- libs/canvas/canvas/item.h | 18 ++-- libs/canvas/canvas/line.h | 2 +- libs/canvas/canvas/line_set.h | 2 +- libs/canvas/canvas/lookup_table.h | 2 +- libs/canvas/canvas/outline.h | 2 +- libs/canvas/canvas/poly_item.h | 2 +- libs/canvas/canvas/poly_line.h | 6 +- libs/canvas/canvas/polygon.h | 2 +- libs/canvas/canvas/rectangle.h | 2 +- libs/canvas/canvas/root_group.h | 2 +- libs/canvas/canvas/ruler.h | 10 +- libs/canvas/canvas/scroll_group.h | 2 +- libs/canvas/canvas/tracking_text.h | 2 +- libs/canvas/canvas/types.h | 20 ++-- libs/canvas/canvas/wave_view.h | 48 ++++----- libs/canvas/canvas/widget.h | 2 +- libs/canvas/colors.cc | 22 ++-- libs/canvas/colorspace.cc | 70 ++++++------- libs/canvas/curve.cc | 4 +- libs/canvas/debug.cc | 2 +- libs/canvas/fill.cc | 6 +- libs/canvas/flag.cc | 2 +- libs/canvas/image.cc | 4 +- libs/canvas/item.cc | 60 +++++------ libs/canvas/line.cc | 30 +++--- libs/canvas/line_set.cc | 10 +- libs/canvas/lookup_table.cc | 12 +-- libs/canvas/pixbuf.cc | 4 +- libs/canvas/poly_item.cc | 16 +-- libs/canvas/poly_line.cc | 16 +-- libs/canvas/polygon.cc | 6 +- libs/canvas/rectangle.cc | 38 +++---- libs/canvas/root_group.cc | 2 +- libs/canvas/ruler.cc | 6 +- libs/canvas/scroll_group.cc | 6 +- libs/canvas/stateful_image.cc | 14 +-- libs/canvas/test/arrow.cc | 2 +- libs/canvas/test/group.cc | 10 +- libs/canvas/test/gtk_drag.cc | 6 +- libs/canvas/test/gtk_many.cc | 6 +- libs/canvas/test/gtk_movement.cc | 6 +- libs/canvas/test/gtk_scene.cc | 4 +- libs/canvas/test/gtk_viewport.cc | 8 +- libs/canvas/test/optimizing_lookup_table.cc | 8 +- libs/canvas/test/render.cc | 2 +- libs/canvas/test/types.cc | 2 +- libs/canvas/test/types.h | 2 +- libs/canvas/test/wave_view.cc | 20 ++-- libs/canvas/test/xml.cc | 2 +- libs/canvas/test/xml.h | 2 +- libs/canvas/text.cc | 16 +-- libs/canvas/tracking_text.cc | 4 +- libs/canvas/utils.cc | 2 +- libs/canvas/wave_view.cc | 154 ++++++++++++++-------------- libs/canvas/xfade_curve.cc | 2 +- 70 files changed, 431 insertions(+), 431 deletions(-) (limited to 'libs/canvas') diff --git a/libs/canvas/arc.cc b/libs/canvas/arc.cc index 8b462414f8..49b3f63f0a 100644 --- a/libs/canvas/arc.cc +++ b/libs/canvas/arc.cc @@ -55,7 +55,7 @@ Arc::compute_bounding_box () const /* this could be smaller in the case of small _arc values but I can't be bothered to optimize it. */ - + bbox.x0 = _center.x - _radius; bbox.y0 = _center.y - _radius; bbox.x1 = _center.x + _radius; @@ -73,7 +73,7 @@ Arc::render (Rect const & /*area*/, Cairo::RefPtr context) const if (_radius <= 0.0 || _arc_degrees <= 0.0) { return; } - + Duple c = item_to_window (Duple (_center.x, _center.y)); context->arc (c.x, c.y, _radius, _start_degrees * (M_PI/180.0), _arc_degrees * (M_PI/180.0)); @@ -98,35 +98,35 @@ void Arc::set_radius (Coord r) { begin_change (); - + _radius = r; _bounding_box_dirty = true; end_change (); -} +} void Arc::set_arc (double deg) { begin_change (); - + _arc_degrees = deg; _bounding_box_dirty = true; end_change (); -} +} void Arc::set_start (double deg) { begin_change (); - + _start_degrees = deg; - + _bounding_box_dirty = true; end_change (); -} +} bool Arc::covers (Duple const & point) const @@ -135,7 +135,7 @@ Arc::covers (Duple const & point) const double angle_degs = atan (p.y/p.x) * 2.0 * M_PI; double radius = sqrt (p.x * p.x + p.y * p.y); - + return (angle_degs >= _start_degrees) && (angle_degs <= (_start_degrees + _arc_degrees)) && (radius < _radius); diff --git a/libs/canvas/arrow.cc b/libs/canvas/arrow.cc index d78b04ef58..1f8f5b44ec 100644 --- a/libs/canvas/arrow.cc +++ b/libs/canvas/arrow.cc @@ -58,7 +58,7 @@ Arrow::setup () setup_polygon (i); CANVAS_DEBUG_NAME (_heads[i].polygon, string_compose ("arrow head %1", i)); } - + _line = new Line (this); CANVAS_DEBUG_NAME (_line, "arrow line"); } @@ -90,9 +90,9 @@ void Arrow::set_show_head (int which, bool show) { assert (which == 0 || which == 1); - + begin_change (); - + if (!show) { delete _heads[which].polygon; _heads[which].polygon = 0; @@ -114,7 +114,7 @@ void Arrow::set_head_outward (int which, bool outward) { assert (which == 0 || which == 1); - + begin_change (); _heads[which].outward = outward; @@ -132,9 +132,9 @@ void Arrow::set_head_height (int which, Distance height) { assert (which == 0 || which == 1); - + begin_change (); - + _heads[which].height = height; setup_polygon (which); @@ -150,9 +150,9 @@ void Arrow::set_head_width (int which, Distance width) { assert (which == 0 || which == 1); - + begin_change (); - + _heads[which].width = width; setup_polygon (which); @@ -239,7 +239,7 @@ void Arrow::setup_polygon (int which) { assert (which == 0 || which == 1); - + Points points; if ((which == 0 && _heads[which].outward) || (which == 1 && !_heads[which].outward)) { diff --git a/libs/canvas/benchmark/benchmark.h b/libs/canvas/benchmark/benchmark.h index df6fd0ea89..86ed6653c1 100644 --- a/libs/canvas/benchmark/benchmark.h +++ b/libs/canvas/benchmark/benchmark.h @@ -16,7 +16,7 @@ public: void set_iterations (int); double run (); - + virtual void do_run (ArdourCanvas::ImageCanvas &) = 0; virtual void finish (ArdourCanvas::ImageCanvas &) {} diff --git a/libs/canvas/benchmark/items_at_point.cc b/libs/canvas/benchmark/items_at_point.cc index db0c5343b2..268447ed69 100644 --- a/libs/canvas/benchmark/items_at_point.cc +++ b/libs/canvas/benchmark/items_at_point.cc @@ -12,7 +12,7 @@ static void test (int items_per_cell) { Group::default_items_per_cell = items_per_cell; - + int const n_rectangles = 10000; int const n_tests = 1000; double const rough_size = 1000; @@ -42,7 +42,7 @@ int main () for (unsigned int i = 0; i < sizeof (tests) / sizeof (int); ++i) { timeval start; timeval stop; - + gettimeofday (&start, 0); test (tests[i]); gettimeofday (&stop, 0); @@ -59,4 +59,4 @@ int main () cout << "Test " << tests[i] << ": " << seconds << "\n"; } } - + diff --git a/libs/canvas/benchmark/render_from_log.cc b/libs/canvas/benchmark/render_from_log.cc index cd064d3e33..0a2af8b7bc 100644 --- a/libs/canvas/benchmark/render_from_log.cc +++ b/libs/canvas/benchmark/render_from_log.cc @@ -20,14 +20,14 @@ public: { _items_per_cell = items; } - + void do_run (ImageCanvas& canvas) { Group::default_items_per_cell = _items_per_cell; canvas.set_log_renders (false); list const & renders = canvas.renders (); - + for (list::const_iterator i = renders.begin(); i != renders.end(); ++i) { canvas.render_to_image (*i); } @@ -59,4 +59,4 @@ int main (int argc, char* argv[]) return 0; } - + diff --git a/libs/canvas/benchmark/render_parts.cc b/libs/canvas/benchmark/render_parts.cc index 14988ab5c6..f5444817ca 100644 --- a/libs/canvas/benchmark/render_parts.cc +++ b/libs/canvas/benchmark/render_parts.cc @@ -20,11 +20,11 @@ public: { _items_per_cell = items; } - + void do_run (ImageCanvas& canvas) { Group::default_items_per_cell = _items_per_cell; - + for (int i = 0; i < 1e4; i += 50) { canvas.render_to_image (Rect (i, 0, i + 50, 1024)); } @@ -55,4 +55,4 @@ int main (int argc, char* argv[]) return 0; } - + diff --git a/libs/canvas/benchmark/render_whole.cc b/libs/canvas/benchmark/render_whole.cc index 7f5b348e62..cf4749c3e0 100644 --- a/libs/canvas/benchmark/render_whole.cc +++ b/libs/canvas/benchmark/render_whole.cc @@ -39,8 +39,8 @@ int main (int argc, char* argv[]) if (argc > 2) { render_whole.set_iterations (atoi (argv[2])); } - + cout << render_whole.run () << "\n"; - + return 0; } diff --git a/libs/canvas/canvas.cc b/libs/canvas/canvas.cc index 2d88eef5ce..c6c4aed20c 100644 --- a/libs/canvas/canvas.cc +++ b/libs/canvas/canvas.cc @@ -104,7 +104,7 @@ Canvas::render (Rect const & area, Cairo::RefPtr const & context #endif render_count = 0; - + boost::optional root_bbox = _root.bounding_box(); if (!root_bbox) { /* the root has no bounding box, so there's nothing to render */ @@ -113,7 +113,7 @@ Canvas::render (Rect const & area, Cairo::RefPtr const & context boost::optional draw = root_bbox->intersection (area); if (draw) { - + /* there's a common area between the root and the requested area, so render it. */ @@ -171,7 +171,7 @@ Canvas::dump (ostream& o) const { dump_depth = 0; _root.dump (o); -} +} /** Called when an item has been shown or hidden. * @param item Item that has been shown or hidden. @@ -210,7 +210,7 @@ Canvas::item_visual_property_changed (Item* item) void Canvas::item_changed (Item* item, boost::optional pre_change_bounding_box) { - + Rect window_bbox = visible_area (); if (pre_change_bounding_box) { @@ -223,7 +223,7 @@ Canvas::item_changed (Item* item, boost::optional pre_change_bounding_box) boost::optional post_change_bounding_box = item->bounding_box (); if (post_change_bounding_box) { - + if (item->item_to_window (*post_change_bounding_box).intersection (window_bbox)) { /* request a redraw of the item's new bounding box */ queue_draw_item_area (item, post_change_bounding_box.get ()); @@ -406,7 +406,7 @@ GtkCanvas::pick_current_item (int state) * added or removed, so we have no coordinates to work from as is the * case with a motion event. Find out where the mouse is and use that. */ - + Glib::RefPtr pointer_window = Gdk::Display::get_default()->get_window_at_pointer (x, y); if (pointer_window != get_window()) { @@ -453,7 +453,7 @@ GtkCanvas::pick_current_item (Duple const & point, int state) top, but we're going to reverse that for within_items so that its first item is the upper-most item that can be chosen as _current_item. */ - + vector::const_iterator i; list within_items; @@ -483,7 +483,7 @@ GtkCanvas::pick_current_item (Duple const & point, int state) DEBUG_TRACE (PBD::DEBUG::CanvasEnterLeave, string_compose ("CURRENT ITEM %1/%2\n", _new_current_item->whatami(), _current_item->name)); return; } - + _new_current_item = const_cast (within_items.front()); } @@ -525,7 +525,7 @@ GtkCanvas::deliver_enter_leave (Duple const & point, int state) /* Events delivered to canvas items are expected to be in canvas * coordinates but @param point is in window coordinates. */ - + Duple c = window_to_canvas (point); enter_event.x = c.x; enter_event.y = c.y; @@ -574,7 +574,7 @@ GtkCanvas::deliver_enter_leave (Duple const & point, int state) * Deliver "virtual" leave notifications to all items in the * heirarchy between current and new_current. */ - + for (i = _current_item->parent(); i && i != _new_current_item; i = i->parent()) { items_to_leave_virtual.push_back (i); } @@ -620,7 +620,7 @@ GtkCanvas::deliver_enter_leave (Duple const & point, int state) enter_detail = GDK_NOTIFY_NONLINEAR; leave_detail = GDK_NOTIFY_NONLINEAR; } - + if (_current_item && !_current_item->ignore_events ()) { leave_event.detail = leave_detail; @@ -685,7 +685,7 @@ GtkCanvas::deliver_event (GdkEvent* event) /* run through the items from child to parent, until one claims the event */ Item* item = const_cast (event_item); - + while (item) { Item* parent = item->parent (); @@ -697,10 +697,10 @@ GtkCanvas::deliver_event (GdkEvent* event) PBD::DEBUG::CanvasEvents, string_compose ("canvas event handled by %1 %2\n", item->whatami(), item->name.empty() ? "[unknown]" : item->name) ); - + return true; } - + DEBUG_TRACE (PBD::DEBUG::CanvasEvents, string_compose ("canvas event %3 left unhandled by %1 %2\n", item->whatami(), item->name.empty() ? "[unknown]" : item->name, event_type_string (event->type))); if ((item = parent) == 0) { @@ -722,7 +722,7 @@ GtkCanvas::item_going_away (Item* item, boost::optional bounding_box) if (bounding_box) { queue_draw_item_area (item, bounding_box.get ()); } - + if (_new_current_item == item) { _new_current_item = 0; } @@ -751,7 +751,7 @@ GtkCanvas::item_going_away (Item* item, boost::optional bounding_box) _current_item = 0; pick_current_item (0); // no mouse state } - + } void @@ -810,13 +810,13 @@ GtkCanvas::on_expose_event (GdkEventExpose* ev) /* render canvas */ if ( _single_exposure ) { - + render (Rect (ev->area.x, ev->area.y, ev->area.x + ev->area.width, ev->area.y + ev->area.height), draw_context); } else { GdkRectangle* rects; gint nrects; - + gdk_region_get_rectangles (ev->region, &rects, &nrects); for (gint n = 0; n < nrects; ++n) { draw_context->set_identity_matrix(); //reset the cairo matrix, just in case someone left it transformed after drawing ( cough ) @@ -824,7 +824,7 @@ GtkCanvas::on_expose_event (GdkEventExpose* ev) } g_free (rects); } - + #ifdef OPTIONAL_CAIRO_IMAGE_SURFACE if (getenv("ARDOUR_IMAGE_SURFACE")) { #endif @@ -856,12 +856,12 @@ GtkCanvas::on_scroll_event (GdkEventScroll* ev) GdkEvent copy = *((GdkEvent*)ev); Duple winpos = Duple (ev->x, ev->y); Duple where = window_to_canvas (winpos); - + pick_current_item (winpos, ev->state); copy.button.x = where.x; copy.button.y = where.y; - + /* Coordinates in the event will be canvas coordinates, correctly adjusted for scroll if this GtkCanvas is in a GtkCanvasViewport. */ @@ -904,12 +904,12 @@ GtkCanvas::on_button_press_event (GdkEventButton* ev) GdkEvent copy = *((GdkEvent*)ev); Duple winpos = Duple (ev->x, ev->y); Duple where = window_to_canvas (winpos); - + pick_current_item (winpos, ev->state); copy.button.x = where.x; copy.button.y = where.y; - + /* Coordinates in the event will be canvas coordinates, correctly adjusted for scroll if this GtkCanvas is in a GtkCanvasViewport. */ @@ -924,13 +924,13 @@ GtkCanvas::on_button_press_event (GdkEventButton* ev) */ bool GtkCanvas::on_button_release_event (GdkEventButton* ev) -{ +{ /* translate event coordinates from window to canvas */ GdkEvent copy = *((GdkEvent*)ev); Duple winpos = Duple (ev->x, ev->y); Duple where = window_to_canvas (winpos); - + pick_current_item (winpos, ev->state); copy.button.x = where.x; @@ -1200,12 +1200,12 @@ GtkCanvas::show_tooltip () (void) toplevel->get_window()->get_pointer (pointer_x, pointer_y, mask); Duple tooltip_window_origin (pointer_x, pointer_y); - + /* convert to root window coordinates */ int win_x, win_y; dynamic_cast(toplevel)->get_position (win_x, win_y); - + tooltip_window_origin = tooltip_window_origin.translate (Duple (win_x, win_y)); /* we don't want the pointer to be inside the window when it is @@ -1227,7 +1227,7 @@ GtkCanvas::show_tooltip () /* ready to show */ tooltip_window->present (); - + /* called from a timeout handler, don't call it again */ return false; diff --git a/libs/canvas/canvas/arc.h b/libs/canvas/canvas/arc.h index 95bd157cbf..76342c3985 100644 --- a/libs/canvas/canvas/arc.h +++ b/libs/canvas/canvas/arc.h @@ -63,7 +63,7 @@ private: double _arc_degrees; double _start_degrees; }; - + } #endif diff --git a/libs/canvas/canvas/arrow.h b/libs/canvas/canvas/arrow.h index 6617e13bd2..ba74fa90e7 100644 --- a/libs/canvas/canvas/arrow.h +++ b/libs/canvas/canvas/arrow.h @@ -44,7 +44,7 @@ class Polygon; * @todo Draws vertical lines only; could be generalised * to draw lines at any angle. */ - + class LIBCANVAS_API Arrow : public Container { public: @@ -66,7 +66,7 @@ public: void set_x (Coord); void set_y0 (Coord); void set_y1 (Coord); - + bool covers (Duple const &) const; private: diff --git a/libs/canvas/canvas/canvas.h b/libs/canvas/canvas/canvas.h index c812f8a869..87e580e046 100644 --- a/libs/canvas/canvas/canvas.h +++ b/libs/canvas/canvas/canvas.h @@ -59,7 +59,7 @@ class ScrollGroup; * of screen pixels, with an origin of (0, 0) at the top left. x increases * rightwards and y increases downwards. */ - + class LIBCANVAS_API Canvas { public: @@ -153,7 +153,7 @@ public: /** Set the timeout used to display tooltips, in milliseconds */ static void set_tooltip_timeout (uint32_t msecs); - + protected: Root _root; Color _bg_color; @@ -205,7 +205,7 @@ protected: bool on_motion_notify_event (GdkEventMotion *); bool on_enter_notify_event (GdkEventCrossing*); bool on_leave_notify_event (GdkEventCrossing*); - + bool button_handler (GdkEventButton *); bool motion_notify_handler (GdkEventMotion *); bool deliver_event (GdkEvent *); @@ -228,7 +228,7 @@ private: Item * _grabbed_item; /** the item that currently has key focus or 0 */ Item * _focused_item; - + bool _single_exposure; sigc::connection tooltip_timeout_connection; diff --git a/libs/canvas/canvas/circle.h b/libs/canvas/canvas/circle.h index c84e3aceec..64ce2ea62d 100644 --- a/libs/canvas/canvas/circle.h +++ b/libs/canvas/canvas/circle.h @@ -31,7 +31,7 @@ class LIBCANVAS_API Circle : public Arc Circle (Canvas*); Circle (Item*); }; - + } #endif diff --git a/libs/canvas/canvas/colors.h b/libs/canvas/canvas/colors.h index 331010e639..2a3cbb2060 100644 --- a/libs/canvas/canvas/colors.h +++ b/libs/canvas/canvas/colors.h @@ -59,11 +59,11 @@ class LIBCANVAS_API SVAModifier double s() const { return _s; } double v() const { return _v; } double a() const { return _a; } - + HSV operator () (HSV& hsv) const; std::string to_string () const; void from_string (std::string const &); - + private: Type type; double _s; @@ -77,7 +77,7 @@ struct LIBCANVAS_API HSV HSV (double h, double s, double v, double a = 1.0); HSV (Color); HSV (const std::string&); - + double h; double s; double v; @@ -85,12 +85,12 @@ struct LIBCANVAS_API HSV std::string to_string() const; bool is_gray() const; - + Color color() const { return hsva_to_color (h,s, v, a); } operator Color() const { return color(); } HSV mod (SVAModifier const & svam); - + HSV operator+ (const HSV&) const; HSV operator- (const HSV&) const; diff --git a/libs/canvas/canvas/fill.h b/libs/canvas/canvas/fill.h index 9eddeec6b6..42160a6190 100644 --- a/libs/canvas/canvas/fill.h +++ b/libs/canvas/canvas/fill.h @@ -50,7 +50,7 @@ public: } typedef std::vector > StopList; - + void set_gradient (StopList const & stops, bool is_vertical); void set_pattern (Cairo::RefPtr); diff --git a/libs/canvas/canvas/flag.h b/libs/canvas/canvas/flag.h index 82f257b7d2..ed7bc7cacb 100644 --- a/libs/canvas/canvas/flag.h +++ b/libs/canvas/canvas/flag.h @@ -41,7 +41,7 @@ public: void set_font_description (Pango::FontDescription); bool covers (Duple const &) const; - + private: void setup (Distance height, Duple position); @@ -52,5 +52,5 @@ private: Rectangle* _rectangle; bool _invert; }; - + } diff --git a/libs/canvas/canvas/item.h b/libs/canvas/canvas/item.h index 098816cd4a..e92fc7fb4b 100644 --- a/libs/canvas/canvas/item.h +++ b/libs/canvas/canvas/item.h @@ -36,7 +36,7 @@ namespace ArdourCanvas { -struct Rect; +struct Rect; class Canvas; class ScrollGroup; @@ -51,7 +51,7 @@ class ScrollGroup; * Any item that is being displayed on a canvas has a pointer to that canvas, * and all except the `root group' have a pointer to their parent group. */ - + class LIBCANVAS_API Item : public Fill, public Outline { public: @@ -97,7 +97,7 @@ public: void grab (); void ungrab (); - + void unparent (); void reparent (Item *); @@ -176,7 +176,7 @@ public: } bool visible () const; - + /** @return Our canvas, or 0 if we are not attached to one */ Canvas* canvas () const { return _canvas; @@ -204,7 +204,7 @@ public: static int default_items_per_cell; - + /* This is a sigc++ signal because it is solely concerned with GUI stuff and is thus single-threaded */ @@ -223,23 +223,23 @@ public: return false; } }; - + sigc::signal1 > Event; #ifdef CANVAS_DEBUG std::string name; #endif - + #ifdef CANVAS_COMPATIBILITY void grab_focus (); -#endif +#endif const std::string& tooltip () const { return _tooltip; } void set_tooltip (const std::string&); void start_tooltip_timeout (); void stop_tooltip_timeout (); - + virtual void dump (std::ostream&) const; std::string whatami() const; diff --git a/libs/canvas/canvas/line.h b/libs/canvas/canvas/line.h index b178554c84..bd58887604 100644 --- a/libs/canvas/canvas/line.h +++ b/libs/canvas/canvas/line.h @@ -60,7 +60,7 @@ class LIBCANVAS_API Line : public Item private: Duple _points[2]; }; - + } #endif diff --git a/libs/canvas/canvas/line_set.h b/libs/canvas/canvas/line_set.h index fad100fdf9..c305cceab5 100644 --- a/libs/canvas/canvas/line_set.h +++ b/libs/canvas/canvas/line_set.h @@ -51,7 +51,7 @@ public: struct Line { Line (Coord p, Distance width_, Color color_) : pos (p), width (width_), color (color_) {} - + Coord pos; Distance width; Color color; diff --git a/libs/canvas/canvas/lookup_table.h b/libs/canvas/canvas/lookup_table.h index cf52633524..2877f7a727 100644 --- a/libs/canvas/canvas/lookup_table.h +++ b/libs/canvas/canvas/lookup_table.h @@ -43,7 +43,7 @@ public: virtual bool has_item_at_point (Duple const & point) const = 0; protected: - + Item const & _item; }; diff --git a/libs/canvas/canvas/outline.h b/libs/canvas/canvas/outline.h index 474501c8c7..38f8eb2e32 100644 --- a/libs/canvas/canvas/outline.h +++ b/libs/canvas/canvas/outline.h @@ -46,7 +46,7 @@ public: Distance outline_width () const { return _outline_width; } - + virtual void set_outline_width (Distance); bool outline () const { diff --git a/libs/canvas/canvas/poly_item.h b/libs/canvas/canvas/poly_item.h index 732adb14b3..bdb7c20b1a 100644 --- a/libs/canvas/canvas/poly_item.h +++ b/libs/canvas/canvas/poly_item.h @@ -45,7 +45,7 @@ protected: Points _points; }; - + } #endif diff --git a/libs/canvas/canvas/poly_line.h b/libs/canvas/canvas/poly_line.h index 04b05f5df1..fce013dfd6 100644 --- a/libs/canvas/canvas/poly_line.h +++ b/libs/canvas/canvas/poly_line.h @@ -31,11 +31,11 @@ class LIBCANVAS_API PolyLine : public PolyItem public: PolyLine (Canvas*); PolyLine (Item*); - + void render (Rect const & area, Cairo::RefPtr) const; virtual void set_steps (Points const &, bool stepped); - + bool covers (Duple const &) const; /** * Set the distance at which a point will be considered to be covered @@ -47,7 +47,7 @@ class LIBCANVAS_API PolyLine : public PolyItem private: double _threshold; }; - + } #endif diff --git a/libs/canvas/canvas/polygon.h b/libs/canvas/canvas/polygon.h index e0e6b1a1f7..65fcdde981 100644 --- a/libs/canvas/canvas/polygon.h +++ b/libs/canvas/canvas/polygon.h @@ -45,7 +45,7 @@ public: void cache_shape_computation () const; }; - + } #endif diff --git a/libs/canvas/canvas/rectangle.h b/libs/canvas/canvas/rectangle.h index c40d3fccb0..8b65940454 100644 --- a/libs/canvas/canvas/rectangle.h +++ b/libs/canvas/canvas/rectangle.h @@ -34,7 +34,7 @@ public: Rectangle (Canvas*, Rect const &); Rectangle (Item*); Rectangle (Item*, Rect const &); - + void render (Rect const &, Cairo::RefPtr) const; void compute_bounding_box () const; diff --git a/libs/canvas/canvas/root_group.h b/libs/canvas/canvas/root_group.h index 1763fc11df..1d2c516b8b 100644 --- a/libs/canvas/canvas/root_group.h +++ b/libs/canvas/canvas/root_group.h @@ -29,7 +29,7 @@ class LIBCANVAS_API Root : public Container { private: friend class Canvas; - + Root (Canvas *); void compute_bounding_box () const; diff --git a/libs/canvas/canvas/ruler.h b/libs/canvas/canvas/ruler.h index 0a6a13e078..0a2e43587e 100644 --- a/libs/canvas/canvas/ruler.h +++ b/libs/canvas/canvas/ruler.h @@ -28,7 +28,7 @@ namespace ArdourCanvas { - + class LIBCANVAS_API Ruler : public Rectangle { public: @@ -42,7 +42,7 @@ public: double position; Style style; }; - + struct Metric { Metric () : units_per_pixel (0) {} virtual ~Metric() {} @@ -51,15 +51,15 @@ public: /* lower and upper and sample positions, which are also canvas coordinates */ - + virtual void get_marks (std::vector&, double lower, double upper, int maxchars) const = 0; }; - + Ruler (Canvas*, const Metric& m); Ruler (Canvas*, const Metric& m, Rect const&); Ruler (Item*, const Metric& m); Ruler (Item*, const Metric& m, Rect const&); - + void set_range (double lower, double upper); void set_font_description (Pango::FontDescription); void set_metric (const Metric&); diff --git a/libs/canvas/canvas/scroll_group.h b/libs/canvas/canvas/scroll_group.h index fd9b2388d4..0317662006 100644 --- a/libs/canvas/canvas/scroll_group.h +++ b/libs/canvas/canvas/scroll_group.h @@ -34,7 +34,7 @@ class LIBCANVAS_API ScrollGroup : public Container ScrollsVertically = 0x1, ScrollsHorizontally = 0x2 }; - + ScrollGroup (Canvas*, ScrollSensitivity); ScrollGroup (Item*, ScrollSensitivity); diff --git a/libs/canvas/canvas/tracking_text.h b/libs/canvas/canvas/tracking_text.h index 901e5c2925..744e5370fb 100644 --- a/libs/canvas/canvas/tracking_text.h +++ b/libs/canvas/canvas/tracking_text.h @@ -29,7 +29,7 @@ class LIBCANVAS_API TrackingText : public Text public: TrackingText (Canvas*); TrackingText (Item*); - + void show_and_track (bool track_x, bool track_y); void set_offset (Duple const &); void set_x_offset (double); diff --git a/libs/canvas/canvas/types.h b/libs/canvas/canvas/types.h index c43be9bbdd..a92d637925 100644 --- a/libs/canvas/canvas/types.h +++ b/libs/canvas/canvas/types.h @@ -60,12 +60,12 @@ struct LIBCANVAS_API Duple : x (0) , y (0) {} - + Duple (Coord x_, Coord y_) : x (x_) , y (y_) {} - + Coord x; Coord y; @@ -104,14 +104,14 @@ struct LIBCANVAS_API Rect , x1 (0) , y1 (0) {} - + Rect (Coord x0_, Coord y0_, Coord x1_, Coord y1_) : x0 (x0_) , y0 (y0_) , x1 (x1_) , y1 (y1_) {} - + Coord x0; Coord y0; Coord x1; @@ -120,14 +120,14 @@ struct LIBCANVAS_API Rect boost::optional intersection (Rect const & o) const throw () { Rect i (std::max (x0, o.x0), std::max (y0, o.y0), std::min (x1, o.x1), std::min (y1, o.y1)); - + if (i.x0 > i.x1 || i.y0 > i.y1) { return boost::optional (); } - + return boost::optional (i); } - + Rect extend (Rect const & o) const throw () { return Rect (std::min (x0, o.x0), std::min (y0, o.y0), std::max (x1, o.x1), std::max (y1, o.y1)); @@ -150,7 +150,7 @@ struct LIBCANVAS_API Rect return Rect (canvas_safe_add (x0, amount), canvas_safe_add (y0, amount), x1 - amount, y1 - amount); } - + bool contains (Duple const & point) const throw () { return point.x >= x0 && point.x < x1 && point.y >= y0 && point.y < y1; } @@ -158,7 +158,7 @@ struct LIBCANVAS_API Rect return Rect (std::min (x0, x1), std::min (y0, y1), std::max (x0, x1), std::max (y0, y1)); } - + bool empty() const throw () { return (x0 == x1 && y0 == y1); } Distance width () const throw () { @@ -181,5 +181,5 @@ extern LIBCANVAS_API std::ostream & operator<< (std::ostream &, Rect const &); typedef std::vector Points; } - + #endif diff --git a/libs/canvas/canvas/wave_view.h b/libs/canvas/canvas/wave_view.h index 20c3ad5cce..8dfd988b6b 100644 --- a/libs/canvas/canvas/wave_view.h +++ b/libs/canvas/canvas/wave_view.h @@ -42,7 +42,7 @@ namespace Gdk { } class WaveViewTest; - + namespace ArdourCanvas { struct LIBCANVAS_API WaveViewThreadRequest @@ -55,10 +55,10 @@ struct LIBCANVAS_API WaveViewThreadRequest }; WaveViewThreadRequest () : stop (0) {} - + bool should_stop () const { return (bool) g_atomic_int_get (const_cast(&stop)); } void cancel() { g_atomic_int_set (&stop, 1); } - + RequestType type; framepos_t start; framepos_t end; @@ -71,9 +71,9 @@ struct LIBCANVAS_API WaveViewThreadRequest boost::weak_ptr region; /* resulting image, after request has been satisfied */ - + Cairo::RefPtr image; - + private: gint stop; /* intended for atomic access */ }; @@ -85,7 +85,7 @@ class LIBCANVAS_API WaveViewCache public: WaveViewCache(); ~WaveViewCache(); - + struct Entry { /* these properties define the cache entry as unique. @@ -111,7 +111,7 @@ class LIBCANVAS_API WaveViewCache /* last time the cache entry was used */ uint64_t timestamp; - + Entry (int chan, Coord hght, float amp, Color fcl, double spp, framepos_t strt, framepos_t ed, Cairo::RefPtr img) : channel (chan) @@ -127,10 +127,10 @@ class LIBCANVAS_API WaveViewCache uint64_t image_cache_threshold () const { return _image_cache_threshold; } void set_image_cache_threshold (uint64_t); void clear_cache (); - + void add (boost::shared_ptr, boost::shared_ptr); void use (boost::shared_ptr, boost::shared_ptr); - + void consolidate_image_cache (boost::shared_ptr, int channel, Coord height, @@ -196,18 +196,18 @@ public: Cairo::RefPtr _image; PBD::Signal0 ImageReady; - + /* Displays a single channel of waveform data for the given Region. x = 0 in the waveview corresponds to the first waveform datum taken from region->start() samples into the source data. - + x = N in the waveview corresponds to the (N * spp)'th sample measured from region->start() into the source data. - + when drawing, we will map the zeroth-pixel of the waveview into a window. - + The waveview itself contains a set of pre-rendered Cairo::ImageSurfaces that cache sections of the display. This is filled on-demand and never cleared until something explicitly marks the cache invalid @@ -235,10 +235,10 @@ public: * want this behaviour. */ void set_start_shift (double pixels); - + void set_fill_color (Color); void set_outline_color (Color); - + void region_resized (); void gain_changed (); @@ -277,8 +277,8 @@ public: static void stop_drawing_thread (); static void set_image_cache_size (uint64_t); - -#ifdef CANVAS_COMPATIBILITY + +#ifdef CANVAS_COMPATIBILITY void*& property_gain_src () { return _foo_void; } @@ -312,7 +312,7 @@ public: double _amplitude_above_axis; float _region_amplitude; double _start_shift; - + /** The `start' value to use for the region; we can't use the region's * value as the crossfade editor needs to alter it. */ @@ -340,14 +340,14 @@ public: keep updating (e.g. while recording) */ bool always_get_image_in_thread; - + /** Set to true by render(). Used so that we know if the wave view * has actually been displayed on screen. ::set_height() when this * is true does not use get_image_in_thread, because it implies * that the height is being set BEFORE the waveview is drawn. */ mutable bool rendered; - + PBD::ScopedConnectionList invalidation_connection; PBD::ScopedConnection image_ready_connection; @@ -364,14 +364,14 @@ public: boost::shared_ptr get_image (framepos_t start, framepos_t end, bool& full_image) const; boost::shared_ptr get_image_from_cache (framepos_t start, framepos_t end, bool& full_image) const; - + struct LineTips { double top; double bot; double spread; bool clip_max; bool clip_min; - + LineTips() : top (0.0), bot (0.0), clip_max (false), clip_min (false) {} }; @@ -382,7 +382,7 @@ public: void draw_image (Cairo::RefPtr&, ARDOUR::PeakData*, int n_peaks, boost::shared_ptr) const; void draw_absent_image (Cairo::RefPtr&, ARDOUR::PeakData*, int) const; - + void cancel_my_render_request () const; void queue_get_image (boost::shared_ptr region, framepos_t start, framepos_t end) const; @@ -394,7 +394,7 @@ public: mutable boost::shared_ptr _current_image; mutable boost::shared_ptr current_request; - + static WaveViewCache* images; static void drawing_thread (); diff --git a/libs/canvas/canvas/widget.h b/libs/canvas/canvas/widget.h index 590bb3af7d..127862037c 100644 --- a/libs/canvas/canvas/widget.h +++ b/libs/canvas/canvas/widget.h @@ -33,7 +33,7 @@ class LIBCANVAS_API Widget : public Item public: Widget (Canvas*, CairoWidget&); Widget (Item*, CairoWidget&); - + void render (Rect const &, Cairo::RefPtr) const; void compute_bounding_box () const; diff --git a/libs/canvas/colors.cc b/libs/canvas/colors.cc index 03bfd8d4ce..19c5226642 100644 --- a/libs/canvas/colors.cc +++ b/libs/canvas/colors.cc @@ -55,9 +55,9 @@ ArdourCanvas::color_to_hsva (Color color, double& h, double& s, double& v, doubl double cmax; double cmin; double delta; - + color_to_rgba (color, r, g, b, a); - + if (r > g) { cmax = max (r, b); } else { @@ -81,7 +81,7 @@ ArdourCanvas::color_to_hsva (Color color, double& h, double& s, double& v, doubl return; } - if (delta != 0.0) { + if (delta != 0.0) { if (cmax == r) { h = fmod ((g - b)/delta, 6.0); } else if (cmax == g) { @@ -89,9 +89,9 @@ ArdourCanvas::color_to_hsva (Color color, double& h, double& s, double& v, doubl } else { h = ((r - g)/delta) + 4; } - + h *= 60.0; - + if (h < 0.0) { /* negative values are legal but confusing, because they alias positive values. @@ -341,7 +341,7 @@ HSV HSV::shade (double factor) const { HSV hsv (*this); - + /* algorithm derived from a google palette website and analysis of their color palettes. @@ -423,10 +423,10 @@ HSV::distance (const HSV& other) const perceptual distance of sqrt ((360^2) + 1 + 1) = 360. The 450 are not evenly spread (Webers Law), so lets use 360 as an approximation of the number of distinct achromatics. - + So, scale up the achromatic difference to give about a maximal distance between v = 1.0 and v = 0.0 of 360. - + A difference of about 0.0055 will generate a return value of 2, which is roughly the limit of human perceptual discrimination for chromatics. @@ -467,7 +467,7 @@ HSV::distance (const HSV& other) const const double xDE = sqrt (((sL - oL) * (sL - oL)) + ((sA - oA) * (sA - oA)) + ((sB - oB) * (sB - oB))); - + double xDH; if (sqrt (xDE) > (sqrt (abs (xDL)) + sqrt (abs (xDC)))) { @@ -482,7 +482,7 @@ HSV::distance (const HSV& other) const xDL /= whtL; xDC /= whtC * xSC; xDH /= whtH * xSH; - + return sqrt ((xDL * xDL) + (xDC * xDC) + (xDH * xDH)); } @@ -630,7 +630,7 @@ HSV SVAModifier::operator () (HSV& hsv) const { HSV r (hsv); - + switch (type) { case Add: r.s += _s; diff --git a/libs/canvas/colorspace.cc b/libs/canvas/colorspace.cc index f4480e7dc0..50cbac8fb1 100644 --- a/libs/canvas/colorspace.cc +++ b/libs/canvas/colorspace.cc @@ -373,16 +373,16 @@ void Rgb2Hsv(double *H, double *S, double *V, double R, double G, double B) double Max = MAX3(R, G, B); double Min = MIN3(R, G, B); double C = Max - Min; - - + + *V = Max; - + if(C > 0) { if(Max == R) { *H = (G - B) / C; - + if(G < B) *H += 6; } @@ -390,7 +390,7 @@ void Rgb2Hsv(double *H, double *S, double *V, double R, double G, double B) *H = 2 + (B - R) / C; else *H = 4 + (R - G) / C; - + *H *= 60; *S = C / Max; } @@ -419,12 +419,12 @@ void Hsv2Rgb(double *R, double *G, double *B, double H, double S, double V) double C = S * V; double Min = V - C; double X; - - + + H -= 360*floor(H/360); H /= 60; X = C*(1 - fabs(H - 2*floor(H/2) - 1)); - + switch((int)H) { case 0: @@ -485,16 +485,16 @@ void Rgb2Hsl(double *H, double *S, double *L, double R, double G, double B) double Max = MAX3(R, G, B); double Min = MIN3(R, G, B); double C = Max - Min; - - + + *L = (Max + Min)/2; - + if(C > 0) { if(Max == R) { *H = (G - B) / C; - + if(G < B) *H += 6; } @@ -502,7 +502,7 @@ void Rgb2Hsl(double *H, double *S, double *L, double R, double G, double B) *H = 2 + (B - R) / C; else *H = 4 + (R - G) / C; - + *H *= 60; *S = (*L <= 0.5) ? (C/(2*(*L))) : (C/(2 - 2*(*L))); } @@ -531,12 +531,12 @@ void Hsl2Rgb(double *R, double *G, double *B, double H, double S, double L) double C = (L <= 0.5) ? (2*L*S) : ((2 - 2*L)*S); double Min = L - 0.5*C; double X; - - + + H -= 360*floor(H/360); H /= 60; X = C*(1 - fabs(H - 2*floor(H/2) - 1)); - + switch((int)H) { case 0: @@ -594,15 +594,15 @@ void Rgb2Hsi(double *H, double *S, double *I, double R, double G, double B) { double alpha = 0.5*(2*R - G - B); double beta = 0.866025403784439*(G - B); - - + + *I = (R + G + B)/3; - + if(*I > 0) { *S = 1 - MIN3(R,G,B) / *I; *H = atan2(beta, alpha)*(180/M_PI); - + if(*H < 0) *H += 360; } @@ -629,7 +629,7 @@ void Rgb2Hsi(double *H, double *S, double *I, double R, double G, double B) void Hsi2Rgb(double *R, double *G, double *B, double H, double S, double I) { H -= 360*floor(H/360); - + if(H < 120) { *B = I*(1 - S); @@ -695,16 +695,16 @@ void Rgb2Xyz(double *X, double *Y, double *Z, double R, double G, double B) * Wikipedia: http://en.wikipedia.org/wiki/CIE_1931_color_space */ void Xyz2Rgb(double *R, double *G, double *B, double X, double Y, double Z) -{ +{ double R1, B1, G1, Min; - - + + R1 = (double)( 3.2406*X - 1.5372*Y - 0.4986*Z); G1 = (double)(-0.9689*X + 1.8758*Y + 0.0415*Z); B1 = (double)( 0.0557*X - 0.2040*Y + 1.0570*Z); - + Min = MIN3(R1, G1, B1); - + /* Force nonnegative values so that gamma correction is well-defined. */ if(Min < 0) { @@ -770,9 +770,9 @@ void Lab2Xyz(double *X, double *Y, double *Z, double L, double a, double b) * Wikipedia: http://en.wikipedia.org/wiki/CIELUV_color_space */ void Xyz2Luv(double *L, double *u, double *v, double X, double Y, double Z) -{ +{ double u1, v1, Denom; - + if((Denom = X + 15*Y + 3*Z) > 0) { @@ -802,13 +802,13 @@ void Luv2Xyz(double *X, double *Y, double *Z, double L, double u, double v) { *Y = (L + 16)/116; *Y = WHITEPOINT_Y*LABINVF(*Y); - + if(L != 0) { u /= L; v /= L; } - + u = u/13 + WHITEPOINT_U; v = v/13 + WHITEPOINT_V; *X = (*Y) * ((9*u)/(4*v)); @@ -829,12 +829,12 @@ void Luv2Xyz(double *X, double *Y, double *Z, double L, double u, double v) void Xyz2Lch(double *L, double *C, double *H, double X, double Y, double Z) { double a, b; - - + + Xyz2Lab(L, &a, &b, X, Y, Z); *C = sqrt(a*a + b*b); *H = atan2(b, a)*180.0/M_PI; - + if(*H < 0) *H += 360; } @@ -849,8 +849,8 @@ void Lch2Xyz(double *X, double *Y, double *Z, double L, double C, double H) { double a = C * cos(H*(M_PI/180.0)); double b = C * sin(H*(M_PI/180.0)); - - + + Lab2Xyz(X, Y, Z, L, a, b); } diff --git a/libs/canvas/curve.cc b/libs/canvas/curve.cc index 78d47f07e9..280a3e3aaa 100644 --- a/libs/canvas/curve.cc +++ b/libs/canvas/curve.cc @@ -101,7 +101,7 @@ Curve::render (Rect const & area, Cairo::RefPtr context) const * section of the curve. For now we rely on cairo clipping to help * with this. */ - + setup_outline_context (context); @@ -165,7 +165,7 @@ Curve::render (Rect const & area, Cairo::RefPtr context) const draw = draw.expand (4.0); /* now clip it to the actual points in the curve */ - + if (draw.x0 < w1.x) { draw.x0 = w1.x; } diff --git a/libs/canvas/debug.cc b/libs/canvas/debug.cc index be5b3a033d..086c69b7a7 100644 --- a/libs/canvas/debug.cc +++ b/libs/canvas/debug.cc @@ -55,7 +55,7 @@ ArdourCanvas::checkpoint (string group, string message) now.tv_usec += 1e6; --now.tv_sec; } - + map::iterator last = last_time.find (group); if (last != last_time.end ()) { diff --git a/libs/canvas/fill.cc b/libs/canvas/fill.cc index bf72c678aa..42fe155684 100644 --- a/libs/canvas/fill.cc +++ b/libs/canvas/fill.cc @@ -84,19 +84,19 @@ void Fill::setup_gradient_context (Cairo::RefPtr context, Rect const & self, Duple const & draw_origin) const { Cairo::RefPtr _gradient; - + if (_vertical_gradient) { _gradient = Cairo::LinearGradient::create (draw_origin.x, self.y0, draw_origin.x, self.y1); } else { _gradient = Cairo::LinearGradient::create (self.x0, draw_origin.y, self.x1, draw_origin.y); } - + for (StopList::const_iterator s = _stops.begin(); s != _stops.end(); ++s) { double r, g, b, a; color_to_rgba (s->second, r, g, b, a); _gradient->add_color_stop_rgba (s->first, r, g, b, a); } - + context->set_source (_gradient); } diff --git a/libs/canvas/flag.cc b/libs/canvas/flag.cc index e3e9e409a2..2d0bdb2830 100644 --- a/libs/canvas/flag.cc +++ b/libs/canvas/flag.cc @@ -77,7 +77,7 @@ Flag::set_text (string const & text) assert (bbox); Duple flag_size (bbox.get().width() + 10, bbox.get().height() + 4); - + if (_invert) { const Distance h = fabs(_line->y1() - _line->y0()); _text->set_position (Duple (5, h - flag_size.y + 2)); diff --git a/libs/canvas/image.cc b/libs/canvas/image.cc index d6c42d28ef..b42c7053a8 100644 --- a/libs/canvas/image.cc +++ b/libs/canvas/image.cc @@ -53,7 +53,7 @@ Image::render (Rect const& area, Cairo::RefPtr context) const _pending->stride); _current = _pending; } - + Rect self = item_to_window (Rect (0, 0, _width, _height)); boost::optional draw = self.intersection (area); @@ -103,5 +103,5 @@ Image::accept_data () begin_change (); _need_render = true; end_change (); // notify canvas that we need redrawing -} +} diff --git a/libs/canvas/item.cc b/libs/canvas/item.cc index ab68ea2e95..47eb77d7a3 100644 --- a/libs/canvas/item.cc +++ b/libs/canvas/item.cc @@ -46,7 +46,7 @@ Item::Item (Canvas* canvas) , _ignore_events (false) { DEBUG_TRACE (DEBUG::CanvasItems, string_compose ("new canvas item %1\n", this)); -} +} Item::Item (Item* parent) : Fill (*this) @@ -66,7 +66,7 @@ Item::Item (Item* parent) } find_scroll_parent (); -} +} Item::Item (Item* parent, Duple const& p) : Fill (*this) @@ -88,7 +88,7 @@ Item::Item (Item* parent, Duple const& p) find_scroll_parent (); -} +} Item::~Item () { @@ -196,7 +196,7 @@ void Item::item_to_canvas (Coord& x, Coord& y) const { Duple d = item_to_canvas (Duple (x, y)); - + x = d.x; y = d.y; } @@ -268,16 +268,16 @@ Item::set_position (Duple p) */ pre_change_parent_bounding_box = item_to_parent (bbox.get()); } - + _position = p; /* only update canvas and parent if visible. Otherwise, this will be done when ::show() is called. */ - + if (visible()) { _canvas->item_moved (this, pre_change_parent_bounding_box); - + if (_parent) { _parent->child_changed (); @@ -347,7 +347,7 @@ Item::hide () } } - + propagate_show_hide (); } } @@ -376,11 +376,11 @@ void Item::propagate_show_hide () { /* bounding box may have changed while we were hidden */ - + if (_parent) { _parent->child_changed (); } - + _canvas->item_shown_or_hidden (this); } @@ -450,7 +450,7 @@ Item::find_scroll_parent () } i = i->parent(); } - + _scroll_parent = const_cast (last_scroll_group); } @@ -461,7 +461,7 @@ Item::common_ancestor_within (uint32_t limit, const Item& other) const uint32_t d2 = other.depth(); const Item* i1 = this; const Item* i2 = &other; - + /* move towards root until we are at the same level for both items */ @@ -502,7 +502,7 @@ Item::common_ancestor_within (uint32_t limit, const Item& other) const return false; } } - + return true; } @@ -544,7 +544,7 @@ Item::closest_ancestor_with (const Item& other) const i2 = i2->parent (); } } - + return i1; } @@ -611,7 +611,7 @@ Item::redraw () const if (visible() && _bounding_box && _canvas) { _canvas->request_redraw (item_to_window (_bounding_box.get())); } -} +} void Item::begin_change () @@ -624,7 +624,7 @@ Item::end_change () { if (visible()) { _canvas->item_changed (this, _pre_change_bounding_box); - + if (_parent) { _parent->child_changed (); } @@ -677,7 +677,7 @@ Item::get_data (string const & key) const if (i == _data.end ()) { return 0; } - + return i->second; } @@ -745,7 +745,7 @@ Item::render_children (Rect const & area, Cairo::RefPtr context) #endif ++render_depth; - + for (std::vector::const_iterator i = items.begin(); i != items.end(); ++i) { if (!(*i)->visible ()) { @@ -756,7 +756,7 @@ Item::render_children (Rect const & area, Cairo::RefPtr context) #endif continue; } - + boost::optional item_bbox = (*i)->bounding_box (); if (!item_bbox) { @@ -767,10 +767,10 @@ Item::render_children (Rect const & area, Cairo::RefPtr context) #endif continue; } - + Rect item = (*i)->item_to_window (item_bbox.get(), false); boost::optional d = item.intersection (area); - + if (d) { Rect draw = d.get(); if (draw.width() && draw.height()) { @@ -891,7 +891,7 @@ Item::remove (Item* i) _items.remove (i); invalidate_lut (); _bounding_box_dirty = true; - + end_change (); } @@ -925,7 +925,7 @@ Item::clear_items (bool with_delete) _items.erase (i); item->unparent (); - + if (with_delete) { delete item; } @@ -1069,7 +1069,7 @@ Item::dump (ostream& o) const o << _canvas->indent() << whatami() << ' ' << this << " self-Visible ? " << self_visible() << " visible ? " << visible(); o << " @ " << position(); - + #ifdef CANVAS_DEBUG if (!name.empty()) { o << ' ' << name; @@ -1093,25 +1093,25 @@ Item::dump (ostream& o) const o << " Items: " << _items.size(); o << " Self-Visible ? " << self_visible(); o << " Visible ? " << visible(); - + boost::optional bb = bounding_box(); - + if (bb) { o << endl << _canvas->indent() << " bbox: " << bb.get(); o << endl << _canvas->indent() << " CANVAS bbox: " << item_to_canvas (bb.get()); } else { o << " bbox unset"; } - + o << endl; #endif - + ArdourCanvas::dump_depth++; - + for (list::const_iterator i = _items.begin(); i != _items.end(); ++i) { o << **i; } - + ArdourCanvas::dump_depth--; } } diff --git a/libs/canvas/line.cc b/libs/canvas/line.cc index 8bd26b9067..49d2987e3d 100644 --- a/libs/canvas/line.cc +++ b/libs/canvas/line.cc @@ -43,7 +43,7 @@ void Line::compute_bounding_box () const { Rect bbox; - + bbox.x0 = min (_points[0].x, _points[1].x); bbox.y0 = min (_points[0].y, _points[1].y); bbox.x1 = max (_points[0].x, _points[1].x); @@ -66,7 +66,7 @@ Line::render (Rect const & /*area*/, Cairo::RefPtr context) cons if (_outline_width <= 1.0) { /* See Cairo FAQ on single pixel lines to understand why we add 0.5 */ - + const Duple half_a_pixel (0.5, 0.5); p0 = p0.translate (half_a_pixel); p1 = p1.translate (half_a_pixel); @@ -82,10 +82,10 @@ Line::set (Duple a, Duple b) { if (a != _points[0] || b != _points[1]) { begin_change (); - + _points[0] = a; _points[1] = b; - + _bounding_box_dirty = true; end_change (); } @@ -96,23 +96,23 @@ Line::set_x (Coord x0, Coord x1) { if (x0 != _points[0].x || x1 != _points[1].x) { begin_change (); - + _points[0].x = x0; _points[1].x = x1; - + _bounding_box_dirty = true; end_change (); } -} +} void Line::set_x0 (Coord x0) { if (x0 != _points[0].x) { begin_change (); - + _points[0].x = x0; - + _bounding_box_dirty = true; end_change (); } @@ -123,9 +123,9 @@ Line::set_y0 (Coord y0) { if (y0 != _points[0].y) { begin_change (); - + _points[0].y = y0; - + _bounding_box_dirty = true; end_change (); } @@ -138,9 +138,9 @@ Line::set_x1 (Coord x1) { if (x1 != _points[1].x) { begin_change (); - + _points[1].x = x1; - + _bounding_box_dirty = true; end_change (); } @@ -151,9 +151,9 @@ Line::set_y1 (Coord y1) { if (y1 != _points[1].y) { begin_change (); - + _points[1].y = y1; - + _bounding_box_dirty = true; end_change (); } diff --git a/libs/canvas/line_set.cc b/libs/canvas/line_set.cc index 54fe980b1c..03f2f0abf1 100644 --- a/libs/canvas/line_set.cc +++ b/libs/canvas/line_set.cc @@ -54,7 +54,7 @@ LineSet::compute_bounding_box () const } else { if (_orientation == Horizontal) { - + _bounding_box = Rect (0, /* x0 */ _lines.front().pos - (_lines.front().width/2.0), /* y0 */ _extent, /* x1 */ @@ -62,7 +62,7 @@ LineSet::compute_bounding_box () const ); } else { - + _bounding_box = Rect (_lines.front().pos - _lines.front().width/2.0, /* x0 */ 0, /* y0 */ _lines.back().pos + _lines.back().width/2.0, /* x1 */ @@ -101,9 +101,9 @@ LineSet::render (Rect const & area, Cairo::RefPtr context) const } boost::optional isect = self.intersection (area); - + if (!isect) { - continue; + continue; } Rect intersection (isect.get()); @@ -134,7 +134,7 @@ void LineSet::add (Coord y, Distance width, Color color) { begin_change (); - + _lines.push_back (Line (y, width, color)); sort (_lines.begin(), _lines.end(), LineSorter()); diff --git a/libs/canvas/lookup_table.cc b/libs/canvas/lookup_table.cc index c50f010dc8..3836ccd18a 100644 --- a/libs/canvas/lookup_table.cc +++ b/libs/canvas/lookup_table.cc @@ -92,11 +92,11 @@ DumbLookupTable::has_item_at_point (Duple const & point) const if (!(*i)->visible()) { continue; } - + if ((*i)->covers (point)) { // std::cerr << "\t\t" << (*i)->whatami() << '/' << (*i)->name << " covers " << point << std::endl; return true; - + } } @@ -235,7 +235,7 @@ OptimizingLookupTable::items_at_point (Duple const & point) const if (y >= _dimension) { cout << "WARNING: y=" << y << ", dim=" << _dimension << ", py=" << point.y << " cellsize=" << _cell_size << "\n"; } - + /* XXX: hmm */ x = min (_dimension - 1, x); y = min (_dimension - 1, y); @@ -272,7 +272,7 @@ OptimizingLookupTable::has_item_at_point (Duple const & point) const if (y >= _dimension) { cout << "WARNING: y=" << y << ", dim=" << _dimension << ", py=" << point.y << " cellsize=" << _cell_size << "\n"; } - + /* XXX: hmm */ x = min (_dimension - 1, x); y = min (_dimension - 1, y); @@ -294,7 +294,7 @@ OptimizingLookupTable::has_item_at_point (Duple const & point) const return false; } - + /** @param area Area in our owning item's coordinates */ vector OptimizingLookupTable::get (Rect const & area) @@ -321,7 +321,7 @@ OptimizingLookupTable::get (Rect const & area) vector vitems; copy (items.begin (), items.end (), back_inserter (vitems)); - + return vitems; } diff --git a/libs/canvas/pixbuf.cc b/libs/canvas/pixbuf.cc index d285c41b10..5bb9e63d1e 100644 --- a/libs/canvas/pixbuf.cc +++ b/libs/canvas/pixbuf.cc @@ -41,7 +41,7 @@ Pixbuf::render (Rect const & /*area*/, Cairo::RefPtr context) co Gdk::Cairo::set_source_pixbuf (context, _pixbuf, 0, 0); context->paint (); } - + void Pixbuf::compute_bounding_box () const { @@ -58,7 +58,7 @@ void Pixbuf::set (Glib::RefPtr pixbuf) { begin_change (); - + _pixbuf = pixbuf; _bounding_box_dirty = true; diff --git a/libs/canvas/poly_item.cc b/libs/canvas/poly_item.cc index b6c97c3a3b..855140856e 100644 --- a/libs/canvas/poly_item.cc +++ b/libs/canvas/poly_item.cc @@ -40,12 +40,12 @@ PolyItem::PolyItem (Item* parent) void PolyItem::compute_bounding_box () const { - + if (!_points.empty()) { Rect bbox; Points::const_iterator i = _points.begin(); - + bbox.x0 = bbox.x1 = i->x; bbox.y0 = bbox.y1 = i->y; @@ -61,11 +61,11 @@ PolyItem::compute_bounding_box () const _bounding_box = bbox.expand (_outline_width + 0.5); - + } else { _bounding_box = boost::optional (); } - + _bounding_box_dirty = false; } @@ -113,14 +113,14 @@ PolyItem::render_curve (Rect const & area, Cairo::RefPtr context Duple c2 = item_to_window (Duple (cp2->x, cp2->y)); c = item_to_window (Duple (p->x, p->y)); - + context->curve_to (c1.x + pixel_adjust, c1.y + pixel_adjust, c2.x + pixel_adjust, c2.y + pixel_adjust, c.x + pixel_adjust, c.y + pixel_adjust); - + ++cp1; ++cp2; ++p; @@ -133,9 +133,9 @@ PolyItem::set (Points const & points) if (_points != points) { begin_change (); - + _points = points; - + _bounding_box_dirty = true; end_change (); } diff --git a/libs/canvas/poly_line.cc b/libs/canvas/poly_line.cc index 3150907db6..5d6abb9814 100644 --- a/libs/canvas/poly_line.cc +++ b/libs/canvas/poly_line.cc @@ -77,7 +77,7 @@ PolyLine::covers (Duple const & point) const Duple p = window_to_item (point); const Points::size_type npoints = _points.size(); - + if (npoints < 2) { return false; } @@ -95,30 +95,30 @@ PolyLine::covers (Duple const & point) const double t; Duple a (_points[j]); Duple b (_points[i]); - + /* Clamp the line endpoints to the visible area of the canvas. If we do not do this, we may have a line segment extending to COORD_MAX and our math goes wrong. */ - + a.x = std::min (a.x, visible.x1); a.y = std::min (a.y, visible.y1); b.x = std::min (b.x, visible.x1); b.y = std::min (b.y, visible.y1); - + double d = distance_to_segment_squared (p, a, b, t, at); - + if (t < 0.0 || t > 1.0) { continue; } - + if (d < _threshold + _outline_width) { return true; } - + } - + return false; } diff --git a/libs/canvas/polygon.cc b/libs/canvas/polygon.cc index 5aa58eb614..53fea1c5f4 100644 --- a/libs/canvas/polygon.cc +++ b/libs/canvas/polygon.cc @@ -48,7 +48,7 @@ Polygon::render (Rect const & area, Cairo::RefPtr context) const { if (_outline || _fill) { render_path (area, context); - + if (!_points.empty ()) { /* close path */ Duple p = item_to_window (Duple (_points.front().x, _points.front().y)); @@ -119,11 +119,11 @@ Polygon::covers (Duple const & point) const Points::size_type i; Points::size_type j = npoints -1; bool oddNodes = false; - + if (_bounding_box_dirty) { compute_bounding_box (); } - + for (i = 0; i < npoints; i++) { if (((_points[i].y < p.y && _points[j].y >= p.y) || (_points[j].y < p.y && _points[i].y >= p.y))) { oddNodes ^= (p.y * multiple[i] + constant[i] < p.x); diff --git a/libs/canvas/rectangle.cc b/libs/canvas/rectangle.cc index e6ff6b37d0..64cdd3af8a 100644 --- a/libs/canvas/rectangle.cc +++ b/libs/canvas/rectangle.cc @@ -72,7 +72,7 @@ void Rectangle::render_self (Rect const & area, Cairo::RefPtr context, Rect self) const { boost::optional r = self.intersection (area); - + if (!r) { return; } @@ -89,11 +89,11 @@ Rectangle::render_self (Rect const & area, Cairo::RefPtr context context->rectangle (draw.x0, draw.y0, draw.width(), draw.height()); context->fill (); } - + if (_outline) { setup_outline_context (context); - + /* the goal here is that if the border is 1 pixel * thick, it will precisely align with the corner * coordinates of the rectangle. So if the rectangle @@ -111,9 +111,9 @@ Rectangle::render_self (Rect const & area, Cairo::RefPtr context const double shift = _outline_width * 0.5; self = self.translate (Duple (shift, shift)); } - + if (_outline_what == What (LEFT|RIGHT|BOTTOM|TOP)) { - + context->rectangle (self.x0, self.y0, self.width(), self.height()); } else { @@ -122,7 +122,7 @@ Rectangle::render_self (Rect const & area, Cairo::RefPtr context context->move_to (self.x0, self.y0); context->line_to (self.x0, self.y1); } - + if (_outline_what & TOP) { context->move_to (self.x0, self.y0); context->line_to (self.x1, self.y0); @@ -132,13 +132,13 @@ Rectangle::render_self (Rect const & area, Cairo::RefPtr context context->move_to (self.x0, self.y1); context->line_to (self.x1, self.y1); } - + if (_outline_what & RIGHT) { context->move_to (self.x1, self.y0); context->line_to (self.x1, self.y1); } } - + context->stroke (); } } @@ -195,11 +195,11 @@ Rectangle::set (Rect const & r) */ if (r != _rect) { - + begin_change (); - + _rect = r; - + _bounding_box_dirty = true; end_change (); } @@ -210,9 +210,9 @@ Rectangle::set_x0 (Coord x0) { if (x0 != _rect.x0) { begin_change (); - + _rect.x0 = x0; - + _bounding_box_dirty = true; end_change (); } @@ -223,9 +223,9 @@ Rectangle::set_y0 (Coord y0) { if (y0 != _rect.y0) { begin_change (); - + _rect.y0 = y0; - + _bounding_box_dirty = true; end_change(); } @@ -236,9 +236,9 @@ Rectangle::set_x1 (Coord x1) { if (x1 != _rect.x1) { begin_change (); - + _rect.x1 = x1; - + _bounding_box_dirty = true; end_change (); } @@ -249,9 +249,9 @@ Rectangle::set_y1 (Coord y1) { if (y1 != _rect.y1) { begin_change (); - + _rect.y1 = y1; - + _bounding_box_dirty = true; end_change (); } diff --git a/libs/canvas/root_group.cc b/libs/canvas/root_group.cc index accbcb9b30..141cee4f67 100644 --- a/libs/canvas/root_group.cc +++ b/libs/canvas/root_group.cc @@ -28,7 +28,7 @@ Root::Root (Canvas* canvas) { #ifdef CANVAS_DEBUG name = "ROOT"; -#endif +#endif } void diff --git a/libs/canvas/ruler.cc b/libs/canvas/ruler.cc index b538cbb314..e3f23fb10c 100644 --- a/libs/canvas/ruler.cc +++ b/libs/canvas/ruler.cc @@ -137,7 +137,7 @@ Ruler::render (Rect const & area, Cairo::RefPtr cr) const cr->stroke (); /* draw ticks + text */ - + Glib::RefPtr layout = Pango::Layout::create (cr); if (_font_description) { layout->set_font_description (*_font_description); @@ -155,7 +155,7 @@ Ruler::render (Rect const & area, Cairo::RefPtr cr) const } else { cr->move_to (pos.x, pos.y); } - + switch (m->style) { case Mark::Major: if (_divide_height >= 0) { @@ -180,7 +180,7 @@ Ruler::render (Rect const & area, Cairo::RefPtr cr) const layout->set_text (m->label); logical = layout->get_pixel_logical_extents (); - + if (_divide_height >= 0) { cr->move_to (pos.x + 2.0, self.y0 + _divide_height + logical.get_y() + 2.0); /* 2 pixel padding below divider */ } else { diff --git a/libs/canvas/scroll_group.cc b/libs/canvas/scroll_group.cc index aecea962f6..9e7732b8d2 100644 --- a/libs/canvas/scroll_group.cc +++ b/libs/canvas/scroll_group.cc @@ -29,13 +29,13 @@ using namespace ArdourCanvas; ScrollGroup::ScrollGroup (Canvas* c, ScrollSensitivity s) : Container (c) - , _scroll_sensitivity (s) + , _scroll_sensitivity (s) { } ScrollGroup::ScrollGroup (Item* parent, ScrollSensitivity s) : Container (parent) - , _scroll_sensitivity (s) + , _scroll_sensitivity (s) { } @@ -63,7 +63,7 @@ ScrollGroup::render (Rect const & area, Cairo::RefPtr context) c context->save (); context->rectangle (self.x0, self.y0, self.width(), self.height()); context->clip (); - + Container::render (area, context); context->restore (); diff --git a/libs/canvas/stateful_image.cc b/libs/canvas/stateful_image.cc index f5cc76dd03..fb0abf44d1 100644 --- a/libs/canvas/stateful_image.cc +++ b/libs/canvas/stateful_image.cc @@ -46,7 +46,7 @@ StatefulImage::render (Rect const & area, Cairo::RefPtr context) Rect self = item_to_window (Rect (0, 0, image->get_width(), image->get_height())); boost::optional draw = self.intersection (area); - + if (!draw) { return; } @@ -89,14 +89,14 @@ int StatefulImage::load_states (const XMLNode& node) { const XMLNodeList& nodes (node.children()); - + _states.clear (); - + for (XMLNodeList::const_iterator i = nodes.begin(); i != nodes.end(); ++i) { State s; States::size_type id; const XMLProperty* prop; - + if ((prop = (*i)->property ("id")) == 0) { error << _("no ID for state") << endmsg; continue; @@ -107,12 +107,12 @@ StatefulImage::load_states (const XMLNode& node) error << _("no image for state") << endmsg; continue; } - + if ((s.image = find_image (prop->value())) == 0) { error << string_compose (_("image %1 not found for state"), prop->value()) << endmsg; continue; } - + if (_states.size() < id) { _states.reserve (id); } @@ -139,7 +139,7 @@ StatefulImage::find_image (const std::string& name) name) << endmsg; return ImageHandle(); } - + return Cairo::ImageSurface::create_from_png (path); } diff --git a/libs/canvas/test/arrow.cc b/libs/canvas/test/arrow.cc index 9112b6f52a..ab973bcd2a 100644 --- a/libs/canvas/test/arrow.cc +++ b/libs/canvas/test/arrow.cc @@ -28,7 +28,7 @@ ArrowTest::bounding_box () arrow.set_outline_width (0); boost::optional bbox = arrow.bounding_box (); - + CPPUNIT_ASSERT (bbox.is_initialized ()); CPPUNIT_ASSERT (bbox.get().x0 == -6); CPPUNIT_ASSERT (bbox.get().y0 == 0); diff --git a/libs/canvas/test/group.cc b/libs/canvas/test/group.cc index 914b940c5e..31b7d13e49 100644 --- a/libs/canvas/test/group.cc +++ b/libs/canvas/test/group.cc @@ -87,7 +87,7 @@ GroupTest::layers () CPPUNIT_ASSERT (*i++ == &d); /* Check raise by a number of levels */ - + a.raise (2); i = canvas.root()->items().begin(); @@ -173,7 +173,7 @@ GroupTest::grandchildren_changing () /* Change the grandchild and check its parent and grandparent */ a.set (Rect (0, 0, 48, 48)); - bbox = canvas.root()->bounding_box (); + bbox = canvas.root()->bounding_box (); CPPUNIT_ASSERT (bbox.is_initialized ()); CPPUNIT_ASSERT (bbox.get().x0 == 0); CPPUNIT_ASSERT (bbox.get().y0 == 0); @@ -193,7 +193,7 @@ void GroupTest::add_items_at_point () { ImageCanvas canvas; - + Group gA (canvas.root()); gA.set_position (Duple (128, 64)); @@ -274,7 +274,7 @@ GroupTest::torture_add_items_at_point () if (canvas.root()->bounding_box() && canvas.root()->bounding_box().get().contains (test)) { items_B.push_back (canvas.root()); } - + for (list::iterator j = rectangles.begin(); j != rectangles.end(); ++j) { boost::optional bbox = (*j)->bounding_box (); assert (bbox); @@ -293,4 +293,4 @@ GroupTest::torture_add_items_at_point () } } } - + diff --git a/libs/canvas/test/gtk_drag.cc b/libs/canvas/test/gtk_drag.cc index 8628c4cfd4..6e20352199 100644 --- a/libs/canvas/test/gtk_drag.cc +++ b/libs/canvas/test/gtk_drag.cc @@ -14,7 +14,7 @@ event (GdkEvent* ev) { static bool dragging = false; static Duple offset; - + if (ev->type == GDK_BUTTON_PRESS) { GdkEventButton* b = reinterpret_cast (ev); if (b->button == 1) { @@ -38,7 +38,7 @@ event (GdkEvent* ev) cout << "Move to " << (Duple (m->x, m->y) - offset) << "\n"; } } - + return true; } @@ -62,7 +62,7 @@ int main (int argc, char* argv[]) window.add (viewport); canvas->show (); window.show_all (); - + Gtk::Main::run (window); return 0; } diff --git a/libs/canvas/test/gtk_many.cc b/libs/canvas/test/gtk_many.cc index e75ce05ac0..dda35e4714 100644 --- a/libs/canvas/test/gtk_many.cc +++ b/libs/canvas/test/gtk_many.cc @@ -20,20 +20,20 @@ int main (int argc, char* argv[]) double Ns = sqrt (N); int max_x = 1024; int max_y = 1024; - + for (int x = 0; x < Ns; ++x) { for (int y = 0; y < Ns; ++y) { Rectangle* r = new Rectangle (canvas.root ()); r->set (Rect (x * max_x / Ns, y * max_y / Ns, (x + 1) * max_x / Ns, (y + 1) * max_y / Ns)); } } - + Gtk::ScrolledWindow scroller; scroller.add (canvas); window.add (scroller); canvas.show (); window.show_all (); - + Gtk::Main::run (window); return 0; } diff --git a/libs/canvas/test/gtk_movement.cc b/libs/canvas/test/gtk_movement.cc index 24a517da71..aef29eb04b 100644 --- a/libs/canvas/test/gtk_movement.cc +++ b/libs/canvas/test/gtk_movement.cc @@ -69,7 +69,7 @@ int main (int argc, char* argv[]) overall_box.pack_start (scroller); Gtk::HBox button_box; - + Gtk::Button bigger ("Bigger"); bigger.signal_clicked().connect (sigc::ptr_fun (&bigger_clicked)); button_box.pack_start (bigger); @@ -85,9 +85,9 @@ int main (int argc, char* argv[]) Gtk::Button right ("Right"); right.signal_clicked().connect (sigc::ptr_fun (&right_clicked)); button_box.pack_start (right); - + overall_box.pack_start (button_box, false, false); - + window.add (overall_box); canvas.show (); window.show_all (); diff --git a/libs/canvas/test/gtk_scene.cc b/libs/canvas/test/gtk_scene.cc index 95e9b9c299..8e30361d94 100644 --- a/libs/canvas/test/gtk_scene.cc +++ b/libs/canvas/test/gtk_scene.cc @@ -26,7 +26,7 @@ int main (int argc, char* argv[]) Gtk::VBox overall_vbox; Gtk::HScrollbar h_scroll; Gtk::VScrollbar v_scroll; - + GtkCanvasViewport viewport (*h_scroll.get_adjustment(), *v_scroll.get_adjustment()); GtkCanvas* canvas = viewport.canvas (); @@ -60,7 +60,7 @@ int main (int argc, char* argv[]) window.add (overall_vbox); canvas->show (); window.show_all (); - + Gtk::Main::run (window); return 0; } diff --git a/libs/canvas/test/gtk_viewport.cc b/libs/canvas/test/gtk_viewport.cc index 90bf819d86..a9c326bc7a 100644 --- a/libs/canvas/test/gtk_viewport.cc +++ b/libs/canvas/test/gtk_viewport.cc @@ -37,7 +37,7 @@ int main (int argc, char* argv[]) b.set_outline_color (0x00ff00ff); Gtk::HBox button_box; - + Gtk::Button left ("Left"); left.signal_clicked().connect (sigc::ptr_fun (&left_clicked)); button_box.pack_start (left); @@ -48,18 +48,18 @@ int main (int argc, char* argv[]) hadj = new Gtk::Adjustment (0, 0, 1e3); vadj = new Gtk::Adjustment (0, 0, 1e3); - + Gtk::Viewport viewport (*hadj, *vadj); viewport.add (canvas); Gtk::VBox overall_box; overall_box.pack_start (viewport); overall_box.pack_start (button_box, false, false); - + window.add (overall_box); canvas.show (); window.show_all (); - + Gtk::Main::run (window); return 0; } diff --git a/libs/canvas/test/optimizing_lookup_table.cc b/libs/canvas/test/optimizing_lookup_table.cc index 8449b26498..6022ff3797 100644 --- a/libs/canvas/test/optimizing_lookup_table.cc +++ b/libs/canvas/test/optimizing_lookup_table.cc @@ -23,7 +23,7 @@ OptimizingLookupTableTest::build_1 () Rectangle d (canvas.root(), Rect (33, 33, 64, 64)); d.set_outline_width (0); OptimizingLookupTable table (*canvas.root(), 1); - + CPPUNIT_ASSERT (table._items_per_cell == 1); CPPUNIT_ASSERT (table._cell_size.x == 32); CPPUNIT_ASSERT (table._cell_size.y == 32); @@ -65,10 +65,10 @@ OptimizingLookupTableTest::get_small () Rectangle d (canvas.root(), Rect (33, 33, 64, 64)); d.set_outline_width (0); OptimizingLookupTable table (*canvas.root(), 1); - + vector items = table.get (Rect (16, 16, 48, 48)); CPPUNIT_ASSERT (items.size() == 4); - + items = table.get (Rect (32, 32, 33, 33)); CPPUNIT_ASSERT (items.size() == 1); } @@ -80,7 +80,7 @@ OptimizingLookupTableTest::get_big () double const s = 8; int const N = 1024; - + for (int x = 0; x < N; ++x) { for (int y = 0; y < N; ++y) { Rectangle* r = new Rectangle (canvas.root()); diff --git a/libs/canvas/test/render.cc b/libs/canvas/test/render.cc index 96bd7eb166..043ed83d41 100644 --- a/libs/canvas/test/render.cc +++ b/libs/canvas/test/render.cc @@ -78,7 +78,7 @@ RenderTest::basics () text_group.set_position (Duple (128, 64)); Text text (&text_group); text.set ("Hello world!"); - + canvas.render_to_image (Rect (0, 0, 256, 256)); canvas.write_to_png ("render_basics.png"); diff --git a/libs/canvas/test/types.cc b/libs/canvas/test/types.cc index 69667466de..ba6baef149 100644 --- a/libs/canvas/test/types.cc +++ b/libs/canvas/test/types.cc @@ -44,7 +44,7 @@ TypesTest::extend () CPPUNIT_ASSERT (c.y1 == 130); } } - + void TypesTest::test_safe_add () { diff --git a/libs/canvas/test/types.h b/libs/canvas/test/types.h index 3a5c0dac9b..833b234579 100644 --- a/libs/canvas/test/types.h +++ b/libs/canvas/test/types.h @@ -15,4 +15,4 @@ public: void test_safe_add (); }; - + diff --git a/libs/canvas/test/wave_view.cc b/libs/canvas/test/wave_view.cc index 9b95930cf1..de7118b90c 100644 --- a/libs/canvas/test/wave_view.cc +++ b/libs/canvas/test/wave_view.cc @@ -43,7 +43,7 @@ WaveViewTest::setUp () AudioEngine engine ("test", ""); MIDI::Manager::create (engine.jack ()); CPPUNIT_ASSERT (engine.start () == 0); - + Session session (engine, "tmp_session", "tmp_session"); engine.set_session (&session); @@ -70,7 +70,7 @@ void WaveViewTest::make_canvas () { /* this leaks various things, but hey ho */ - + _canvas = new ImageCanvas (Duple (256, 256)); _wave_view = new WaveView (_canvas->root(), _audio_region); _wave_view->set_frames_per_pixel ((double) (44100 / 1000) / 64); @@ -84,7 +84,7 @@ WaveViewTest::all () gets called once; there are various singletons etc. in Ardour which don't like being recreated. */ - + render_all_at_once (); render_in_pieces (); cache (); @@ -94,7 +94,7 @@ void WaveViewTest::render_all_at_once () { make_canvas (); - + _canvas->render_to_image (Rect (0, 0, 256, 256)); _canvas->write_to_png ("waveview_1.png"); @@ -119,11 +119,11 @@ void WaveViewTest::cache () { make_canvas (); - + /* Whole of the render area needs caching from scratch */ - + _wave_view->invalidate_whole_cache (); - + Rect whole (0, 0, 256, 256); _canvas->render_to_image (whole); @@ -132,7 +132,7 @@ WaveViewTest::cache () CPPUNIT_ASSERT (_wave_view->_cache.front()->end() == 256); _wave_view->invalidate_whole_cache (); - + /* Render a bit in the middle */ Rect part1 (128, 0, 196, 256); @@ -145,11 +145,11 @@ WaveViewTest::cache () /* Now render the whole thing and check that the cache sorts itself out */ _canvas->render_to_image (whole); - + CPPUNIT_ASSERT (_wave_view->_cache.size() == 3); list::iterator i = _wave_view->_cache.begin (); - + CPPUNIT_ASSERT ((*i)->start() == 0); CPPUNIT_ASSERT ((*i)->end() == 128); ++i; diff --git a/libs/canvas/test/xml.cc b/libs/canvas/test/xml.cc index ef6871dc76..5bc5dec2b7 100644 --- a/libs/canvas/test/xml.cc +++ b/libs/canvas/test/xml.cc @@ -29,7 +29,7 @@ XMLTest::get () g.set_position (Duple (64, 72)); Line l (&g); l.set (Duple (41, 43), Duple (44, 46)); - + XMLTree* tree = canvas.get_state (); tree->write ("test.xml"); diff --git a/libs/canvas/test/xml.h b/libs/canvas/test/xml.h index fbe606c028..bf905b94bd 100644 --- a/libs/canvas/test/xml.h +++ b/libs/canvas/test/xml.h @@ -12,6 +12,6 @@ public: void get (); void set (); -private: +private: void check (std::string const &); }; diff --git a/libs/canvas/text.cc b/libs/canvas/text.cc index fbf7d7943c..d1f76eb1a3 100644 --- a/libs/canvas/text.cc +++ b/libs/canvas/text.cc @@ -71,7 +71,7 @@ void Text::set (string const & text) { begin_change (); - + _text = text; _need_redraw = true; @@ -134,7 +134,7 @@ Text::_redraw () const #else _image = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, _width, _height); #endif - + Cairo::RefPtr img_context = Cairo::Context::create (_image); #ifdef __APPLE__ @@ -142,7 +142,7 @@ Text::_redraw () const */ img_context->scale (2, 2); #endif - + /* and draw, in the appropriate color of course */ if (_outline) { @@ -173,7 +173,7 @@ Text::render (Rect const & area, Cairo::RefPtr context) const Rect self = item_to_window (Rect (0, 0, min (_clamped_width, (double)_image->get_width ()), _image->get_height ())); boost::optional i = self.intersection (area); - + if (!i) { return; } @@ -181,7 +181,7 @@ Text::render (Rect const & area, Cairo::RefPtr context) const if (_need_redraw) { _redraw (); } - + Rect intersection (i.get()); context->rectangle (intersection.x0, intersection.y0, intersection.width(), intersection.height()); @@ -238,7 +238,7 @@ void Text::set_alignment (Pango::Alignment alignment) { begin_change (); - + _alignment = alignment; _need_redraw = true; _bounding_box_dirty = true; @@ -249,7 +249,7 @@ void Text::set_font_description (Pango::FontDescription font_description) { begin_change (); - + _font_description = new Pango::FontDescription (font_description); _need_redraw = true; _width_correction = -1.0; @@ -272,7 +272,7 @@ Text::set_color (Color color) end_change (); } - + void Text::dump (ostream& o) const { diff --git a/libs/canvas/tracking_text.cc b/libs/canvas/tracking_text.cc index 7f945dc7ce..1b3004b3b1 100644 --- a/libs/canvas/tracking_text.cc +++ b/libs/canvas/tracking_text.cc @@ -70,7 +70,7 @@ TrackingText::pointer_motion (Duple const & winpos) pos = pos.translate (offset); /* keep inside the window */ - + Rect r (0, 0, _canvas->width(), _canvas->height()); /* border of 200 pixels on the right, and 50 on all other sides */ @@ -83,7 +83,7 @@ TrackingText::pointer_motion (Duple const & winpos) r.y1 = std::max (r.y0, (r.y1 - border)); /* clamp */ - + if (pos.x < r.x0) { pos.x = r.x0; } else if (pos.x > r.x1) { diff --git a/libs/canvas/utils.cc b/libs/canvas/utils.cc index 7b81cf5951..2c8905b331 100644 --- a/libs/canvas/utils.cc +++ b/libs/canvas/utils.cc @@ -94,7 +94,7 @@ ArdourCanvas::distance_to_segment_squared (Duple const & p, Duple const & p1, Du // extending the segment, parameterized as p1 + (t * (p2 - p1)), // we find projection of point p onto the line. // It falls where t = [(p - p1) . (p2 - p1)] / |p2 - p1|^2 - + t = ((dp1x * dx) + (dp1y * dy)) / segLenSquared; if (t < kEpsilon) { diff --git a/libs/canvas/wave_view.cc b/libs/canvas/wave_view.cc index 7f0aed6dff..fce30e7f38 100644 --- a/libs/canvas/wave_view.cc +++ b/libs/canvas/wave_view.cc @@ -274,7 +274,7 @@ WaveView::compute_tips (PeakData const & peak, WaveView::LineTips& tips) const const double effective_height = _height; /* remember: canvas (and cairo) coordinate space puts the origin at the upper left. - + So, a sample value of 1.0 (0dbFS) will be computed as: (1.0 - 1.0) * 0.5 * effective_height @@ -317,11 +317,11 @@ WaveView::compute_tips (PeakData const & peak, WaveView::LineTips& tips) const tips.top = center - spread; tips.bot = center + spread; } - + tips.top = min (effective_height, max (0.0, tips.top)); tips.bot = min (effective_height, max (0.0, tips.bot)); } - + Coord WaveView::y_extent (double s) const @@ -474,7 +474,7 @@ WaveView::draw_image (Cairo::RefPtr& image, PeakData* _peak } else { p.min = 0.0; } - + compute_tips (p, tips[i]); tips[i].spread = tips[i].bot - tips[i].top; } @@ -498,7 +498,7 @@ WaveView::draw_image (Cairo::RefPtr& image, PeakData* _peak if (req->should_stop()) { return; } - + Color alpha_one = rgba_to_color (0, 0, 0, 1.0); set_source_rgba (wave_context, alpha_one); @@ -590,7 +590,7 @@ WaveView::draw_image (Cairo::RefPtr& image, PeakData* _peak wave_context->move_to (i, tips[i].top); wave_context->line_to (i, tips[i].bot); } - + /* draw square waves and other discontiguous points clearly */ if (i > 0) { if (tips[i-1].top + 2 < tips[i].top) { @@ -678,7 +678,7 @@ WaveView::draw_image (Cairo::RefPtr& image, PeakData* _peak if (req->should_stop()) { return; } - + Cairo::RefPtr context = Cairo::Context::create (image); /* Here we set a source colour and use the various components as a mask. */ @@ -722,7 +722,7 @@ WaveView::draw_image (Cairo::RefPtr& image, PeakData* _peak if (req->should_stop()) { return; } - + context->mask (images.wave, 0, 0); context->fill (); @@ -756,11 +756,11 @@ WaveView::cache_request_result (boost::shared_ptr req) co req->end, req->image)); images->add (_region->audio_source (_channel), ret); - + /* consolidate cache first (removes fully-contained * duplicate images) */ - + images->consolidate_image_cache (_region->audio_source (_channel), req->channel, req->height, req->amplitude, req->fill_color, req->samples_per_pixel); @@ -774,14 +774,14 @@ WaveView::get_image (framepos_t start, framepos_t end, bool& full_image) const boost::shared_ptr ret; full_image = true; - + /* this is called from a ::render() call, when we need an image to draw with. */ DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1 needs image from %2 .. %3\n", name, start, end)); - - + + { Glib::Threads::Mutex::Lock lmq (request_queue_lock); @@ -793,7 +793,7 @@ WaveView::get_image (framepos_t start, framepos_t end, bool& full_image) const DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1 CR %2 stop? %3 image %4\n", this, current_request, (current_request ? current_request->should_stop() : false), (current_request ? current_request->image : 0))); - + if (current_request && !current_request->should_stop() && current_request->image) { /* put the image into the cache so that other @@ -801,7 +801,7 @@ WaveView::get_image (framepos_t start, framepos_t end, bool& full_image) const */ if (current_request->start <= start && current_request->end >= end) { - + ret.reset (new WaveViewCache::Entry (current_request->channel, current_request->height, current_request->amplitude, @@ -810,7 +810,7 @@ WaveView::get_image (framepos_t start, framepos_t end, bool& full_image) const current_request->start, current_request->end, current_request->image)); - + cache_request_result (current_request); DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1: got image from completed request, spans %2..%3\n", name, current_request->start, current_request->end)); @@ -824,21 +824,21 @@ WaveView::get_image (framepos_t start, framepos_t end, bool& full_image) const if (!ret) { /* no current image draw request, so look in the cache */ - + ret = get_image_from_cache (start, end, full_image); DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1: lookup from cache gave %2 (full %3)\n", name, ret, full_image)); } - - + + if (!ret || !full_image) { if ((rendered && get_image_in_thread) || always_get_image_in_thread) { DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1: generating image in caller thread\n", name)); - + boost::shared_ptr req (new WaveViewThreadRequest); req->type = WaveViewThreadRequest::Draw; @@ -853,7 +853,7 @@ WaveView::get_image (framepos_t start, framepos_t end, bool& full_image) const req->width = desired_image_width (); /* draw image in this (the GUI thread) */ - + generate_image (req, false); /* cache the result */ @@ -863,7 +863,7 @@ WaveView::get_image (framepos_t start, framepos_t end, bool& full_image) const /* reset this so that future missing images are * generated in a a worker thread. */ - + get_image_in_thread = false; } else { @@ -963,34 +963,34 @@ WaveView::generate_image (boost::shared_ptr req, bool in_ * width by using an image sample count of the screen width added * on each side of the desired image center. */ - + const framepos_t center = req->start + ((req->end - req->start) / 2); const framecnt_t image_samples = req->width; - + /* we can request data from anywhere in the Source, between 0 and its length */ - + framepos_t sample_start = max (_region_start, (center - image_samples)); framepos_t sample_end = min (center + image_samples, region_end()); const int n_peaks = llrintf ((sample_end - sample_start)/ (req->samples_per_pixel)); - + boost::scoped_array peaks (new PeakData[n_peaks]); /* Note that Region::read_peaks() takes a start position based on an offset into the Region's **SOURCE**, rather than an offset into the Region itself. */ - + framecnt_t peaks_read = _region->read_peaks (peaks.get(), n_peaks, sample_start, sample_end - sample_start, req->channel, req->samples_per_pixel); - + req->image = Cairo::ImageSurface::create (Cairo::FORMAT_ARGB32, n_peaks, req->height); /* make sure we record the sample positions that were actually used */ req->start = sample_start; req->end = sample_end; - + if (peaks_read > 0) { /* region amplitude will have been used to generate the @@ -998,7 +998,7 @@ WaveView::generate_image (boost::shared_ptr req, bool in_ * amplitude_above_axis. So apply that here before * rendering. */ - + if (_amplitude_above_axis != 1.0) { for (framecnt_t i = 0; i < n_peaks; ++i) { peaks[i].max *= _amplitude_above_axis; @@ -1012,8 +1012,8 @@ WaveView::generate_image (boost::shared_ptr req, bool in_ } } else { cerr << "Request stopped before image generation\n"; - } - + } + if (in_render_thread && !req->should_stop()) { DEBUG_TRACE (DEBUG::WaveView, string_compose ("done with request for %1 at %2 CR %3 req %4 range %5 .. %6\n", this, g_get_monotonic_time(), current_request, req, req->start, req->end)); const_cast(this)->ImageReady (); /* emit signal */ @@ -1040,7 +1040,7 @@ void WaveView::render (Rect const & area, Cairo::RefPtr context) const { assert (_samples_per_pixel != 0); - + if (!_region) { return; } @@ -1064,11 +1064,11 @@ WaveView::render (Rect const & area, Cairo::RefPtr context) cons * window coordinates. It begins at zero (in item coordinates for this * waveview, and extends to region_length() / _samples_per_pixel. */ - + Rect self = item_to_window (Rect (0.0, 0.0, region_length() / _samples_per_pixel, _height)); // cerr << name << " RENDER " << area << " self = " << self << endl; - + /* Now lets get the intersection with the area we've been asked to draw */ boost::optional d = self.intersection (area); @@ -1082,17 +1082,17 @@ WaveView::render (Rect const & area, Cairo::RefPtr context) cons /* "draw" is now a rectangle that defines the rectangle we need to * update/render the waveview into, in window coordinate space. */ - + /* window coordinates - pixels where x=0 is the left edge of the canvas * window. We round down in case we were asked to * draw "between" pixels at the start and/or end. */ - + double draw_start = floor (draw.x0); const double draw_end = floor (draw.x1); // cerr << "Need to draw " << draw_start << " .. " << draw_end << " vs. " << area << " and self = " << self << endl; - + /* image coordnates: pixels where x=0 is the start of this waveview, * wherever it may be positioned. thus image_start=N means "an image * that begins N pixels after the start of region that this waveview is @@ -1101,18 +1101,18 @@ WaveView::render (Rect const & area, Cairo::RefPtr context) cons const framepos_t image_start = window_to_image (self.x0, draw_start); const framepos_t image_end = window_to_image (self.x0, draw_end); - + // cerr << "Image/WV space: " << image_start << " .. " << image_end << endl; - + /* sample coordinates - note, these are not subject to rounding error * * "sample_start = N" means "the first sample we need to represent is N * samples after the first sample of the region" */ - + framepos_t sample_start = _region_start + (image_start * _samples_per_pixel); framepos_t sample_end = _region_start + (image_end * _samples_per_pixel); - + // cerr << "Sample space: " << sample_start << " .. " << sample_end << " @ " << _samples_per_pixel << " rs = " << _region_start << endl; /* sample_start and sample_end are bounded by the region @@ -1121,17 +1121,17 @@ WaveView::render (Rect const & area, Cairo::RefPtr context) cons */ sample_end = min (region_end(), sample_end); - + // cerr << debug_name() << " will need image spanning " << sample_start << " .. " << sample_end << " region spans " << _region_start << " .. " << region_end() << endl; double image_origin_in_self_coordinates; boost::shared_ptr image_to_draw; - + Glib::Threads::Mutex::Lock lci (current_image_lock); if (_current_image) { /* check it covers the right sample range */ - + if (_current_image->start > sample_start || _current_image->end < sample_end) { /* doesn't cover the area we need ... reset */ _current_image.reset (); @@ -1150,7 +1150,7 @@ WaveView::render (Rect const & area, Cairo::RefPtr context) cons image_to_draw = get_image (sample_start, sample_end, full_image); DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1 image to draw = %2 (full? %3)\n", name, image_to_draw, full_image)); - + if (!image_to_draw) { /* image not currently available. A redraw will be scheduled when it is ready. @@ -1171,7 +1171,7 @@ WaveView::render (Rect const & area, Cairo::RefPtr context) cons */ image_origin_in_self_coordinates = (image_to_draw->start - _region_start) / _samples_per_pixel; - + if (_start_shift && (sample_start == _region_start) && (self.x0 == draw.x0)) { /* we are going to draw the first pixel for this region, but we may not want this to overlap a border around the @@ -1181,14 +1181,14 @@ WaveView::render (Rect const & area, Cairo::RefPtr context) cons //draw_start += _start_shift; //image_origin_in_self_coordinates += _start_shift; } - + /* the image may only be a best-effort ... it may not span the entire * range requested, though it is guaranteed to cover the start. So * determine how many pixels we can actually draw. */ double draw_width; - + if (image_to_draw != _current_image) { lci.release (); @@ -1230,7 +1230,7 @@ WaveView::render (Rect const & area, Cairo::RefPtr context) cons * will appear. So specifying (10,10) will put the upper left corner of * the image at (10,10) in user space. */ - + context->set_source (image_to_draw->image, x, y); context->fill (); @@ -1262,7 +1262,7 @@ WaveView::set_height (Distance height) invalidate_image_cache (); _height = height; get_image_in_thread = true; - + _bounding_box_dirty = true; end_change (); } @@ -1468,17 +1468,17 @@ WaveView::cancel_my_render_request () const /* try to stop any current rendering of the request, or prevent it from * ever starting up. */ - + if (current_request) { current_request->cancel (); } - + Glib::Threads::Mutex::Lock lm (request_queue_lock); /* now remove it from the queue and reset our request pointer so that have no outstanding request (that we know about) */ - + request_queue.erase (this); current_request.reset (); DEBUG_TRACE (DEBUG::WaveView, string_compose ("%1 now has no request %2\n", this)); @@ -1527,7 +1527,7 @@ WaveView::drawing_thread () while (run) { /* remember that we hold the lock at this point, no matter what */ - + if (g_atomic_int_get (&drawing_thread_should_quit)) { break; } @@ -1544,7 +1544,7 @@ WaveView::drawing_thread () /* remove the request from the queue (remember: the "request" * is just a pointer to a WaveView object) */ - + requestor = *(request_queue.begin()); request_queue.erase (request_queue.begin()); @@ -1602,7 +1602,7 @@ WaveViewCache::lookup_image (boost::shared_ptr src, bool& full_coverage) { ImageCache::iterator x; - + if ((x = cache_map.find (src)) == cache_map.end ()) { /* nothing in the cache for this audio source at all */ return boost::shared_ptr (); @@ -1611,14 +1611,14 @@ WaveViewCache::lookup_image (boost::shared_ptr src, CacheLine& caches = x->second; boost::shared_ptr best_partial; framecnt_t max_coverage = 0; - + /* Find a suitable ImageSurface, if it exists. */ for (CacheLine::iterator c = caches.begin(); c != caches.end(); ++c) { boost::shared_ptr e (*c); - + if (channel != e->channel || height != e->height || amplitude != e->amplitude @@ -1673,7 +1673,7 @@ WaveViewCache::consolidate_image_cache (boost::shared_ptr s ImageCache::iterator x; /* MUST BE CALLED FROM (SINGLE) GUI THREAD */ - + if ((x = cache_map.find (src)) == cache_map.end ()) { return; } @@ -1686,7 +1686,7 @@ WaveViewCache::consolidate_image_cache (boost::shared_ptr s ++nxt; boost::shared_ptr e1 (*c1); - + if (channel != e1->channel || height != e1->height || amplitude != e1->amplitude @@ -1696,12 +1696,12 @@ WaveViewCache::consolidate_image_cache (boost::shared_ptr s /* doesn't match current properties, ignore and move on * to the next one. */ - + other_entries++; c1 = nxt; continue; } - + /* c1 now points to a cached image entry that matches current * properties. Check all subsequent cached imaged entries to * see if there are others that also match but represent @@ -1714,7 +1714,7 @@ WaveViewCache::consolidate_image_cache (boost::shared_ptr s ++nxt2; boost::shared_ptr e2 (*c2); - + if (e1 == e2 || channel != e2->channel || height != e2->height || amplitude != e2->amplitude @@ -1727,7 +1727,7 @@ WaveViewCache::consolidate_image_cache (boost::shared_ptr s c2 = nxt2; continue; } - + if (e2->start >= e1->start && e2->end <= e1->end) { /* c2 is fully contained by c1, so delete it */ caches.erase (c2); @@ -1754,7 +1754,7 @@ void WaveViewCache::add (boost::shared_ptr src, boost::shared_ptr ce) { /* MUST BE CALLED FROM (SINGLE) GUI THREAD */ - + Cairo::RefPtr img (ce->image); image_cache_size += img->get_height() * img->get_width () * 4; /* 4 = bytes per FORMAT_ARGB32 pixel */ @@ -1792,7 +1792,7 @@ void WaveViewCache::cache_flush () { /* Build a sortable list of all cache entries */ - + CacheList cache_list; for (ImageCache::const_iterator cm = cache_map.begin(); cm != cache_map.end(); ++cm) { @@ -1800,7 +1800,7 @@ WaveViewCache::cache_flush () cache_list.push_back (make_pair (cm->first, *cl)); } } - + /* sort list in LRU order */ SortByTimestamp sorter; sort (cache_list.begin(), cache_list.end(), sorter); @@ -1810,32 +1810,32 @@ WaveViewCache::cache_flush () ListEntry& le (cache_list.front()); ImageCache::iterator x; - + if ((x = cache_map.find (le.first)) != cache_map.end ()) { - + CacheLine& cl = x->second; - + for (CacheLine::iterator c = cl.begin(); c != cl.end(); ++c) { - + if (*c == le.second) { DEBUG_TRACE (DEBUG::WaveView, string_compose ("Removing cache line entry for %1\n", x->first->name())); - + /* Remove this entry from this cache line */ cl.erase (c); - + if (cl.empty()) { /* remove cache line from main cache: no more entries */ cache_map.erase (x); } - + break; } } - + Cairo::RefPtr img (le.second->image); uint64_t size = img->get_height() * img->get_width() * 4; /* 4 = bytes per FORMAT_ARGB32 pixel */ - + if (image_cache_size > size) { image_cache_size -= size; } else { diff --git a/libs/canvas/xfade_curve.cc b/libs/canvas/xfade_curve.cc index 259b0e6da5..c8e477697c 100644 --- a/libs/canvas/xfade_curve.cc +++ b/libs/canvas/xfade_curve.cc @@ -35,7 +35,7 @@ static const bool show_bg_fades = false; #else static const bool show_bg_fades = true; #endif - + XFadeCurve::XFadeCurve (Canvas* c) : Item (c) , points_per_segment (32) -- cgit v1.2.3