summaryrefslogtreecommitdiff
path: root/riscos/htmlredraw.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2004-06-25 14:28:29 +0000
committerJames Bursa <james@netsurf-browser.org>2004-06-25 14:28:29 +0000
commitaa6e904604cde92ff4883725caa69472be9159aa (patch)
tree7989b9cbed9860bac26c2535a4a788e84a8bd7df /riscos/htmlredraw.c
parentbca6a63c4500edb833deddf774e67c186908d884 (diff)
downloadnetsurf-aa6e904604cde92ff4883725caa69472be9159aa.tar.gz
netsurf-aa6e904604cde92ff4883725caa69472be9159aa.tar.bz2
[project @ 2004-06-25 14:28:29 by bursa]
Parse CSS background shorthand property. Background rendering improvements. svn path=/import/netsurf/; revision=1006
Diffstat (limited to 'riscos/htmlredraw.c')
-rw-r--r--riscos/htmlredraw.c66
1 files changed, 34 insertions, 32 deletions
diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c
index b0c2c4e5d..ce5ce211a 100644
--- a/riscos/htmlredraw.c
+++ b/riscos/htmlredraw.c
@@ -102,11 +102,7 @@ void html_redraw_box(struct content *content, struct box * box,
int padding_left, padding_top;
int padding_width, padding_height;
int x0, y0, x1, y1;
- int px0, py0, px1, py1;
int colour;
- os_VDU_VAR_LIST(5) vars = { { os_VDUVAR_GWL_COL, os_VDUVAR_GWB_ROW,
- os_VDUVAR_GWR_COL, os_VDUVAR_GWT_ROW, -1 } };
- os_vdu_var cgw[4];
x += box->x * 2 * scale;
y -= box->y * 2 * scale;
@@ -215,37 +211,43 @@ void html_redraw_box(struct content *content, struct box * box,
y1 = clip_y1;
}
- /* find intersection of clip box and padding box */
- px0 = x < x0 ? x0 : x;
- py0 = y - padding_height < y0 ? y0 : y - padding_height;
- px1 = x + padding_width < x1 ? x + padding_width : x1;
- py1 = y < y1 ? y : y1;
-
- /* background colour */
- if (box->style != 0 && box->style->background_color != TRANSPARENT) {
- colourtrans_set_gcol(box->style->background_color << 8,
- colourtrans_USE_ECFS, os_ACTION_OVERWRITE, 0);
- os_plot(os_MOVE_TO, px0, py0);
- if (px0 < px1 && py0 < py1)
- os_plot(os_PLOT_RECTANGLE | os_PLOT_TO, px1, py1);
- current_background_color = box->style->background_color;
- }
-
- /* read current graphics window dimensions */
- xos_read_vdu_variables((os_vdu_var_list const *) &vars, (int*)&cgw);
+ /* background colour and image */
+ if (box->style && (box->type != BOX_INLINE ||
+ box->style != box->parent->parent->style)) {
+ /* find intersection of clip box and padding box */
+ int px0 = x < x0 ? x0 : x;
+ int py0 = y - padding_height < y0 ? y0 : y - padding_height;
+ int px1 = x + padding_width < x1 ? x + padding_width : x1;
+ int py1 = y < y1 ? y : y1;
+
+ /* background colour */
+ /* optimisation: skip if fully repeated background image */
+ if (box->style->background_color != TRANSPARENT &&
+ (!box->background ||
+ box->style->background_repeat !=
+ CSS_BACKGROUND_REPEAT_REPEAT)) {
+ colourtrans_set_gcol(box->style->background_color << 8,
+ colourtrans_USE_ECFS,
+ os_ACTION_OVERWRITE, 0);
+ os_plot(os_MOVE_TO, px0, py0);
+ if (px0 < px1 && py0 < py1)
+ os_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
+ px1, py1);
+ current_background_color = box->style->background_color;
+ }
- /* clip to padding box */
- html_redraw_clip(px0, py0, px1, py1);
+ if (box->background) {
+ /* clip to padding box */
+ html_redraw_clip(px0, py0, px1, py1);
- /* plot background image */
- /* the if statement below causes regression on acornarcade.com
- * but fixes some issues with the CSS testsuite background section */
-// if (box->type != BOX_INLINE && box->background)
- html_redraw_background(x, y, width, clip_y1-clip_y0, box, scale);
+ /* plot background image */
+ html_redraw_background(x, y, width, clip_y1 - clip_y0,
+ box, scale);
- /* restore previous graphics window */
- /* should probably take account of the eigvalues here... */
- html_redraw_clip(cgw[0]*2, cgw[1]*2, cgw[2]*2, cgw[3]*2);
+ /* restore previous graphics window */
+ html_redraw_clip(x0, y0, x1, y1);
+ }
+ }
if (box->object) {
content_redraw(box->object, x + padding_left, y - padding_top,