summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--desktop/knockout.c20
-rw-r--r--desktop/plotters.h4
-rw-r--r--gtk/gtk_plotters.c16
-rw-r--r--render/html_redraw.c10
-rw-r--r--riscos/plotters.c16
5 files changed, 28 insertions, 38 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. */
diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c
index e646a0644..27f173eef 100644
--- a/gtk/gtk_plotters.c
+++ b/gtk/gtk_plotters.c
@@ -44,8 +44,6 @@ static bool nsgtk_plot_bitmap(int x, int y, int width, int height,
static bool nsgtk_plot_bitmap_tile(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bool repeat_x, bool repeat_y);
-static bool nsgtk_plot_group_start(const char *name);
-static bool nsgtk_plot_group_end(void);
static void nsgtk_set_solid(void); /**< Set for drawing solid lines */
static void nsgtk_set_dotted(void); /**< Set for drawing dotted lines */
static void nsgtk_set_dashed(void); /**< Set for drawing dashed lines */
@@ -67,8 +65,8 @@ const struct plotter_table nsgtk_plotters = {
nsgtk_plot_arc,
nsgtk_plot_bitmap,
nsgtk_plot_bitmap_tile,
- nsgtk_plot_group_start,
- nsgtk_plot_group_end
+ NULL,
+ NULL
};
@@ -321,16 +319,6 @@ bool nsgtk_plot_bitmap_tile(int x, int y, int width, int height,
return true;
}
-bool nsgtk_plot_group_start(const char *name)
-{
- return true;
-}
-
-bool nsgtk_plot_group_end(void)
-{
- return true;
-}
-
void nsgtk_set_colour(colour c)
{
int r, g, b;
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 2dd788a94..f70e9eefa 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -192,16 +192,16 @@ bool html_redraw_box(struct box *box,
/* if visibility is hidden render children only */
if (box->style && box->style->visibility == CSS_VISIBILITY_HIDDEN) {
- if (!plot.group_start("hidden box"))
+ if ((plot.group_start) && (!plot.group_start("hidden box")))
return false;
if (!html_redraw_box_children(box, x_parent, y_parent,
x0, y0, x1, y1, scale,
current_background_color))
return false;
- return plot.group_end();
+ return ((!plot.group_end) || (plot.group_end()));
}
- if (!plot.group_start("vis box"))
+ if ((plot.group_start) && (!plot.group_start("vis box")))
return false;
/* dotted debug outlines */
@@ -237,7 +237,7 @@ bool html_redraw_box(struct box *box,
/* return if the box is completely outside the clip rectangle */
if (clip_y1 < y0 || y1 < clip_y0 || clip_x1 < x0 || x1 < clip_x0)
- return plot.group_end();
+ return ((!plot.group_end) || (plot.group_end()));
if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
box->type == BOX_TABLE_CELL || box->object) {
@@ -347,7 +347,7 @@ bool html_redraw_box(struct box *box,
if (!plot.clip(clip_x0, clip_y0, clip_x1, clip_y1))
return false;
- return plot.group_end();
+ return ((!plot.group_end) || (plot.group_end()));
}
diff --git a/riscos/plotters.c b/riscos/plotters.c
index c08f7d646..81d12f3dd 100644
--- a/riscos/plotters.c
+++ b/riscos/plotters.c
@@ -42,8 +42,6 @@ static bool ro_plot_bitmap(int x, int y, int width, int height,
static bool ro_plot_bitmap_tile(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bool repeat_x, bool repeat_y);
-static bool ro_plot_group_start(const char *name);
-static bool ro_plot_group_end(void);
struct plotter_table plot;
@@ -60,8 +58,8 @@ const struct plotter_table ro_plotters = {
ro_plot_arc,
ro_plot_bitmap,
ro_plot_bitmap_tile,
- ro_plot_group_start,
- ro_plot_group_end
+ NULL,
+ NULL
};
int ro_plot_origin_x = 0;
@@ -404,16 +402,6 @@ bool ro_plot_bitmap_tile(int x, int y, int width, int height,
IMAGE_PLOT_TINCT_ALPHA);
}
-bool ro_plot_group_start(const char *name)
-{
- return true;
-}
-
-bool ro_plot_group_end(void)
-{
- return true;
-}
-
/**
* Set the scale for subsequent text plotting.
*/