148
148
xpos = rint(((nframes64_t)(*i).frame) / (double)frames_per_unit);
149
if (inserted_last_time && !_lines.empty()) {
150
li = _lines.lower_bound(xpos); // first line >= xpos
150
li = _lines.lower_bound(xpos); // first line >= xpos
153
152
line = (li != _lines.end()) ? li->second : NULL;
154
153
assert(!line || line->property_x1() == li->first);
215
214
// Create a new line
216
215
} else if (_lines.size() < needed || _lines.size() < MAX_CACHED_LINES) {
217
216
//cout << "*** CREATING LINE" << endl;
218
assert(_lines.find(xpos) == _lines.end());
219
line = new ArdourCanvas::SimpleLine (*_group);
220
line->property_x1() = xpos;
221
line->property_x2() = xpos;
222
line->property_y1() = 0.0;
223
line->property_y2() = _height;
224
line->property_color_rgba() = color;
225
_lines.insert(make_pair(xpos, line));
226
inserted_last_time = true;
217
if (_lines.find(xpos) == _lines.end()) {
218
line = new ArdourCanvas::SimpleLine (*_group);
219
line->property_x1() = xpos;
220
line->property_x2() = xpos;
221
line->property_y1() = 0.0;
222
line->property_y2() = _height;
223
line->property_color_rgba() = color;
224
_lines.insert(make_pair(xpos, line));
225
inserted_last_time = true;
228
228
// Steal from the left
230
230
//cout << "*** STEALING FROM LEFT" << endl;
231
assert(_lines.find(xpos) == _lines.end());
232
Lines::iterator steal = _lines.begin();
233
line = steal->second;
235
line->property_color_rgba() = color;
236
line->property_x1() = xpos;
237
line->property_x2() = xpos;
238
_lines.insert(make_pair(xpos, line));
239
inserted_last_time = true; // search next time
242
// Shift clean range right
243
_clean_left = max(_clean_left, steal->first);
244
_clean_right = max(_clean_right, xpos);
231
if (_lines.find(xpos) == _lines.end()) {
232
Lines::iterator steal = _lines.begin();
233
line = steal->second;
235
line->property_color_rgba() = color;
236
line->property_x1() = xpos;
237
line->property_x2() = xpos;
238
_lines.insert(make_pair(xpos, line));
239
inserted_last_time = true; // search next time
242
// Shift clean range right
243
_clean_left = max(_clean_left, steal->first);
244
_clean_right = max(_clean_right, xpos);