Invalidate line cache when zoomed out to invisible line levels.
authorDavid Robillard <d@drobilla.net>
Sun, 28 Sep 2008 15:22:07 +0000 (15:22 +0000)
committerDavid Robillard <d@drobilla.net>
Sun, 28 Sep 2008 15:22:07 +0000 (15:22 +0000)
Reduce line cache size to 128.

git-svn-id: svn://localhost/ardour2/branches/3.0@3819 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/lineset.cc
gtk2_ardour/tempo_lines.cc
libs/evoral/evoral/TypeMap.hpp

index 61e5804ed46817b0e1f587c5a362552651ed4fa5..352d9331eb427e71c62a6a8bc1c48cb1a82292fe 100644 (file)
@@ -269,7 +269,7 @@ LineSet::line_at(double coord)
        if (cached_pos != lines.end()) {
                if (coord < cached_pos->coord) {
                        /* backward search */
-                       while(--cached_pos != lines.end()) {
+                       while (--cached_pos != lines.end()) {
                                if (cached_pos->coord <= coord) {
                                        if (cached_pos->coord + cached_pos->width < coord) {
                                                /* coord is between two lines */
@@ -281,7 +281,7 @@ LineSet::line_at(double coord)
                        }
                } else {
                        /* forward search */
-                       while(cached_pos != lines.end()) {
+                       while (cached_pos != lines.end()) {
                                if (cached_pos->coord > coord) {
                                        /* we searched past the line that we want, so now see
                                           if the previous line includes the coordinate */
index 5b73c877acb53281493dec49aaa0f7ac848ab495..3d2f54a2fff78d327b156f5236fd3cc387b1698c 100644 (file)
@@ -24,7 +24,7 @@
 
 using namespace std;
 
-#define MAX_CACHED_LINES 512
+#define MAX_CACHED_LINES 128
        
 TempoLines::TempoLines(ArdourCanvas::Canvas& canvas, ArdourCanvas::Group* group)
        : _canvas(canvas)
@@ -40,7 +40,7 @@ TempoLines::tempo_map_changed()
        _clean_left = DBL_MAX;
        _clean_right = 0.0;
 
-       size_t d = 0;
+       size_t d = 1;
        // TODO: Dirty/slow, but 'needed' for zoom :(
        for (Lines::iterator i = _lines.begin(); i != _lines.end(); ++d) {
                Lines::iterator next = i;
@@ -98,6 +98,7 @@ TempoLines::draw (ARDOUR::TempoMap::BBTPointList& points, double frames_per_unit
 
        if (beat_density > 4.0f) {
                /* if the lines are too close together, they become useless */
+               tempo_map_changed();
                return;
        }
 
index 3d082fc4efe1fc35e8f2f3f213a815b3c430a3a9..3ab8066f70a08139d97b6c7de19c25147a3ac2fc 100644 (file)
@@ -30,6 +30,8 @@ class Parameter;
  */
 class TypeMap {
 public:
+       virtual ~TypeMap() {}
+
        /** Return true iff the type is a MIDI event.
         * The contents of the event will be used for specific ID
         */