summaryrefslogtreecommitdiffstats
path: root/src/display
diff options
context:
space:
mode:
authorbulia byak <buliabyak@gmail.com>2007-02-25 05:46:48 +0000
committerbuliabyak <buliabyak@users.sourceforge.net>2007-02-25 05:46:48 +0000
commit2a33ed0b021d89f29f429ae0746e42679af82155 (patch)
tree388f55ec2cdb0b10ef26fef65f54bf49b90dda93 /src/display
parentadd 'hide all except selected' checkbox (diff)
downloadinkscape-2a33ed0b021d89f29f429ae0746e42679af82155.tar.gz
inkscape-2a33ed0b021d89f29f429ae0746e42679af82155.zip
move a global to a class property; reduce the use of is_scrolling to prevent the lack-of-redraw issues
(bzr r2430)
Diffstat (limited to 'src/display')
-rw-r--r--src/display/sp-canvas.cpp13
-rw-r--r--src/display/sp-canvas.h4
2 files changed, 10 insertions, 7 deletions
diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp
index b10af7f6a..f716d383a 100644
--- a/src/display/sp-canvas.cpp
+++ b/src/display/sp-canvas.cpp
@@ -988,6 +988,9 @@ sp_canvas_init (SPCanvas *canvas)
canvas->forced_redraw_limit = -1;
canvas->slowest_buffer = 0;
+
+ canvas->is_scrolling = false;
+
}
/**
@@ -1590,8 +1593,6 @@ sp_canvas_paint_single_buffer (SPCanvas *canvas, int x0, int y0, int x1, int y1,
}
}
-static int is_scrolling = 0;
-
/* Paint the given rect, while updating canvas->redraw_aborted and running iterations after each
* buffer; make sure canvas->redraw_aborted never goes past aborted_limit (used for 2-rect
* optimized repaint)
@@ -1707,11 +1708,11 @@ sp_canvas_paint_rect_internal (SPCanvas *canvas, NRRectL *rect, NR::ICoord *x_ab
// OPTIMIZATION IDEA: if drawing is really slow (as measured by canvas->slowest
// buffer), do the same - process some events even before we paint any buffers
- if (is_scrolling) {
- is_scrolling = 0;
+ if (canvas->is_scrolling) {
while (Gtk::Main::events_pending()) { // process any events
Gtk::Main::iteration(false);
}
+ canvas->is_scrolling = false;
if (this_count != canvas->redraw_count) { // if there was redraw,
return 1; // interrupt this one
}
@@ -2154,7 +2155,7 @@ sp_canvas_root (SPCanvas *canvas)
* Scrolls canvas to specific position.
*/
void
-sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear)
+sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear, bool is_scrolling)
{
g_return_if_fail (canvas != NULL);
g_return_if_fail (SP_IS_CANVAS (canvas));
@@ -2174,7 +2175,7 @@ sp_canvas_scroll_to (SPCanvas *canvas, double cx, double cy, unsigned int clear)
if (!clear) {
// scrolling without zoom; redraw only the newly exposed areas
if ((dx != 0) || (dy != 0)) {
- is_scrolling = 1;
+ canvas->is_scrolling = is_scrolling;
if (GTK_WIDGET_REALIZED (canvas)) {
gdk_window_scroll (SP_CANVAS_WINDOW (canvas), -dx, -dy);
}
diff --git a/src/display/sp-canvas.h b/src/display/sp-canvas.h
index 39a7ae1f8..bc5f835f1 100644
--- a/src/display/sp-canvas.h
+++ b/src/display/sp-canvas.h
@@ -178,6 +178,8 @@ struct SPCanvas {
bool gen_all_enter_events;
int rendermode;
+
+ bool is_scrolling;
NR::Rect getViewbox() const;
};
@@ -186,7 +188,7 @@ GtkWidget *sp_canvas_new_aa();
SPCanvasGroup *sp_canvas_root(SPCanvas *canvas);
-void sp_canvas_scroll_to(SPCanvas *canvas, double cx, double cy, unsigned int clear);
+void sp_canvas_scroll_to(SPCanvas *canvas, double cx, double cy, unsigned int clear, bool is_scrolling = false);
void sp_canvas_update_now(SPCanvas *canvas);
void sp_canvas_request_redraw(SPCanvas *canvas, int x1, int y1, int x2, int y2);