[project @ 2004-10-20 23:31:31 by jmb]

Reimplement draw groups

svn path=/import/netsurf/; revision=1332
This commit is contained in:
John Mark Bell 2004-10-20 23:31:32 +00:00
parent 33d905ce7f
commit 963c3766d5
5 changed files with 42 additions and 6 deletions

View File

@ -38,6 +38,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);
};
/** Current plotters, must be assigned before use. */

View File

@ -38,9 +38,12 @@ 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_colour(colour c);
struct plotter_table plot;
const struct plotter_table nsgtk_plotters = {
@ -53,7 +56,9 @@ const struct plotter_table nsgtk_plotters = {
nsgtk_plot_text,
nsgtk_plot_disc,
nsgtk_plot_bitmap,
nsgtk_plot_bitmap_tile
nsgtk_plot_bitmap_tile,
nsgtk_plot_group_start,
nsgtk_plot_group_end
};
@ -194,6 +199,15 @@ 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)
{

View File

@ -145,14 +145,19 @@ 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"))
return false;
for (c = box->children; c; c = c->next)
if (!html_redraw_box(c, x_scrolled, y_scrolled,
x0, y0, x1, y1,
scale, current_background_color))
return false;
return true;
return plot.group_end();
}
if (!plot.group_start("vis box"))
return false;
/* dotted debug outlines */
if (html_redraw_debug) {
if (!plot.rectangle(x, y, padding_width, padding_height,
@ -184,7 +189,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 true;
return plot.group_end();
if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
box->type == BOX_TABLE_CELL || box->object) {
@ -350,7 +355,7 @@ bool html_redraw_box(struct box *box,
if (!plot.clip(clip_x0, clip_y0, clip_x1, clip_y1))
return false;
return true;
return plot.group_end();
}

View File

@ -37,6 +37,8 @@ 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;
@ -51,7 +53,9 @@ const struct plotter_table ro_plotters = {
ro_plot_text,
ro_plot_disc,
ro_plot_bitmap,
ro_plot_bitmap_tile
ro_plot_bitmap_tile,
ro_plot_group_start,
ro_plot_group_end
};
int ro_plot_origin_x = 0;
@ -376,6 +380,15 @@ 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.

View File

@ -109,7 +109,9 @@ const struct plotter_table draw_plotters = {
draw_plot_text,
draw_plot_disc,
draw_plot_bitmap,
draw_plot_bitmap_tile
draw_plot_bitmap_tile,
drawbuf_group_begin,
drawbuf_group_end
};
static int draw_plot_origin_y = 0; /* plot origin, in browser units */