mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-24 15:29:45 +03:00
Pass clip rect to scroll_redraw as struct. Simplify test to see if scrollbar is within clip rect.
svn path=/trunk/netsurf/; revision=11679
This commit is contained in:
parent
60c74c2e3c
commit
c05333fa62
@ -203,8 +203,7 @@ static inline bool scroll_redraw_scrollbar_rectangle(
|
||||
* \param scale scale for the redraw
|
||||
* \return true on succes false otherwise
|
||||
*/
|
||||
bool scroll_redraw(struct scroll *scroll, int x, int y,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
bool scroll_redraw(struct scroll *scroll, int x, int y, struct rect *clip,
|
||||
float scale)
|
||||
{
|
||||
int w = SCROLLBAR_WIDTH;
|
||||
@ -247,26 +246,11 @@ bool scroll_redraw(struct scroll *scroll, int x, int y,
|
||||
|
||||
bar_c0 = (scroll->horizontal ? x0 : y0) + w + bar_off;
|
||||
|
||||
if (clip_x0 < x0)
|
||||
clip_x0 = x0;
|
||||
|
||||
if (clip_y0 < y0)
|
||||
clip_y0 = y0;
|
||||
|
||||
if (clip_x1 > x1 + 1)
|
||||
clip_x1 = x1 + 1;
|
||||
|
||||
if (clip_y1 > y1 + 1)
|
||||
clip_y1 = y1 + 1;
|
||||
|
||||
|
||||
if (clip_x0 > clip_x1 || clip_y0 > clip_y1)
|
||||
/* clipping rectangle is outside the scrollbar area */
|
||||
if (x1 < clip->x0 || y1 < clip->y0 || clip->x1 < x0 || clip->y1 < y0)
|
||||
/* scrollbar is outside the clipping rectangle, nothing to
|
||||
* render */
|
||||
return true;
|
||||
|
||||
if (!plot.clip(clip_x0, clip_y0, clip_x1, clip_y1))
|
||||
return false;
|
||||
|
||||
|
||||
if (scroll->horizontal) {
|
||||
/* scroll is horizontal */
|
||||
|
@ -64,8 +64,7 @@ bool scroll_create(bool horizontal, int length,
|
||||
void *client_data, scroll_client_callback client_callback,
|
||||
struct scroll **scroll_pt);
|
||||
void scroll_destroy(struct scroll *scroll);
|
||||
bool scroll_redraw(struct scroll *scroll, int x, int y,
|
||||
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
|
||||
bool scroll_redraw(struct scroll *scroll, int x, int y, struct rect *clip,
|
||||
float scale);
|
||||
|
||||
void scroll_set(struct scroll *scroll, int scroll_val, bool bar);
|
||||
|
@ -989,6 +989,11 @@ 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;
|
||||
|
||||
box = control->box;
|
||||
|
||||
@ -1079,7 +1084,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_x0, clip_y0, clip_x1, clip_y1, scale))
|
||||
&clip, scale))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -722,17 +722,13 @@ 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.x0, clip.y0, clip.x1, clip.y1,
|
||||
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.x0, clip.y0, clip.x1, clip.y1,
|
||||
scale);
|
||||
y_parent + box->y, &clip, scale);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user