summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--render/html_redraw.c249
1 files changed, 122 insertions, 127 deletions
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 2c355c67c..7a24acc4e 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -54,23 +54,25 @@
#include "utils/utils.h"
-static bool html_redraw_box(struct box *box, int x, int y, struct rect clip,
- float scale, colour current_background_color);
+static bool html_redraw_box(struct box *box, int x, int y,
+ const struct rect *clip, float scale,
+ colour current_background_color);
static bool html_redraw_box_children(struct box *box,
- int x_parent, int y_parent, struct rect clip,
+ int x_parent, int y_parent, const struct rect *clip,
float scale, colour current_background_color);
static bool html_redraw_text_box(struct box *box, int x, int y,
- struct rect clip, float scale,
+ const struct rect *clip, float scale,
colour current_background_color);
static bool html_redraw_caret(struct caret *caret,
colour current_background_color, float scale);
static bool html_redraw_borders(struct box *box, int x_parent, int y_parent,
- int p_width, int p_height, struct rect clip, float scale);
+ int p_width, int p_height, const struct rect *clip,
+ float scale);
static bool html_redraw_inline_borders(struct box *box, struct rect b,
- struct rect clip, float scale, bool first, bool last);
+ const struct rect *clip, float scale, bool first, bool last);
static bool html_redraw_border_plot(const int side, const int *p, colour c,
enum css_border_style_e style, int thickness, bool rectangular,
- struct rect clip);
+ const struct rect *clip);
static bool html_redraw_checkbox(int x, int y, int width, int height,
bool selected);
static bool html_redraw_radio(int x, int y, int width, int height,
@@ -78,10 +80,10 @@ static bool html_redraw_radio(int x, int y, int width, int height,
static bool html_redraw_file(int x, int y, int width, int height,
struct box *box, float scale, colour background_colour);
static bool html_redraw_background(int x, int y, struct box *box, float scale,
- struct rect clip, colour *background_colour,
+ const struct rect *clip, colour *background_colour,
struct box *background);
static bool html_redraw_inline_background(int x, int y, struct box *box,
- float scale, struct rect clip, struct rect b,
+ float scale, const struct rect *clip, struct rect b,
bool first, bool last, colour *background_colour);
static bool html_redraw_text_decoration(struct box *box,
int x_parent, int y_parent, float scale,
@@ -155,7 +157,7 @@ bool html_redraw(struct content *c, int x, int y,
result &= plot.rectangle(clip->x0, clip->y0, clip->x1, clip->y1,
&pstyle_fill_bg);
- result &= html_redraw_box(box, x, y, *clip,
+ result &= html_redraw_box(box, x, y, clip,
scale, pstyle_fill_bg.fill_colour);
}
@@ -261,7 +263,8 @@ static struct box *html_redraw_find_bg_box(struct box *box)
*/
bool html_redraw_box(struct box *box, int x_parent, int y_parent,
- struct rect clip, float scale, colour current_background_color)
+ const struct rect *clip, float scale,
+ colour current_background_color)
{
int x, y;
int width, height;
@@ -363,8 +366,8 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
}
/* return if the rectangle is completely outside the clip rectangle */
- if (clip.y1 < r.y0 || r.y1 < clip.y0 ||
- clip.x1 < r.x0 || r.x1 < clip.x0)
+ if (clip->y1 < r.y0 || r.y1 < clip->y0 ||
+ clip->x1 < r.x0 || r.x1 < clip->x0)
return true;
/*if the rectangle is under the page bottom but it can fit in a page,
@@ -391,7 +394,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
if ((plot.group_start) && (!plot.group_start("hidden box")))
return false;
if (!html_redraw_box_children(box, x_parent, y_parent,
- r, scale, current_background_color))
+ &r, scale, current_background_color))
return false;
return ((!plot.group_end) || (plot.group_end()));
}
@@ -402,10 +405,10 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
box->type == BOX_TABLE_CELL || box->object) {
/* find intersection of clip rectangle and box */
- if (r.x0 < clip.x0) r.x0 = clip.x0;
- if (r.y0 < clip.y0) r.y0 = clip.y0;
- if (clip.x1 < r.x1) r.x1 = clip.x1;
- if (clip.y1 < r.y1) r.y1 = clip.y1;
+ if (r.x0 < clip->x0) r.x0 = clip->x0;
+ if (r.y0 < clip->y0) r.y0 = clip->y0;
+ if (clip->x1 < r.x1) r.x1 = clip->x1;
+ if (clip->y1 < r.y1) r.y1 = clip->y1;
/* no point trying to draw 0-width/height boxes */
if (r.x0 == r.x1 || r.y0 == r.y1)
/* not an error */
@@ -415,10 +418,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
return false;
} else {
/* clip box unchanged */
- r.x0 = clip.x0;
- r.y0 = clip.y0;
- r.x1 = clip.x1;
- r.y1 = clip.y1;
+ r = *clip;
}
/* background colour and image for block level content and replaced
@@ -465,7 +465,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
/* valid clipping rectangles only */
if ((p.x0 < p.x1) && (p.y0 < p.y1)) {
/* plot background */
- if (!html_redraw_background(x, y, box, scale, p,
+ if (!html_redraw_background(x, y, box, scale, &p,
&current_background_color, bg_box))
return false;
/* restore previous graphics window */
@@ -481,7 +481,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
(border_top || border_right ||
border_bottom || border_left)) {
if (!html_redraw_borders(box, x_parent, y_parent,
- padding_width, padding_height, r,
+ padding_width, padding_height, &r,
scale))
return false;
}
@@ -538,14 +538,14 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
/* inline element has wrapped, plot background
* and borders */
if (!html_redraw_inline_background(
- x, y, box, scale, p, b,
+ x, y, box, scale, &p, b,
first, false,
&current_background_color))
return false;
/* restore previous graphics window */
if (!plot.clip(&r))
return false;
- if (!html_redraw_inline_borders(box, b, r,
+ if (!html_redraw_inline_borders(box, b, &r,
scale, first, false))
return false;
/* reset coords */
@@ -571,13 +571,13 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
}
/* plot background and borders for last rectangle of
* the inline */
- if (!html_redraw_inline_background(x, ib_y, box, scale, p, b,
+ if (!html_redraw_inline_background(x, ib_y, box, scale, &p, b,
first, true, &current_background_color))
return false;
/* restore previous graphics window */
if (!plot.clip(&r))
return false;
- if (!html_redraw_inline_borders(box, b, r, scale, first, true))
+ if (!html_redraw_inline_borders(box, b, &r, scale, first, true))
return false;
}
@@ -630,10 +630,10 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
r.y0 = y;
r.x1 = x + padding_width;
r.y1 = y + padding_height;
- if (r.x0 < clip.x0) r.x0 = clip.x0;
- if (r.y0 < clip.y0) r.y0 = clip.y0;
- if (clip.x1 < r.x1) r.x1 = clip.x1;
- if (clip.y1 < r.y1) r.y1 = clip.y1;
+ if (r.x0 < clip->x0) r.x0 = clip->x0;
+ if (r.y0 < clip->y0) r.y0 = clip->y0;
+ if (clip->x1 < r.x1) r.x1 = clip->x1;
+ if (clip->y1 < r.y1) r.y1 = clip->y1;
if (r.x1 <= r.x0 || r.y1 <= r.y0)
return ((!plot.group_end) || (plot.group_end()));
if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
@@ -680,12 +680,12 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
return false;
} else if (box->text) {
- if (!html_redraw_text_box(box, x, y, r, scale,
+ if (!html_redraw_text_box(box, x, y, &r, scale,
current_background_color))
return false;
} else {
- if (!html_redraw_box_children(box, x_parent, y_parent, r,
+ if (!html_redraw_box_children(box, x_parent, y_parent, &r,
scale, current_background_color))
return false;
}
@@ -721,19 +721,19 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
x_parent + box->x,
y_parent + box->y + box->padding[TOP] +
box->height + box->padding[BOTTOM] -
- SCROLLBAR_WIDTH, &clip, scale);
+ SCROLLBAR_WIDTH, clip, scale);
if (box->scroll_y != NULL)
scroll_redraw(box->scroll_y,
x_parent + box->x + box->padding[LEFT] +
box->width + box->padding[RIGHT] -
SCROLLBAR_WIDTH,
- y_parent + box->y, &clip, scale);
+ y_parent + box->y, clip, scale);
}
if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
box->type == BOX_TABLE_CELL || box->object)
- if (!plot.clip(&clip))
+ if (!plot.clip(clip))
return false;
return ((!plot.group_end) || (plot.group_end()));
@@ -753,7 +753,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
*/
bool html_redraw_box_children(struct box *box, int x_parent, int y_parent,
- struct rect clip, float scale,
+ const struct rect *clip, float scale,
colour current_background_color)
{
struct box *c;
@@ -796,7 +796,7 @@ bool html_redraw_box_children(struct box *box, int x_parent, int y_parent,
*/
bool html_redraw_text_box(struct box *box, int x, int y,
- struct rect clip, float scale,
+ const struct rect *clip, float scale,
colour current_background_color)
{
bool excluded = (box->object != NULL);
@@ -807,7 +807,7 @@ bool html_redraw_text_box(struct box *box, int x, int y,
if (!text_redraw(box->text, box->length, box->byte_offset,
box->space, &fstyle, x, y,
- &clip, box->height, scale, excluded))
+ clip, box->height, scale, excluded))
return false;
/* does this textbox contain the ghost caret? */
@@ -840,10 +840,8 @@ bool html_redraw_text_box(struct box *box, int x, int y,
bool text_redraw(const char *utf8_text, size_t utf8_len,
size_t offset, bool space, const plot_font_style_t *fstyle,
- int x, int y, const struct rect *clip,
- int height,
- float scale,
- bool excluded)
+ int x, int y, const struct rect *clip, int height,
+ float scale, bool excluded)
{
bool highlighted = false;
@@ -1038,7 +1036,7 @@ bool html_redraw_caret(struct caret *c, colour current_background_color,
*/
bool html_redraw_borders(struct box *box, int x_parent, int y_parent,
- int p_width, int p_height, struct rect clip, float scale)
+ int p_width, int p_height, const struct rect *clip, float scale)
{
unsigned int sides[] = { LEFT, RIGHT, TOP, BOTTOM };
int top = box->border[TOP].width;
@@ -1163,7 +1161,7 @@ bool html_redraw_borders(struct box *box, int x_parent, int y_parent,
return false;
break;
case TOP:
- if (clip.y0 > p[3])
+ if (clip->y0 > p[3])
/* clip rectangle is below border; nothing to
* plot */
continue;
@@ -1204,7 +1202,7 @@ bool html_redraw_borders(struct box *box, int x_parent, int y_parent,
return false;
break;
case BOTTOM:
- if (clip.y1 < p[5])
+ if (clip->y1 < p[5])
/* clip rectangle is above border; nothing to
* plot */
continue;
@@ -1267,7 +1265,7 @@ bool html_redraw_borders(struct box *box, int x_parent, int y_parent,
*/
bool html_redraw_inline_borders(struct box *box, struct rect b,
- struct rect clip, float scale, bool first, bool last)
+ const struct rect *clip, float scale, bool first, bool last)
{
int top = box->border[TOP].width;
int right = box->border[RIGHT].width;
@@ -1489,7 +1487,7 @@ static plot_style_t plot_style_fillbdr_dlight = {
bool html_redraw_border_plot(const int side, const int *p, colour c,
enum css_border_style_e style, int thickness, bool rectangular,
- struct rect clip)
+ const struct rect *clip)
{
int z[8]; /* Vertices of border part */
unsigned int light = side;
@@ -1538,10 +1536,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
y1 + p[1] - p[3] : y1;
}
/* find intersection of clip rectangle and border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1605,10 +1603,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
x1 = (p[0] + p[2]) / 2; y1 = (p[1] + p[3]) / 2;
}
/* find intersection of clip rectangle and border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1625,10 +1623,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
x1 = p[2]; y1 = p[3];
}
/* find intersection of clip rectangle and border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1646,10 +1644,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
x1 + p[4] - p[6] : x1;
/* find intersection of clip rectangle and
* border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1663,10 +1661,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
y1 + p[1] - p[3] : y1;
/* find intersection of clip rectangle and
* border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1739,10 +1737,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
x1 = (p[0] + p[2]) / 2; y1 = (p[1] + p[3]) / 2;
}
/* find intersection of clip rectangle and border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1759,10 +1757,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
x1 = p[2]; y1 = p[3];
}
/* find intersection of clip rectangle and border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1780,10 +1778,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
x1 + p[4] - p[6] : x1;
/* find intersection of clip rectangle and
* border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1797,10 +1795,10 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
y1 + p[1] - p[3] : y1;
/* find intersection of clip rectangle and
* border */
- x0 = (clip.x0 > x0) ? clip.x0 : x0;
- y0 = (clip.y0 > y0) ? clip.y0 : y0;
- x1 = (clip.x1 < x1) ? clip.x1 : x1;
- y1 = (clip.y1 < y1) ? clip.y1 : y1;
+ x0 = (clip->x0 > x0) ? clip->x0 : x0;
+ y0 = (clip->y0 > y0) ? clip->y0 : y0;
+ x1 = (clip->x1 < x1) ? clip->x1 : x1;
+ y1 = (clip->y1 < y1) ? clip->y1 : y1;
if ((x0 < x1) && (y0 < y1)) {
/* valid clip rectangles only */
if (!plot.rectangle(x0, y0, x1, y1,
@@ -1846,8 +1844,7 @@ bool html_redraw_border_plot(const int side, const int *p, colour c,
* \return true if successful, false otherwise
*/
-bool html_redraw_checkbox(int x, int y, int width, int height,
- bool selected)
+bool html_redraw_checkbox(int x, int y, int width, int height, bool selected)
{
double z = width * 0.15;
if (z == 0)
@@ -1900,8 +1897,7 @@ bool html_redraw_checkbox(int x, int y, int width, int height,
* \param selected the radio icon is selected
* \return true if successful, false otherwise
*/
-bool html_redraw_radio(int x, int y, int width, int height,
- bool selected)
+bool html_redraw_radio(int x, int y, int width, int height, bool selected)
{
/* plot background of radio button */
if (!plot.disc(x + width * 0.5,
@@ -2001,7 +1997,7 @@ bool html_redraw_file(int x, int y, int width, int height,
*/
bool html_redraw_background(int x, int y, struct box *box, float scale,
- struct rect clip, colour *background_colour,
+ const struct rect *clip, colour *background_colour,
struct box *background)
{
bool repeat_x = false;
@@ -2010,12 +2006,12 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
bool plot_content;
bool clip_to_children = false;
struct box *clip_box = box;
- int px0 = clip.x0, py0 = clip.y0, px1 = clip.x1, py1 = clip.y1;
int ox = x, oy = y;
int width, height;
css_fixed hpos = 0, vpos = 0;
css_unit hunit = CSS_UNIT_PX, vunit = CSS_UNIT_PX;
struct box *parent;
+ struct rect r = *clip;
css_color bgcol;
plot_style_t pstyle_fill_bg = {
.fill_type = PLOT_OP_TYPE_SOLID,
@@ -2119,19 +2115,19 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
assert(clip_box->type == BOX_TABLE_CELL);
/* update clip.* to the child cell */
- clip.x0 = ox + (clip_box->x * scale);
- clip.y0 = oy + (clip_box->y * scale);
- clip.x1 = clip.x0 + (clip_box->padding[LEFT] +
+ r.x0 = ox + (clip_box->x * scale);
+ r.y0 = oy + (clip_box->y * scale);
+ r.x1 = r.x0 + (clip_box->padding[LEFT] +
clip_box->width +
clip_box->padding[RIGHT]) * scale;
- clip.y1 = clip.y0 + (clip_box->padding[TOP] +
+ r.y1 = r.y0 + (clip_box->padding[TOP] +
clip_box->height +
clip_box->padding[BOTTOM]) * scale;
- if (clip.x0 < px0) clip.x0 = px0;
- if (clip.y0 < py0) clip.y0 = py0;
- if (clip.x1 > px1) clip.x1 = px1;
- if (clip.y1 > py1) clip.y1 = py1;
+ if (r.x0 < clip->x0) r.x0 = clip->x0;
+ if (r.y0 < clip->y0) r.y0 = clip->y0;
+ if (r.x1 > clip->x1) r.x1 = clip->x1;
+ if (r.y1 > clip->y1) r.y1 = clip->y1;
if (clip_box->background != NULL)
bmp = content_get_bitmap(clip_box->background);
@@ -2139,7 +2135,7 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
css_computed_background_color(clip_box->style, &bgcol);
/* <td> attributes override <tr> */
- if ((clip.x0 >= clip.x1) || (clip.y0 >= clip.y1) ||
+ if ((r.x0 >= r.x1) || (r.y0 >= r.y1) ||
(nscss_color_is_transparent(bgcol) ==
false) ||
(bmp != NULL && bitmap_get_opaque(bmp)))
@@ -2153,8 +2149,7 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
*background_colour = nscss_color_to_ns(bgcol);
pstyle_fill_bg.fill_colour = *background_colour;
if (plot_colour)
- if (!plot.rectangle(clip.x0, clip.y0,
- clip.x1, clip.y1,
+ if (!plot.rectangle(r.x0, r.y0, r.x1, r.y1,
&pstyle_fill_bg))
return false;
}
@@ -2164,25 +2159,25 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
height = content_get_height(background->background);
if (!repeat_x) {
- if (clip.x0 < x)
- clip.x0 = x;
- if (clip.x1 > x + width * scale)
- clip.x1 = x + width * scale;
+ if (r.x0 < x)
+ r.x0 = x;
+ if (r.x1 > x + width * scale)
+ r.x1 = x + width * scale;
}
if (!repeat_y) {
- if (clip.y0 < y)
- clip.y0 = y;
- if (clip.y1 > y + height * scale)
- clip.y1 = y + height * scale;
+ if (r.y0 < y)
+ r.y0 = y;
+ if (r.y1 > y + height * scale)
+ r.y1 = y + height * scale;
}
/* valid clipping rectangles only */
- if ((clip.x0 < clip.x1) && (clip.y0 < clip.y1)) {
- if (!plot.clip(&clip))
+ if ((r.x0 < r.x1) && (r.y0 < r.y1)) {
+ if (!plot.clip(&r))
return false;
if (!content_redraw_tiled(
background->background, x, y,
ceilf(width * scale),
- ceilf(height * scale), &clip,
+ ceilf(height * scale), &r,
scale, *background_colour,
repeat_x, repeat_y))
return false;
@@ -2213,9 +2208,10 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
*/
bool html_redraw_inline_background(int x, int y, struct box *box, float scale,
- struct rect clip, struct rect b, bool first, bool last,
+ const struct rect *clip, struct rect b, bool first, bool last,
colour *background_colour)
{
+ struct rect r = *clip;
bool repeat_x = false;
bool repeat_y = false;
bool plot_colour = true;
@@ -2294,8 +2290,7 @@ bool html_redraw_inline_background(int x, int y, struct box *box, float scale,
pstyle_fill_bg.fill_colour = *background_colour;
if (plot_colour)
- if (!plot.rectangle(clip.x0, clip.y0,
- clip.x1, clip.y1,
+ if (!plot.rectangle(r.x0, r.y0, r.x1, r.y1,
&pstyle_fill_bg))
return false;
}
@@ -2305,24 +2300,24 @@ bool html_redraw_inline_background(int x, int y, struct box *box, float scale,
int height = content_get_height(box->background);
if (!repeat_x) {
- if (clip.x0 < x)
- clip.x0 = x;
- if (clip.x1 > x + width * scale)
- clip.x1 = x + width * scale;
+ if (r.x0 < x)
+ r.x0 = x;
+ if (r.x1 > x + width * scale)
+ r.x1 = x + width * scale;
}
if (!repeat_y) {
- if (clip.y0 < y)
- clip.y0 = y;
- if (clip.y1 > y + height * scale)
- clip.y1 = y + height * scale;
+ if (r.y0 < y)
+ r.y0 = y;
+ if (r.y1 > y + height * scale)
+ r.y1 = y + height * scale;
}
/* valid clipping rectangles only */
- if ((clip.x0 < clip.x1) && (clip.y0 < clip.y1)) {
- if (!plot.clip(&clip))
+ if ((r.x0 < r.x1) && (r.y0 < r.y1)) {
+ if (!plot.clip(&r))
return false;
if (!content_redraw_tiled(box->background, x, y,
ceilf(width * scale),
- ceilf(height * scale), &clip,
+ ceilf(height * scale), &r,
scale, *background_colour,
repeat_x, repeat_y))
return false;