summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2007-03-12 21:03:39 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2007-03-12 21:03:39 +0000
commitef3aa2e1512ede05a24f1e7c4e9b5c70098b7200 (patch)
treebb233323d2d93700a26366e9cf7da3c84366d1e8
parent3a716d2b9035a136a0bfa405dd20c2a1b47dde07 (diff)
fix errors in prior fix for excessive CPU when drawing rec rects
git-svn-id: svn://localhost/ardour2/trunk@1577 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour_ui_dialogs.cc2
-rw-r--r--gtk2_ardour/audio_streamview.cc2
-rw-r--r--gtk2_ardour/canvas-simplerect.c115
-rw-r--r--gtk2_ardour/gain_meter.cc2
4 files changed, 78 insertions, 43 deletions
diff --git a/gtk2_ardour/ardour_ui_dialogs.cc b/gtk2_ardour/ardour_ui_dialogs.cc
index 063810dd83..a0d772dbf1 100644
--- a/gtk2_ardour/ardour_ui_dialogs.cc
+++ b/gtk2_ardour/ardour_ui_dialogs.cc
@@ -153,7 +153,7 @@ ARDOUR_UI::connect_to_session (Session *s)
second_connection = Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::every_second), 1000);
point_one_second_connection = Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::every_point_one_seconds), 100);
- point_oh_five_second_connection = Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::every_point_oh_five_seconds), 50);
+ // point_oh_five_second_connection = Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::every_point_oh_five_seconds), 50);
point_zero_one_second_connection = Glib::signal_timeout().connect (mem_fun(*this, &ARDOUR_UI::every_point_zero_one_seconds), 40);
}
diff --git a/gtk2_ardour/audio_streamview.cc b/gtk2_ardour/audio_streamview.cc
index 5a27d6b2a9..aa54af86fb 100644
--- a/gtk2_ardour/audio_streamview.cc
+++ b/gtk2_ardour/audio_streamview.cc
@@ -526,7 +526,7 @@ AudioStreamView::setup_rec_box ()
rec_rects.push_back (recbox);
screen_update_connection.disconnect();
- screen_update_connection = ARDOUR_UI::instance()->MidRapidScreenUpdate.connect (mem_fun (*this, &AudioStreamView::update_rec_box));
+ screen_update_connection = ARDOUR_UI::instance()->SuperRapidScreenUpdate.connect (mem_fun (*this, &AudioStreamView::update_rec_box));
rec_updating = true;
rec_active = true;
diff --git a/gtk2_ardour/canvas-simplerect.c b/gtk2_ardour/canvas-simplerect.c
index 288289183f..941af0ff46 100644
--- a/gtk2_ardour/canvas-simplerect.c
+++ b/gtk2_ardour/canvas-simplerect.c
@@ -257,25 +257,20 @@ gnome_canvas_simplerect_bounds (GnomeCanvasItem *item, double *x1, double *y1, d
}
+
static void
gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item)
{
GnomeCanvasSimpleRect* simplerect;
double x1, x2, y1, y2;
double old_x1, old_x2, old_y1, old_y2;
- double a, b, c, d;
- ArtIRect intersection, old, new;
-
- old.x0 = old_x1 = item->x1;
- old.y0 = old_y1 = item->y1;
- old.x1 = old_x2 = item->x2;
- old.y1 = old_y2 = item->y2;
-
- new.x0 = x1;
- new.y0 = y1;
- new.x1 = x2;
- new.y1 = y2;
+ ArtDRect unionrect, old, new;
+ old_x1 = item->x1;
+ old_y1 = item->y1;
+ old_x2 = item->x2;
+ old_y2 = item->y2;
+
gnome_canvas_simplerect_bounds (item, &x1, &y1, &x2, &y2);
gnome_canvas_item_i2w (item, &x1, &y1);
gnome_canvas_item_i2w (item, &x2, &y2);
@@ -293,34 +288,74 @@ gnome_canvas_simplerect_reset_bounds (GnomeCanvasItem *item)
gnome_canvas_w2c (GNOME_CANVAS(item->canvas), x2, y2, &simplerect->bbox_lrx, &simplerect->bbox_lry);
/* now queue redraws for changed areas */
-
- art_irect_intersect (&intersection, &old, &new);
-#if 0
- a = MIN(item->x1, old_x1);
- b = MAX(item->x1, old_x1);
-
- a = MIN(a, item->x2);
- a = MIN(a, old_x2);
- b = MAX(b, item->x2);
- b = MAX(b, old_x2);
-
- c = MIN(item->y1, old_y1);
- d = MAX(item->y1, old_y1);
-
- c = MIN(c,item->y2);
- c = MIN(c, old_y2);
- d = MAX(d,item->y2);
- d = MAX(d, old_y2);
-
- fprintf (stderr, "%p REDRAW %g,%g %g,%g\n", simplerect, a, c, b + 0.5, d + 0.5);
- gnome_canvas_request_redraw (item->canvas, a, c, b + 0.5, d + 0.5);
-#else
- gnome_canvas_request_redraw (item->canvas,
- intersection.x0,
- intersection.y0,
- intersection.x1,
- intersection.y1);
-#endif
+
+ if (item->x1 == old_x1 && item->x2 == old_x2) {
+
+ /* no change in x-axis position */
+
+ if (item->y1 == old_y1) {
+ /* top didn't change, so just draw bottom */
+
+ int start_y = MIN (item->y2, old_y2);
+ int end_y = MAX (item->y2, old_y2);
+
+ gnome_canvas_request_redraw (item->canvas, item->x1, start_y, item->x2 + 0.5, end_y + 0.5);
+ return;
+
+ } else if (item->y2 == old_y2) {
+
+ /* bottom didn't change, just draw top */
+
+ int start_y = MIN (item->y1, old_y1);
+ int end_y = MAX (item->y1, old_y1);
+
+ gnome_canvas_request_redraw (item->canvas, item->x1, start_y, item->x2 + 0.5, end_y + 0.5);
+ return;
+
+ }
+
+ } else if (item->y1 == old_y1 && item->y2 == old_y2) {
+
+ /* no change in y-axis position */
+
+ if (item->x1 == old_x1) {
+ /* start didn't change, so just draw at the end */
+
+ int start_x = MIN (item->x2, old_x2);
+ int end_x = MAX (item->x2, old_x2);
+
+ gnome_canvas_request_redraw (item->canvas, start_x, item->y1, end_x + 0.5, item->y2 + 0.5);
+ return;
+
+ } else if (item->x2 == old_x2) {
+
+ /* end didn't change, so just draw at the start */
+
+ int start_x = MIN (item->x1, old_x1);
+ int end_x = MAX (item->x1, old_x1);
+
+ gnome_canvas_request_redraw (item->canvas, start_x, item->y1, end_x + 0.5, item->y2 + 0.5);
+ return;
+
+ }
+ }
+
+ new.x0 = x1;
+ new.y0 = y1;
+ new.x1 = x2;
+ new.y1 = y2;
+
+ old.x0 = old_x1;
+ old.y0 = old_y1;
+ old.x1 = old_x2;
+ old.y1 = old_y2;
+
+ art_drect_union (&unionrect, &old, &new);
+ gnome_canvas_request_redraw (item->canvas,
+ unionrect.x0,
+ unionrect.y0,
+ unionrect.x1 + 0.5,
+ unionrect.y1 + 0.5);
}
/*
diff --git a/gtk2_ardour/gain_meter.cc b/gtk2_ardour/gain_meter.cc
index 76be06e1a2..0262a90224 100644
--- a/gtk2_ardour/gain_meter.cc
+++ b/gtk2_ardour/gain_meter.cc
@@ -156,7 +156,7 @@ GainMeter::GainMeter (boost::shared_ptr<IO> io, Session& s)
using namespace Menu_Helpers;
- gain_astate_menu.items().push_back (MenuElem (_("Off"),
+ gain_astate_menu.items().push_back (MenuElem (_("Manual"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Off)));
gain_astate_menu.items().push_back (MenuElem (_("Play"),
bind (mem_fun (*_io, &IO::set_gain_automation_state), (AutoState) Play)));