summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorRichard Wilson <rjw@netsurf-browser.org>2006-07-10 09:52:31 +0000
committerRichard Wilson <rjw@netsurf-browser.org>2006-07-10 09:52:31 +0000
commita47f148f2d9a7f06c7dddaf55d7e89c6e04349ef (patch)
tree1d0db22a55693f79ce5a4f267ebfde00c682d176 /desktop
parent0fe0a709ceeae77cc5d91aab318aec27320e09af (diff)
downloadnetsurf-a47f148f2d9a7f06c7dddaf55d7e89c6e04349ef.tar.gz
netsurf-a47f148f2d9a7f06c7dddaf55d7e89c6e04349ef.tar.bz2
Optimise out redundant group_start and group_end calls (speed up rendering.)
svn path=/trunk/netsurf/; revision=2725
Diffstat (limited to 'desktop')
-rw-r--r--desktop/knockout.c20
-rw-r--r--desktop/plotters.h4
2 files changed, 19 insertions, 5 deletions
diff --git a/desktop/knockout.c b/desktop/knockout.c
index 16029c3d7..eeab21c11 100644
--- a/desktop/knockout.c
+++ b/desktop/knockout.c
@@ -27,6 +27,7 @@ struct knockout_box;
struct knockout_entry;
+static void knockout_set_plotters(void);
static bool knockout_plot_flush(void);
static void knockout_calculate(int x0, int y0, int x1, int y1, struct knockout_box *box);
static bool knockout_plot_fill_recursive(struct knockout_box *box, colour c);
@@ -235,7 +236,7 @@ bool knockout_plot_start(struct plotter_table *plotter)
/* take over the plotter */
real_plot = *plotter;
- plot = knockout_plotters;
+ knockout_set_plotters();
return true;
}
@@ -408,12 +409,25 @@ bool knockout_plot_flush(void)
/* re-instate knockout plotters if we are still active */
if (nested_depth > 0)
- plot = knockout_plotters;
+ knockout_set_plotters();
return success;
}
/**
+ * Override the current plotters with the knockout plotters
+ */
+void knockout_set_plotters(void)
+{
+ plot = knockout_plotters;
+ if (!real_plot.group_start)
+ plot.group_start = NULL;
+ if (!real_plot.group_end)
+ plot.group_end = NULL;
+}
+
+
+/**
* Knockout a section of previous rendering
*
* \param x0 the left edge of the removal box
@@ -704,7 +718,7 @@ bool knockout_plot_clip(int clip_x0, int clip_y0,
clip_x0, clip_y0, clip_x1, clip_y1));
return false;
}
-
+
/* memorise clip for bitmap tiling */
clip_x0_cur = clip_x0;
clip_y0_cur = clip_y0;
diff --git a/desktop/plotters.h b/desktop/plotters.h
index 65abd1774..d10de3a2a 100644
--- a/desktop/plotters.h
+++ b/desktop/plotters.h
@@ -39,8 +39,8 @@ struct plotter_table {
bool (*bitmap_tile)(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bool repeat_x, bool repeat_y);
- bool (*group_start)(const char *name);
- bool (*group_end)(void);
+ bool (*group_start)(const char *name); /** optional */
+ bool (*group_end)(void); /** optional */
};
/** Current plotters, must be assigned before use. */