summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
Diffstat (limited to 'render')
-rw-r--r--render/form.c30
-rw-r--r--render/form.h5
-rw-r--r--render/html_redraw.c43
3 files changed, 42 insertions, 36 deletions
diff --git a/render/form.c b/render/form.c
index 8c54b23d5..6c703692a 100644
--- a/render/form.c
+++ b/render/form.c
@@ -975,7 +975,7 @@ void form_free_select_menu(struct form_control *control)
* \return true on success, false otherwise
*/
bool form_redraw_select_menu(struct form_control *control, int x, int y,
- float scale, int clip_x0, int clip_y0, int clip_x1, int clip_y1)
+ float scale, const struct rect *clip)
{
struct box *box;
struct form_select_menu *menu = control->data.select.menu;
@@ -989,11 +989,7 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
int i;
int scroll;
int x_cp, y_cp;
- struct rect clip;
- clip.x0 = clip_x0;
- clip.y0 = clip_y0;
- clip.x1 = clip_x1;
- clip.y1 = clip_y1;
+ struct rect r;
box = control->box;
@@ -1028,8 +1024,12 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
x1 = x + width - 1;
y1 = y + height - 1;
scrollbar_x = x1 - scrollbar_width;
-
- if (!plot.clip(x0, y0, x1 + 1, y1 + 1))
+
+ r.x0 = x0;
+ r.y0 = y0;
+ r.x1 = x1 + 1;
+ r.y1 = y1 + 1;
+ if (!plot.clip(&r))
return false;
if (!plot.rectangle(x0, y0, x1, y1 ,plot_style_stroke_darkwbasec))
return false;
@@ -1041,7 +1041,11 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
y1 = y1 - SELECT_BORDER_WIDTH;
height = height - 2 * SELECT_BORDER_WIDTH;
- if (!plot.clip(x0, y0, x1 + 1, y1 + 1))
+ r.x0 = x0;
+ r.y0 = y0;
+ r.x1 = x1 + 1;
+ r.y1 = y1 + 1;
+ if (!plot.clip(&r))
return false;
if (!plot.rectangle(x0, y0, x1 + 1, y1 + 1,
plot_style_fill_lightwbasec))
@@ -1084,7 +1088,7 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
if (!scroll_redraw(menu->scroll,
x_cp + menu->width - SCROLLBAR_WIDTH,
y_cp,
- &clip, scale))
+ clip, scale))
return false;
return true;
@@ -1103,7 +1107,7 @@ bool form_redraw_select_menu(struct form_control *control, int x, int y,
* \return true if inside false otherwise
*/
bool form_clip_inside_select_menu(struct form_control *control, float scale,
- int clip_x0, int clip_y0, int clip_x1, int clip_y1)
+ const struct rect *clip)
{
struct form_select_menu *menu = control->data.select.menu;
int width, height;
@@ -1117,8 +1121,8 @@ bool form_clip_inside_select_menu(struct form_control *control, float scale,
height *= scale;
}
- if (clip_x0 >= 0 && clip_x1 <= width &&
- clip_y0 >= 0 && clip_y1 <= height)
+ if (clip->x0 >= 0 && clip->x1 <= width &&
+ clip->y0 >= 0 && clip->y1 <= height)
return true;
return false;
diff --git a/render/form.h b/render/form.h
index 9da24b8b9..a6cda0a99 100644
--- a/render/form.h
+++ b/render/form.h
@@ -161,10 +161,9 @@ void form_select_menu_callback(void *client_data,
int x, int y, int width, int height);
void form_free_select_menu(struct form_control *control);
bool form_redraw_select_menu(struct form_control *control, int x, int y,
- float scale,
- int clip_x0, int clip_y0, int clip_x1, int clip_y1);
+ float scale, const struct rect *clip);
bool form_clip_inside_select_menu(struct form_control *control, float scale,
- int clip_x0, int clip_y0, int clip_x1, int clip_y1);
+ const struct rect *clip);
const char *form_select_mouse_action(struct form_control *control,
browser_mouse_state mouse, int x, int y);
void form_select_mouse_drag_end(struct form_control *control,
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 8468d3007..2c355c67c 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -141,12 +141,12 @@ bool html_redraw(struct content *c, int x, int y,
/* check if the redraw rectangle is completely inside of the
select menu */
select_only = form_clip_inside_select_menu(control, scale,
- clip->x0, clip->y0, clip->x1, clip->y1);
+ clip);
}
if (!select_only) {
/* clear to background colour */
- result = plot.clip(clip->x0, clip->y0, clip->x1, clip->y1);
+ result = plot.clip(clip);
if (c->data.html.background_colour != NS_TRANSPARENT)
pstyle_fill_bg.fill_colour =
@@ -170,8 +170,7 @@ bool html_redraw(struct content *c, int x, int y,
result &= form_redraw_select_menu(
current_redraw_browser->visible_select_menu,
x + menu_x, y + menu_y,
- current_redraw_browser->scale,
- clip->x0, clip->y0, clip->x1, clip->y1);
+ current_redraw_browser->scale, clip);
}
if (want_knockout)
@@ -412,7 +411,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
/* not an error */
return ((!plot.group_end) || (plot.group_end()));
/* clip to it */
- if (!plot.clip(r.x0, r.y0, r.x1, r.y1))
+ if (!plot.clip(&r))
return false;
} else {
/* clip box unchanged */
@@ -470,7 +469,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
&current_background_color, bg_box))
return false;
/* restore previous graphics window */
- if (!plot.clip(r.x0, r.y0, r.x1, r.y1))
+ if (!plot.clip(&r))
return false;
}
}
@@ -544,7 +543,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
&current_background_color))
return false;
/* restore previous graphics window */
- if (!plot.clip(r.x0, r.y0, r.x1, r.y1))
+ if (!plot.clip(&r))
return false;
if (!html_redraw_inline_borders(box, b, r,
scale, first, false))
@@ -576,7 +575,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
first, true, &current_background_color))
return false;
/* restore previous graphics window */
- if (!plot.clip(r.x0, r.y0, r.x1, r.y1))
+ if (!plot.clip(&r))
return false;
if (!html_redraw_inline_borders(box, b, r, scale, first, true))
return false;
@@ -639,7 +638,7 @@ bool html_redraw_box(struct box *box, int x_parent, int y_parent,
return ((!plot.group_end) || (plot.group_end()));
if (box->type == BOX_BLOCK || box->type == BOX_INLINE_BLOCK ||
box->type == BOX_TABLE_CELL || box->object) {
- if (!plot.clip(r.x0, r.y0, r.x1, r.y1))
+ if (!plot.clip(&r))
return false;
}
}
@@ -734,7 +733,7 @@ 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)
- if (!plot.clip(clip.x0, clip.y0, clip.x1, clip.y1))
+ if (!plot.clip(&clip))
return false;
return ((!plot.group_end) || (plot.group_end()));
@@ -875,6 +874,7 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
/* \todo make search terms visible within selected text */
if (highlighted) {
+ struct rect r;
unsigned endtxt_idx = end_idx;
bool clip_changed = false;
bool text_visible = true;
@@ -936,8 +936,11 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
int px1 = min(x + endx, clip->x1);
if (px0 < px1) {
- if (!plot.clip(px0, clip->y0, px1,
- clip->y1))
+ r.x0 = px0;
+ r.y0 = clip->y0;
+ r.x1 = px1;
+ r.y1 = clip->y1;
+ if (!plot.clip(&r))
return false;
clip_changed = true;
} else {
@@ -961,8 +964,11 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
int px0 = max(x + endx, clip->x0);
if (px0 < clip->x1) {
- if (!plot.clip(px0, clip->y0,
- clip->x1, clip->y1))
+ r.x0 = px0;
+ r.y0 = clip->y0;
+ r.x1 = clip->x1;
+ r.y1 = clip->y1;
+ if (!plot.clip(&r))
return false;
clip_changed = true;
@@ -976,8 +982,7 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
}
if (clip_changed &&
- !plot.clip(clip->x0, clip->y0,
- clip->x1, clip->y1))
+ !plot.clip(clip))
return false;
}
}
@@ -2172,8 +2177,7 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
}
/* valid clipping rectangles only */
if ((clip.x0 < clip.x1) && (clip.y0 < clip.y1)) {
- if (!plot.clip(clip.x0, clip.y0,
- clip.x1, clip.y1))
+ if (!plot.clip(&clip))
return false;
if (!content_redraw_tiled(
background->background, x, y,
@@ -2314,8 +2318,7 @@ bool html_redraw_inline_background(int x, int y, struct box *box, float scale,
}
/* valid clipping rectangles only */
if ((clip.x0 < clip.x1) && (clip.y0 < clip.y1)) {
- if (!plot.clip(clip.x0, clip.y0,
- clip.x1, clip.y1))
+ if (!plot.clip(&clip))
return false;
if (!content_redraw_tiled(box->background, x, y,
ceilf(width * scale),