[gnumeric] GUI/Recalc: mark entire redraw operation as a unit for recalc.
- From: Morten Welinder <mortenw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnumeric] GUI/Recalc: mark entire redraw operation as a unit for recalc.
- Date: Thu, 29 Mar 2012 18:03:28 +0000 (UTC)
commit 88e0fc588df5280483865f2ca4a0179debb372eb
Author: Morten Welinder <terra gnome org>
Date: Thu Mar 29 13:22:50 2012 -0400
GUI/Recalc: mark entire redraw operation as a unit for recalc.
Also restrict "range" redraws to about 500 rows. Anything bigger
reverts to full sheet.
ChangeLog | 7 +++++++
src/sheet-control-gui.c | 17 +++++++++++++++++
src/sheet.c | 14 ++++++++++++--
3 files changed, 36 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 653915c..5383a5d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-03-29 Morten Welinder <terra gnome org>
+
+ * src/sheet.c (sheet_redraw_region): Revert to redrawing the whole
+ sheet if the region is too tall.
+
+ * src/sheet-control-gui.c (scg_redraw_range): Ditto.
+
2012-03-28 Morten Welinder <terra gnome org>
* src/sheet.c (sheet_redraw_all, sheet_redraw_region): Mark whole
diff --git a/src/sheet-control-gui.c b/src/sheet-control-gui.c
index 2ef9b67..8f7a551 100644
--- a/src/sheet-control-gui.c
+++ b/src/sheet-control-gui.c
@@ -149,6 +149,21 @@ scg_redraw_range (SheetControl *sc, GnmRange const *r)
Sheet const *sheet = scg_sheet (scg);
GnmRange visible, area;
+ /*
+ * Getting the bounding box causes row respans to be done if
+ * needed. That can be expensive, so just redraw the whole
+ * sheet if the row count is too big.
+ */
+ if (r->end.row - r->start.row > 500) {
+ scg_redraw_all (sc, FALSE);
+ return;
+ }
+
+ /* We potentially do a lot of recalcs as part of this, so make sure
+ stuff that caches sub-computations see the whole thing instead
+ of clearing between cells. */
+ gnm_app_recalc_start ();
+
SCG_FOREACH_PANE (scg, pane, {
visible.start = pane->first;
visible.end = pane->last_visible;
@@ -158,6 +173,8 @@ scg_redraw_range (SheetControl *sc, GnmRange const *r)
gnm_pane_redraw_range (pane, &area);
}
};);
+
+ gnm_app_recalc_finish ();
}
/* A rough guess of the trade off point between of redrawing all
diff --git a/src/sheet.c b/src/sheet.c
index ab2eaea..19ba6c1 100644
--- a/src/sheet.c
+++ b/src/sheet.c
@@ -1381,7 +1381,7 @@ void
sheet_redraw_all (Sheet const *sheet, gboolean headers)
{
/* We potentially do a lot of recalcs as part of this, so make sure
- stuff that cachings sub-computations see the whole thing instead
+ stuff that caches sub-computations see the whole thing instead
of clearing between cells. */
gnm_app_recalc_start ();
SHEET_FOREACH_CONTROL (sheet, view, control,
@@ -2947,8 +2947,18 @@ sheet_redraw_region (Sheet const *sheet,
g_return_if_fail (IS_SHEET (sheet));
+ /*
+ * Getting the bounding box causes row respans to be done if
+ * needed. That can be expensive, so just redraw the whole
+ * sheet if the row count is too big.
+ */
+ if (end_row - start_row > 500) {
+ sheet_redraw_all (sheet, FALSE);
+ return;
+ }
+
/* We potentially do a lot of recalcs as part of this, so make sure
- stuff that cachings sub-computations see the whole thing instead
+ stuff that caches sub-computations see the whole thing instead
of clearing between cells. */
gnm_app_recalc_start ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]