diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-07-05 20:10:17 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-07-05 20:10:17 +0000 |
commit | 0ade453958339a28b4291aefd6fd0bd2e5038afd (patch) | |
tree | 5a6be53fef4f3790f5902d8ac574c6ef725b29bb /desktop/textarea.c | |
parent | ab2391ade1592936b95b106d17a77ff09ba852a8 (diff) | |
download | netsurf-0ade453958339a28b4291aefd6fd0bd2e5038afd.tar.gz netsurf-0ade453958339a28b4291aefd6fd0bd2e5038afd.tar.bz2 |
Refactor fill plotter to take a style
svn path=/trunk/netsurf/; revision=8332
Diffstat (limited to 'desktop/textarea.c')
-rw-r--r-- | desktop/textarea.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/desktop/textarea.c b/desktop/textarea.c index 6fbcec0d8..3e0ce466a 100644 --- a/desktop/textarea.c +++ b/desktop/textarea.c @@ -41,6 +41,10 @@ #define BORDER_COLOR 0x000000 #define SELECTION_COL 0xFFDDDD +static plot_style_t plot_style_fill_selection = { + .fill_type = PLOT_OP_TYPE_SOLID, + .fill_colour = SELECTION_COL, +}; struct line_info { unsigned int b_start; /**< Byte offset of line start */ @@ -713,6 +717,10 @@ void textarea_redraw(struct text_area *ta, int x0, int y0, int x1, int y1) int chars, offset; unsigned int c_pos, c_len, b_start, b_end, line_len; char *line_text; + plot_style_t plot_style_fill_bg = { + .fill_type = PLOT_OP_TYPE_SOLID, + .fill_colour = BACKGROUND_COL, + }; if (x1 < ta->x || x0 > ta->x + ta->vis_width || y1 < ta->y || @@ -723,6 +731,9 @@ void textarea_redraw(struct text_area *ta, int x0, int y0, int x1, int y1) if (ta->lines == NULL) /* Nothing to redraw */ return; + + if (ta->flags & TEXTAREA_READONLY) + plot_style_fill_bg.fill_colour = READONLY_BG; line0 = (y0 - ta->y + ta->scroll_y) / ta->line_height - 1; line1 = (y1 - ta->y + ta->scroll_y) / ta->line_height + 1; @@ -748,8 +759,7 @@ void textarea_redraw(struct text_area *ta, int x0, int y0, int x1, int y1) y1 = ta->y + ta->vis_height; plot.clip(x0, y0, x1, y1); - plot.fill(x0, y0, x1, y1, (ta->flags & TEXTAREA_READONLY) ? - READONLY_BG : BACKGROUND_COL); + plot.fill(x0, y0, x1, y1, &plot_style_fill_bg); plot.rectangle(ta->x, ta->y, ta->vis_width - 1, ta->vis_height - 1, 1, BORDER_COLOR, false, false); @@ -837,7 +847,7 @@ void textarea_redraw(struct text_area *ta, int x0, int y0, int x1, int y1) x1 - ta->scroll_x, ta->y + (line + 1) * ta->line_height - 1 - ta->scroll_y, - SELECTION_COL); + &plot_style_fill_selection); } |