summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2009-07-08 22:04:40 +0000
committerVincent Sanders <vince@netsurf-browser.org>2009-07-08 22:04:40 +0000
commitf9ecd56f62f833f21b3475f0d1b59bc8e053a03e (patch)
tree9874485045ec0fc52fccab99ad545bdefb672203
parent651228e64d688e1a565ac88e60b736995ba84012 (diff)
downloadnetsurf-f9ecd56f62f833f21b3475f0d1b59bc8e053a03e.tar.gz
netsurf-f9ecd56f62f833f21b3475f0d1b59bc8e053a03e.tar.bz2
ploter refactor of rectangle handling
svn path=/trunk/netsurf/; revision=8399
-rwxr-xr-xamiga/plotters.c114
-rwxr-xr-xamiga/plotters.h4
-rw-r--r--beos/beos_plotters.cpp144
-rw-r--r--desktop/history_core.c13
-rw-r--r--desktop/knockout.c160
-rw-r--r--desktop/plotters.h7
-rw-r--r--desktop/save_pdf/pdf_plotters.c84
-rw-r--r--desktop/textarea.c29
-rw-r--r--framebuffer/framebuffer.c33
-rw-r--r--gtk/gtk_plotters.c70
-rw-r--r--gtk/gtk_print.c85
-rw-r--r--gtk/gtk_thumbnail.c2
-rw-r--r--render/html_redraw.c57
-rw-r--r--render/textplain.c8
-rw-r--r--riscos/gui/progress_bar.c6
-rw-r--r--riscos/gui/status_bar.c2
-rw-r--r--riscos/plotters.c121
-rw-r--r--riscos/print.c13
-rw-r--r--riscos/save_draw.c85
-rw-r--r--riscos/window.c2
20 files changed, 568 insertions, 471 deletions
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 40832ac90..9e16822f5 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -64,7 +64,6 @@ const struct plotter_table amiplot = {
.rectangle = ami_rectangle,
.line = ami_line,
.polygon = ami_polygon,
- .fill = ami_fill,
.clip = ami_clip,
.text = ami_text,
.disc = ami_disc,
@@ -122,42 +121,85 @@ bool ami_clg(colour c)
return true;
}
-bool ami_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
+bool ami_fill(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+
#ifndef NS_AMIGA_CAIRO_ALL
- glob->rp.PenWidth = line_width;
- glob->rp.PenHeight = line_width;
+ p96RectFill(&glob->rp,x0,y0,x1-1,y1-1,
+ p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour));
+#else
+ ami_cairo_set_colour(glob->cr, style->fill_colour);
+ ami_cairo_set_solid(glob->cr);
- glob->rp.LinePtrn = PATT_LINE;
- if(dotted) glob->rp.LinePtrn = PATT_DOT;
- if(dashed) glob->rp.LinePtrn = PATT_DASH;
+ cairo_set_line_width(glob->cr, 0);
+ cairo_rectangle(glob->cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_fill(glob->cr);
+ cairo_stroke(glob->cr);
+#endif
- SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
- TAG_DONE);
- Move(&glob->rp,x0,y0);
- Draw(&glob->rp,x0+width,y0);
- Draw(&glob->rp,x0+width,y0+height);
- Draw(&glob->rp,x0,y0+height);
- Draw(&glob->rp,x0,y0);
+ }
- glob->rp.PenWidth = 1;
- glob->rp.PenHeight = 1;
- glob->rp.LinePtrn = PATT_LINE;
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+#ifndef NS_AMIGA_CAIRO_ALL
+ glob->rp.PenWidth = style->stroke_width;
+ glob->rp.PenHeight = style->stroke_width;
+
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ glob->rp.LinePtrn = PATT_LINE;
+ break;
+
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ glob->rp.LinePtrn = PATT_DOT
+ break;
+
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ glob->rp.LinePtrn = PATT_DASH;
+ break;
+ }
+
+ SetRPAttrs(&glob->rp,
+ RPTAG_APenColor,
+ p96EncodeColor(RGBFB_A8B8G8R8, style->stroke_colour),
+ TAG_DONE);
+ Move(&glob->rp, x0,y0);
+ Draw(&glob->rp, x1, y0);
+ Draw(&glob->rp, x1, y1);
+ Draw(&glob->rp, x0, y1);
+ Draw(&glob->rp, x0, y0);
+
+ glob->rp.PenWidth = 1;
+ glob->rp.PenHeight = 1;
+ glob->rp.LinePtrn = PATT_LINE;
#else
- ami_cairo_set_colour(glob->cr,c);
- if (dotted) ami_cairo_set_dotted(glob->cr);
- else if (dashed) ami_cairo_set_dashed(glob->cr);
- else ami_cairo_set_solid(glob->cr);
+ ami_cairo_set_colour(glob->cr, style->stroke_colour);
- if (line_width == 0)
- line_width = 1;
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ ami_cairo_set_solid(glob->cr);
+ break;
- cairo_set_line_width(glob->cr, line_width);
- cairo_rectangle(glob->cr, x0, y0, width, height);
- cairo_stroke(glob->cr);
-#endif
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ ami_cairo_set_dotted(glob->cr);
+ break;
+
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ ami_cairo_set_dashed(glob->cr);
+ break;
+ }
+ if (style->stroke_width == 0)
+ cairo_set_line_width(glob->cr, 1);
+ else
+ cairo_set_line_width(glob->cr, style->stroke_width);
+
+ cairo_rectangle(glob->cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_stroke(glob->cr);
+#endif
+ }
return true;
}
@@ -235,22 +277,6 @@ bool ami_polygon(const int *p, unsigned int n, colour fill)
return true;
}
-bool ami_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-#ifndef NS_AMIGA_CAIRO_ALL
- p96RectFill(&glob->rp,x0,y0,x1-1,y1-1,
- p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour));
-#else
- ami_cairo_set_colour(glob->cr, style->fill_colour);
- ami_cairo_set_solid(glob->cr);
-
- cairo_set_line_width(glob->cr, 0);
- cairo_rectangle(glob->cr, x0, y0, x1 - x0, y1 - y0);
- cairo_fill(glob->cr);
- cairo_stroke(glob->cr);
-#endif
- return true;
-}
bool ami_clip(int x0, int y0, int x1, int y1)
{
diff --git a/amiga/plotters.h b/amiga/plotters.h
index 01c6c99ec..ce8154f75 100755
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -23,12 +23,10 @@
extern const struct plotter_table amiplot;
bool ami_clg(colour c);
-bool ami_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
+bool ami_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
bool ami_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
bool ami_polygon(const int *p, unsigned int n, colour fill);
-bool ami_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
bool ami_clip(int x0, int y0, int x1, int y1);
bool ami_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c);
diff --git a/beos/beos_plotters.cpp b/beos/beos_plotters.cpp
index 29fe58f2a..36ea8b6b0 100644
--- a/beos/beos_plotters.cpp
+++ b/beos/beos_plotters.cpp
@@ -61,14 +61,12 @@ cairo_t *current_cr;
* the right-bottom pixel is actually part of the BRect!
*/
-static bool nsbeos_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
+static bool nsbeos_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool nsbeos_plot_polygon(const int *p, unsigned int n, colour fill);
static bool nsbeos_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
-static bool nsbeos_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
static bool nsbeos_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
static bool nsbeos_plot_text(int x, int y, const struct css_style *style,
@@ -97,7 +95,6 @@ const struct plotter_table nsbeos_plotters = {
nsbeos_plot_rectangle,
nsbeos_plot_line,
nsbeos_plot_polygon,
- nsbeos_plot_fill,
nsbeos_plot_clip,
nsbeos_plot_text,
nsbeos_plot_disc,
@@ -139,53 +136,99 @@ void nsbeos_current_gc_set(BView *view)
current_view = view;
}
-bool nsbeos_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
+bool nsbeos_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- pattern pat = B_SOLID_HIGH;
- BView *view;
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ BView *view;
- if (dotted)
- pat = kDottedPattern;
- else if (dashed)
- pat = kDashedPattern;
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ warn_user("No GC", 0);
+ return false;
+ }
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- warn_user("No GC", 0);
- return false;
+ nsbeos_set_colour(style->fill_colour);
+
+ BRect rect(x0, y0, x1 - 1, y1 - 1);
+ view->FillRect(rect);
+
+ //nsbeos_current_gc_unlock();
+
+#if 0 /* GTK */
+ nsbeos_set_colour(style->fill_colour);
+ nsbeos_set_solid();
+#ifdef CAIRO_VERSION
+ if (option_render_cairo) {
+ cairo_set_line_width(current_cr, 0);
+ cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_fill(current_cr);
+ cairo_stroke(current_cr);
+ } else
+#endif
+ gdk_draw_rectangle(current_drawable, current_gc,
+ TRUE, x0, y0, x1 - x0, y1 - y0);
+#endif
}
- nsbeos_set_colour(c);
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ pattern pat;
+ BView *view;
- float pensize = view->PenSize();
- view->SetPenSize(line_width);
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ pat = B_SOLID_HIGH;
+ break;
- BRect rect(x0, y0, x0 + width - 1, y0 + height - 1);
- view->StrokeRect(rect, pat);
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ pat = kDottedPattern;
+ break;
- view->SetPenSize(pensize);
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ pat = kDashedPattern;
+ break;
+ }
- //nsbeos_current_gc_unlock();
+ view = nsbeos_current_gc/*_lock*/();
+ if (view == NULL) {
+ warn_user("No GC", 0);
+ return false;
+ }
+
+ nsbeos_set_colour(style->stroke_colour);
+
+ float pensize = view->PenSize();
+ view->SetPenSize(style->stroke_width);
+
+ BRect rect(x0, y0, x1, y1);
+ view->StrokeRect(rect, pat);
+
+ view->SetPenSize(pensize);
+
+ //nsbeos_current_gc_unlock();
#if 0 /* GTK */
#ifdef CAIRO_VERSION
- if (option_render_cairo) {
- if (line_width == 0)
- line_width = 1;
-
- cairo_set_line_width(current_cr, line_width);
- cairo_rectangle(current_cr, x0, y0, width, height);
- cairo_stroke(current_cr);
- } else
+ if (option_render_cairo) {
+ if (line_width == 0)
+ line_width = 1;
+
+ cairo_set_line_width(current_cr, line_width);
+ cairo_rectangle(current_cr, x0, y0, width, height);
+ cairo_stroke(current_cr);
+ } else
#endif
- gdk_draw_rectangle(current_drawable, current_gc,
- FALSE, x0, y0, width, height);
- return true;
+ gdk_draw_rectangle(current_drawable, current_gc,
+ FALSE, x0, y0, width, height);
+ return true;
#endif
+ }
+
+ return true;
}
+
bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
@@ -301,39 +344,6 @@ bool nsbeos_plot_polygon(const int *p, unsigned int n, colour fill)
}
-bool nsbeos_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
- BView *view;
-
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- warn_user("No GC", 0);
- return false;
- }
-
- nsbeos_set_colour(style->fill_colour);
-
- BRect rect(x0, y0, x1 - 1, y1 - 1);
- view->FillRect(rect);
-
- //nsbeos_current_gc_unlock();
-
-#if 0 /* GTK */
- nsbeos_set_colour(style->fill_colour);
- nsbeos_set_solid();
-#ifdef CAIRO_VERSION
- if (option_render_cairo) {
- cairo_set_line_width(current_cr, 0);
- cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
- cairo_fill(current_cr);
- cairo_stroke(current_cr);
- } else
-#endif
- gdk_draw_rectangle(current_drawable, current_gc,
- TRUE, x0, y0, x1 - x0, y1 - y0);
-#endif
- return true;
-}
bool nsbeos_plot_clip(int clip_x0, int clip_y0,
diff --git a/desktop/history_core.c b/desktop/history_core.c
index 6ec2cc137..d02820b20 100644
--- a/desktop/history_core.c
+++ b/desktop/history_core.c
@@ -628,6 +628,11 @@ bool history_redraw_entry(struct history *history,
int tailsize = 5;
int xoffset = x - x0;
int yoffset = y - y0;
+ plot_style_t pstyle_history_rect = {
+ .stroke_type = PLOT_OP_TYPE_SOLID,
+ .stroke_colour = c,
+ .stroke_width = entry == history->current ? 2 : 1,
+ };
if (clip) {
if(!plot.clip(x0 + xoffset, y0 + yoffset, x1 + xoffset, y1 + yoffset))
@@ -637,9 +642,11 @@ bool history_redraw_entry(struct history *history,
if (!plot.bitmap(entry->x + xoffset, entry->y + yoffset, WIDTH, HEIGHT,
entry->bitmap, 0xffffff, 0))
return false;
- if (!plot.rectangle(entry->x - 1 + xoffset, entry->y - 1 + yoffset,
- WIDTH + 1, HEIGHT + 1,
- entry == history->current ? 2 : 1, c, false, false))
+ if (!plot.rectangle(entry->x - 1 + xoffset,
+ entry->y - 1 + yoffset,
+ entry->x + xoffset + WIDTH,
+ entry->y + yoffset + HEIGHT,
+ &pstyle_history_rect))
return false;
if (!nsfont.font_position_in_string(&css_base_style, entry->page.title,
diff --git a/desktop/knockout.c b/desktop/knockout.c
index a31b9e0cf..807833b8b 100644
--- a/desktop/knockout.c
+++ b/desktop/knockout.c
@@ -91,9 +91,30 @@ static plot_style_t plot_style_fill_black_static = {
.fill_colour = 0x0,
};
+static plot_style_t plot_style_stroke_red_static = {
+ .stroke_type = PLOT_OP_TYPE_SOLID,
+ .stroke_colour = 0x000000ff,
+ .stroke_width = 1,
+};
+
+static plot_style_t plot_style_stroke_blue_static = {
+ .stroke_type = PLOT_OP_TYPE_SOLID,
+ .stroke_colour = 0x00ff0000,
+ .stroke_width = 1,
+};
+
+static plot_style_t plot_style_stroke_yellow_static = {
+ .stroke_type = PLOT_OP_TYPE_SOLID,
+ .stroke_colour = 0x0000ffff,
+ .stroke_width = 1,
+};
+
plot_style_t *plot_style_fill_white = &plot_style_fill_white_static;
plot_style_t *plot_style_fill_red = &plot_style_fill_red_static;
plot_style_t *plot_style_fill_black = &plot_style_fill_black_static;
+plot_style_t *plot_style_stroke_red = &plot_style_stroke_red_static;
+plot_style_t *plot_style_stroke_blue = &plot_style_stroke_blue_static;
+plot_style_t *plot_style_stroke_yellow = &plot_style_stroke_yellow_static;
struct knockout_box;
struct knockout_entry;
@@ -105,12 +126,10 @@ static bool knockout_plot_fill_recursive(struct knockout_box *box, plot_style_t
static bool knockout_plot_bitmap_recursive(struct knockout_box *box,
struct knockout_entry *entry);
-static bool knockout_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
static bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool knockout_plot_polygon(const int *p, unsigned int n, colour fill);
-static bool knockout_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *plot_style);
+static bool knockout_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *plot_style);
static bool knockout_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
static bool knockout_plot_text(int x, int y, const struct css_style *style,
@@ -132,7 +151,6 @@ const struct plotter_table knockout_plotters = {
.rectangle = knockout_plot_rectangle,
.line = knockout_plot_line,
.polygon = knockout_plot_polygon,
- .fill = knockout_plot_fill,
.clip = knockout_plot_clip,
.text = knockout_plot_text,
.disc = knockout_plot_disc,
@@ -181,12 +199,9 @@ struct knockout_entry {
struct {
int x0;
int y0;
- int width;
- int height;
- int line_width;
- colour c;
- bool dotted;
- bool dashed;
+ int x1;
+ int y1;
+ plot_style_t plot_style;
} rectangle;
struct {
int x0;
@@ -337,15 +352,12 @@ bool knockout_plot_flush(void)
for (i = 0; i < knockout_entry_cur; i++) {
switch (knockout_entries[i].type) {
case KNOCKOUT_PLOT_RECTANGLE:
- success &= plot.rectangle(
- knockout_entries[i].data.rectangle.x0,
- knockout_entries[i].data.rectangle.y0,
- knockout_entries[i].data.rectangle.width,
- knockout_entries[i].data.rectangle.height,
- knockout_entries[i].data.rectangle.line_width,
- knockout_entries[i].data.rectangle.c,
- knockout_entries[i].data.rectangle.dotted,
- knockout_entries[i].data.rectangle.dashed);
+ success &= plot.rectangle(
+ knockout_entries[i].data.rectangle.x0,
+ knockout_entries[i].data.rectangle.y0,
+ knockout_entries[i].data.rectangle.x1,
+ knockout_entries[i].data.rectangle.y1,
+ &knockout_entries[i].data.rectangle.plot_style);
break;
case KNOCKOUT_PLOT_LINE:
success &= plot.line(
@@ -370,7 +382,7 @@ bool knockout_plot_flush(void)
success &= knockout_plot_fill_recursive(box,
&knockout_entries[i].data.fill.plot_style);
else if (!knockout_entries[i].box->deleted)
- success &= plot.fill(
+ success &= plot.rectangle(
knockout_entries[i].data.fill.x0,
knockout_entries[i].data.fill.y0,
knockout_entries[i].data.fill.x1,
@@ -605,11 +617,11 @@ bool knockout_plot_fill_recursive(struct knockout_box *box, plot_style_t *plot_s
if (parent->child)
knockout_plot_fill_recursive(parent->child, plot_style);
else
- success &= plot.fill(parent->bbox.x0,
- parent->bbox.y0,
- parent->bbox.x1,
- parent->bbox.y1,
- plot_style);
+ success &= plot.rectangle(parent->bbox.x0,
+ parent->bbox.y0,
+ parent->bbox.x1,
+ parent->bbox.y1,
+ plot_style);
}
return success;
}
@@ -643,26 +655,57 @@ bool knockout_plot_bitmap_recursive(struct knockout_box *box,
return success;
}
+bool knockout_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *pstyle)
+{
+ int kx0, ky0, kx1, ky1;
+ if (pstyle->fill_type != PLOT_OP_TYPE_NONE) {
+ /* filled draw */
-bool knockout_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
-{
- knockout_entries[knockout_entry_cur].data.rectangle.x0 = x0;
- knockout_entries[knockout_entry_cur].data.rectangle.y0 = y0;
- knockout_entries[knockout_entry_cur].data.rectangle.width = width;
- knockout_entries[knockout_entry_cur].data.rectangle.height = height;
- knockout_entries[knockout_entry_cur].data.rectangle.line_width = line_width;
- knockout_entries[knockout_entry_cur].data.rectangle.c = c;
- knockout_entries[knockout_entry_cur].data.rectangle.dotted = dotted;
- knockout_entries[knockout_entry_cur].data.rectangle.dashed = dashed;
- knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_RECTANGLE;
- if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
- knockout_plot_flush();
+ /* get our bounds */
+ kx0 = (x0 > clip_x0_cur) ? x0 : clip_x0_cur;
+ ky0 = (y0 > clip_y0_cur) ? y0 : clip_y0_cur;
+ kx1 = (x1 < clip_x1_cur) ? x1 : clip_x1_cur;
+ ky1 = (y1 < clip_y1_cur) ? y1 : clip_y1_cur;
+ if ((kx0 > clip_x1_cur) || (kx1 < clip_x0_cur) ||
+ (ky0 > clip_y1_cur) || (ky1 < clip_y0_cur))
+ return true;
+
+ /* fills both knock out and get knocked out */
+ knockout_calculate(kx0, ky0, kx1, ky1, NULL);
+ knockout_boxes[knockout_box_cur].bbox.x0 = x0;
+ knockout_boxes[knockout_box_cur].bbox.y0 = y0;
+ knockout_boxes[knockout_box_cur].bbox.x1 = x1;
+ knockout_boxes[knockout_box_cur].bbox.y1 = y1;
+ knockout_boxes[knockout_box_cur].deleted = false;
+ knockout_boxes[knockout_box_cur].child = NULL;
+ knockout_boxes[knockout_box_cur].next = knockout_list;
+ knockout_list = &knockout_boxes[knockout_box_cur];
+ knockout_entries[knockout_entry_cur].box = &knockout_boxes[knockout_box_cur];
+ knockout_entries[knockout_entry_cur].data.fill.x0 = x0;
+ knockout_entries[knockout_entry_cur].data.fill.y0 = y0;
+ knockout_entries[knockout_entry_cur].data.fill.x1 = x1;
+ knockout_entries[knockout_entry_cur].data.fill.y1 = y1;
+ knockout_entries[knockout_entry_cur].data.fill.plot_style = *pstyle;
+ knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_FILL;
+ if ((++knockout_entry_cur >= KNOCKOUT_ENTRIES) ||
+ (++knockout_box_cur >= KNOCKOUT_BOXES))
+ knockout_plot_flush();
+ } else if (pstyle->stroke_type != PLOT_OP_TYPE_NONE) {
+ /* not a filled area */
+
+ knockout_entries[knockout_entry_cur].data.rectangle.x0 = x0;
+ knockout_entries[knockout_entry_cur].data.rectangle.y0 = y0;
+ knockout_entries[knockout_entry_cur].data.rectangle.x1 = x1;
+ knockout_entries[knockout_entry_cur].data.rectangle.y1 = y1;
+ knockout_entries[knockout_entry_cur].data.fill.plot_style = *pstyle;
+ knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_RECTANGLE;
+ if (++knockout_entry_cur >= KNOCKOUT_ENTRIES)
+ knockout_plot_flush();
+ }
return true;
}
-
bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
@@ -719,43 +762,6 @@ bool knockout_plot_path(const float *p, unsigned int n, colour fill,
}
-bool knockout_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *plot_style)
-{
- int kx0, ky0, kx1, ky1;
-
- /* get our bounds */
- kx0 = (x0 > clip_x0_cur) ? x0 : clip_x0_cur;
- ky0 = (y0 > clip_y0_cur) ? y0 : clip_y0_cur;
- kx1 = (x1 < clip_x1_cur) ? x1 : clip_x1_cur;
- ky1 = (y1 < clip_y1_cur) ? y1 : clip_y1_cur;
- if ((kx0 > clip_x1_cur) || (kx1 < clip_x0_cur) ||
- (ky0 > clip_y1_cur) || (ky1 < clip_y0_cur))
- return true;
-
- /* fills both knock out and get knocked out */
- knockout_calculate(kx0, ky0, kx1, ky1, NULL);
- knockout_boxes[knockout_box_cur].bbox.x0 = x0;
- knockout_boxes[knockout_box_cur].bbox.y0 = y0;
- knockout_boxes[knockout_box_cur].bbox.x1 = x1;
- knockout_boxes[knockout_box_cur].bbox.y1 = y1;
- knockout_boxes[knockout_box_cur].deleted = false;
- knockout_boxes[knockout_box_cur].child = NULL;
- knockout_boxes[knockout_box_cur].next = knockout_list;
- knockout_list = &knockout_boxes[knockout_box_cur];
- knockout_entries[knockout_entry_cur].box = &knockout_boxes[knockout_box_cur];
- knockout_entries[knockout_entry_cur].data.fill.x0 = x0;
- knockout_entries[knockout_entry_cur].data.fill.y0 = y0;
- knockout_entries[knockout_entry_cur].data.fill.x1 = x1;
- knockout_entries[knockout_entry_cur].data.fill.y1 = y1;
- knockout_entries[knockout_entry_cur].data.fill.plot_style = *plot_style;
- knockout_entries[knockout_entry_cur].type = KNOCKOUT_PLOT_FILL;
- if ((++knockout_entry_cur >= KNOCKOUT_ENTRIES) ||
- (++knockout_box_cur >= KNOCKOUT_BOXES))
- knockout_plot_flush();
- return true;
-}
-
-
bool knockout_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1)
{
diff --git a/desktop/plotters.h b/desktop/plotters.h
index d634f2135..3f317b1af 100644
--- a/desktop/plotters.h
+++ b/desktop/plotters.h
@@ -55,6 +55,9 @@ typedef struct {
extern plot_style_t *plot_style_fill_white;
extern plot_style_t *plot_style_fill_red;
extern plot_style_t *plot_style_fill_black;
+extern plot_style_t *plot_style_stroke_red;
+extern plot_style_t *plot_style_stroke_blue;
+extern plot_style_t *plot_style_stroke_yellow;
/** Set of target specific plotting functions.
*
@@ -115,12 +118,10 @@ extern plot_style_t *plot_style_fill_black;
* 3 | | | | | |
*/
struct plotter_table {
- bool (*rectangle)(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
+ bool (*rectangle)(int x0, int y0, int x1, int y1, const plot_style_t *style);
bool (*line)(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
bool (*polygon)(const int *p, unsigned int n, colour fill);
- bool (*fill)(int x0, int y0, int x1, int y1, plot_style_t *style);
bool (*clip)(int x0, int y0, int x1, int y1);
bool (*text)(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c);
diff --git a/desktop/save_pdf/pdf_plotters.c b/desktop/save_pdf/pdf_plotters.c
index 7f573d9aa..468c19ed1 100644
--- a/desktop/save_pdf/pdf_plotters.c
+++ b/desktop/save_pdf/pdf_plotters.c
@@ -45,12 +45,10 @@
/* #define PDF_DEBUG */
/* #define PDF_DEBUG_DUMPGRID */
-static bool pdf_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
+static bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool pdf_plot_polygon(const int *p, unsigned int n, colour fill);
-static bool pdf_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
static bool pdf_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
static bool pdf_plot_text(int x, int y, const struct css_style *style,
@@ -126,7 +124,6 @@ static const struct plotter_table pdf_plotters = {
.rectangle = pdf_plot_rectangle,
.line = pdf_plot_line,
.polygon = pdf_plot_polygon,
- .fill = pdf_plot_fill,
.clip = pdf_plot_clip,
.text = pdf_plot_text,
.disc = pdf_plot_disc,
@@ -146,19 +143,59 @@ const struct printer pdf_printer = {
static char *owner_pass;
static char *user_pass;
-bool pdf_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
+bool pdf_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *pstyle)
{
+ DashPattern_e dash;
#ifdef PDF_DEBUG
- LOG(("."));
+ LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, style->fill_colour));
#endif
- apply_clip_and_mode(false, TRANSPARENT, c, line_width,
- (dotted) ? DashPattern_eDotted :
- ((dashed) ? DashPattern_eDash : DashPattern_eNone));
+ if (pstyle->fill_type != PLOT_OP_TYPE_NONE) {
- HPDF_Page_Rectangle(pdf_page, x0, page_height - y0, width, -height);
- HPDF_Page_Stroke(pdf_page);
+ apply_clip_and_mode(false, pstyle->fill_colour, TRANSPARENT, 0., DashPattern_eNone);
+
+ /* Normalize boundaries of the area - to prevent
+ overflows. It is needed only in a few functions,
+ where integers are subtracted. When the whole
+ browser window is meant min and max int values are
+ used what must be handled in paged output.
+ */
+ x0 = min(max(x0, 0), page_width);
+ y0 = min(max(y0, 0), page_height);
+ x1 = min(max(x1, 0), page_width);
+ y1 = min(max(y1, 0), page_height);
+
+ HPDF_Page_Rectangle(pdf_page, x0, page_height - y1, x1 - x0, y1 - y0);
+ HPDF_Page_Fill(pdf_page);
+
+ }
+
+ if (pstyle->stroke_type != PLOT_OP_TYPE_NONE) {
+
+ switch (pstyle->stroke_type) {
+ case PLOT_OP_TYPE_DOT:
+ dash = DashPattern_eDotted;
+ break;
+
+ case PLOT_OP_TYPE_DASH:
+ dash = DashPattern_eDash;
+ break;
+
+ default:
+ dash = DashPattern_eNone;
+ break;
+
+ }
+
+ apply_clip_and_mode(false,
+ TRANSPARENT,
+ pstyle->stroke_colour,
+ pstyle->stroke_width,
+ dash);
+
+ HPDF_Page_Rectangle(pdf_page, x0, page_height - y0, x1 - x0, -(y1 - y0));
+ HPDF_Page_Stroke(pdf_page);
+ }
return true;
}
@@ -214,29 +251,6 @@ bool pdf_plot_polygon(const int *p, unsigned int n, colour fill)
return true;
}
-bool pdf_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
-#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height - y0, style->fill_colour));
-#endif
-
- apply_clip_and_mode(false, style->fill_colour, TRANSPARENT, 0., DashPattern_eNone);
-
- /*Normalize boundaries of the area - to prevent overflows.
- It is needed only in a few functions, where integers are subtracted.
- When the whole browser window is meant min and max int values are used
- what must be handled in paged output.
- */
- x0 = min(max(x0, 0), page_width);
- y0 = min(max(y0, 0), page_height);
- x1 = min(max(x1, 0), page_width);
- y1 = min(max(y1, 0), page_height);
-
- HPDF_Page_Rectangle(pdf_page, x0, page_height - y1, x1 - x0, y1 - y0);
- HPDF_Page_Fill(pdf_page);
-
- return true;
-}
/**here the clip is only queried */
bool pdf_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1)
diff --git a/desktop/textarea.c b/desktop/textarea.c
index 20aaeed78..520b53090 100644
--- a/desktop/textarea.c
+++ b/desktop/textarea.c
@@ -41,11 +41,17 @@
#define BORDER_COLOR 0x000000
#define SELECTION_COL 0xFFDDDD
-static plot_style_t plot_style_fill_selection = {
+static plot_style_t pstyle_fill_selection = {
.fill_type = PLOT_OP_TYPE_SOLID,
.fill_colour = SELECTION_COL,
};
+static plot_style_t pstyle_stroke_border = {
+ .stroke_type = PLOT_OP_TYPE_SOLID,
+ .stroke_colour = BORDER_COLOR,
+ .stroke_width = 1,
+};
+
struct line_info {
unsigned int b_start; /**< Byte offset of line start */
unsigned int b_length; /**< Byte length of line */
@@ -782,9 +788,10 @@ 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, &plot_style_fill_bg);
- plot.rectangle(ta->x, ta->y, ta->vis_width - 1, ta->vis_height - 1, 1,
- BORDER_COLOR, false, false);
+ plot.rectangle(x0, y0, x1, y1, &plot_style_fill_bg);
+ plot.rectangle(ta->x, ta->y,
+ ta->x + ta->vis_width - 1, ta->y + ta->vis_height - 1,
+ &pstyle_stroke_border);
if (x0 < ta->x + MARGIN_LEFT)
x0 = ta->x + MARGIN_LEFT;
@@ -864,13 +871,13 @@ void textarea_redraw(struct text_area *ta, int x0, int y0, int x1, int y1)
b_start]),
b_end, &x1);
x1 += x0;
- plot.fill(x0 - ta->scroll_x, ta->y +
- line * ta->line_height
- + 1 - ta->scroll_y,
- x1 - ta->scroll_x,
- ta->y + (line + 1) * ta->line_height -
- 1 - ta->scroll_y,
- &plot_style_fill_selection);
+ plot.rectangle(x0 - ta->scroll_x, ta->y +
+ line * ta->line_height
+ + 1 - ta->scroll_y,
+ x1 - ta->scroll_x,
+ ta->y + (line + 1) * ta->line_height -
+ 1 - ta->scroll_y,
+ &pstyle_fill_selection);
}
diff --git a/framebuffer/framebuffer.c b/framebuffer/framebuffer.c
index e901d545b..41ede39c6 100644
--- a/framebuffer/framebuffer.c
+++ b/framebuffer/framebuffer.c
@@ -198,16 +198,32 @@ framebuffer_plot_bitmap(int x, int y,
}
static bool
-framebuffer_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
+framebuffer_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- nsfb_bbox_t rect;
- rect.x0 = x0;
- rect.y0 = y0;
- rect.x1 = x1;
- rect.y1 = y1;
+ nsfb_bbox_t rect;
+ bool dotted = false;
+ bool dashed = false;
- return nsfb_plot_rectangle_fill(nsfb, &rect, style->fill_colour);
+ rect.x0 = x0;
+ rect.y0 = y0;
+ rect.x1 = x1;
+ rect.y1 = y1;
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ nsfb_plot_rectangle_fill(nsfb, &rect, style->fill_colour);
+ }
+
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ if (style->stroke_type == PLOT_OP_TYPE_DOT)
+ dotted = true;
+
+ if (style->stroke_type == PLOT_OP_TYPE_DASH)
+ dashed = true;
+
+ nsfb_plot_rectangle(nsfb, &rect, style->stroke_width, style->stroke_colour, dotted, dashed);
+ }
+
+ return true;
}
static bool framebuffer_plot_flush(void)
@@ -229,10 +245,9 @@ framebuffer_plot_path(const float *p,
}
struct plotter_table plot = {
- .rectangle = nsfb_lplot_rectangle,
+ .rectangle = framebuffer_plot_rectangle,
.line = nsfb_lplot_line,
.polygon = nsfb_lplot_polygon,
- .fill = framebuffer_plot_fill,
.clip = nsfb_lplot_clip,
.text = framebuffer_plot_text,
.disc = nsfb_lplot_disc,
diff --git a/gtk/gtk_plotters.c b/gtk/gtk_plotters.c
index 6c7306b11..2a843c5b8 100644
--- a/gtk/gtk_plotters.c
+++ b/gtk/gtk_plotters.c
@@ -49,14 +49,12 @@ GdkDrawable *current_drawable;
GdkGC *current_gc;
cairo_t *current_cr;
-static bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
static bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool nsgtk_plot_polygon(const int *p, unsigned int n, colour fill);
static bool nsgtk_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
-static bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
+static bool nsgtk_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool nsgtk_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
static bool nsgtk_plot_text(int x, int y, const struct css_style *style,
@@ -80,7 +78,6 @@ const struct plotter_table nsgtk_plotters = {
.rectangle = nsgtk_plot_rectangle,
.line = nsgtk_plot_line,
.polygon = nsgtk_plot_polygon,
- .fill = nsgtk_plot_fill,
.clip = nsgtk_plot_clip,
.text = nsgtk_plot_text,
.disc = nsgtk_plot_disc,
@@ -91,28 +88,47 @@ const struct plotter_table nsgtk_plotters = {
};
-bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
+bool nsgtk_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- nsgtk_set_colour(c);
- if (dotted)
- nsgtk_set_dotted();
- else if (dashed)
- nsgtk_set_dashed();
- else
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ nsgtk_set_colour(style->fill_colour);
nsgtk_set_solid();
- if (line_width == 0)
- line_width = 1;
-
- cairo_set_line_width(current_cr, line_width);
- cairo_rectangle(current_cr, x0 + 0.5, y0 + 0.5, width, height);
- cairo_stroke(current_cr);
-
+ cairo_set_line_width(current_cr, 0);
+ cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_fill(current_cr);
+ cairo_stroke(current_cr);
+ }
+
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ nsgtk_set_colour(style->stroke_colour);
+
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ nsgtk_set_solid();
+ break;
+
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ nsgtk_set_dotted();
+ break;
+
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ nsgtk_set_dashed();
+ break;
+ }
+
+ if (style->stroke_width == 0)
+ cairo_set_line_width(current_cr, 1);
+ else
+ cairo_set_line_width(current_cr, style->stroke_width);
+
+ cairo_rectangle(current_cr, x0 + 0.5, y0 + 0.5, x1 - x0, y1 - y0);
+ cairo_stroke(current_cr);
+ }
return true;
}
-
bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
@@ -155,20 +171,6 @@ bool nsgtk_plot_polygon(const int *p, unsigned int n, colour fill)
}
-bool nsgtk_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
- nsgtk_set_colour(style->fill_colour);
- nsgtk_set_solid();
-
- cairo_set_line_width(current_cr, 0);
- cairo_rectangle(current_cr, x0, y0, x1 - x0, y1 - y0);
- cairo_fill(current_cr);
- cairo_stroke(current_cr);
-
- return true;
-}
-
-
bool nsgtk_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1)
{
diff --git a/gtk/gtk_print.c b/gtk/gtk_print.c
index 4e7251ebd..851b690ba 100644
--- a/gtk/gtk_print.c
+++ b/gtk/gtk_print.c
@@ -45,14 +45,12 @@
#include "utils/log.h"
#include "utils/utils.h"
-static bool nsgtk_print_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
+static bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool nsgtk_print_plot_polygon(const int *p, unsigned int n, colour fill);
static bool nsgtk_print_plot_path(const float *p, unsigned int n, colour fill,
float width, colour c, const float transform[6]);
-static bool nsgtk_print_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
static bool nsgtk_print_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
static bool nsgtk_print_plot_text(int x, int y, const struct css_style *style,
@@ -91,7 +89,6 @@ static const struct plotter_table nsgtk_print_plotters = {
.rectangle = nsgtk_print_plot_rectangle,
.line = nsgtk_print_plot_line,
.polygon = nsgtk_print_plot_polygon,
- .fill = nsgtk_print_plot_fill,
.clip = nsgtk_print_plot_clip,
.text = nsgtk_print_plot_text,
.disc = nsgtk_print_plot_disc,
@@ -108,31 +105,61 @@ static const struct printer gtk_printer = {
gtk_print_end
};
-bool nsgtk_print_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
+bool nsgtk_print_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- LOG(("Plotting rectangle. width: %i ; height: %i", width, height));
+ LOG(("x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i", x0,y0,x1,y1));
- nsgtk_print_set_colour(c);
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
- if (dotted)
- nsgtk_print_set_dotted();
- else if (dashed)
- nsgtk_print_set_dashed();
- else
+ nsgtk_print_set_colour(style->fill_colour);
nsgtk_print_set_solid();
+
+ /* Normalize boundaries of the area - to prevent overflows.
+ * See comment in pdf_plot_fill. */
+ x0 = min(max(x0, 0), settings->page_width);
+ y0 = min(max(y0, 0), settings->page_height);
+ x1 = min(max(x1, 0), settings->page_width);
+ y1 = min(max(y1, 0), settings->page_height);
+
+ cairo_set_line_width(gtk_print_current_cr, 0);
+ cairo_rectangle(gtk_print_current_cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_fill(gtk_print_current_cr);
+ cairo_stroke(gtk_print_current_cr);
+ }
- if (line_width == 0)
- line_width = 1;
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ nsgtk_print_set_colour(style->stroke_colour);
- cairo_set_line_width(gtk_print_current_cr, line_width);
- cairo_rectangle(gtk_print_current_cr, x0, y0, width, height);
- cairo_stroke(gtk_print_current_cr);
+ switch (style->stroke_type) {
+ case PLOT_OP_TYPE_SOLID: /**< Solid colour */
+ default:
+ nsgtk_print_set_solid();
+ break;
+ case PLOT_OP_TYPE_DOT: /**< Doted plot */
+ nsgtk_print_set_dotted();
+ break;
+
+ case PLOT_OP_TYPE_DASH: /**< dashed plot */
+ nsgtk_print_set_dashed();
+ break;
+ }
+
+ if (style->stroke_width == 0)
+ cairo_set_line_width(gtk_print_current_cr, 1);
+ else
+ cairo_set_line_width(gtk_print_current_cr, style->stroke_width);
+
+ cairo_rectangle(gtk_print_current_cr, x0, y0, x1 - x0, y1 - y0);
+ cairo_stroke(gtk_print_current_cr);
+ }
+
return true;
}
+
+
bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
@@ -183,28 +210,6 @@ bool nsgtk_print_plot_polygon(const int *p, unsigned int n, colour fill)
}
-bool nsgtk_print_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
- LOG(("Plotting fill. x0: %i ;\t y0: %i ;\t x1: %i ;\t y1: %i",
- x0,y0,x1,y1));
-
- nsgtk_print_set_colour(style->fill_colour);
- nsgtk_print_set_solid();
-
- /* Normalize boundaries of the area - to prevent overflows.
- * See comment in pdf_plot_fill. */
- x0 = min(max(x0, 0), settings->page_width);
- y0 = min(max(y0, 0), settings->page_height);
- x1 = min(max(x1, 0), settings->page_width);
- y1 = min(max(y1, 0), settings->page_height);
-
- cairo_set_line_width(gtk_print_current_cr, 0);
- cairo_rectangle(gtk_print_current_cr, x0, y0, x1 - x0, y1 - y0);
- cairo_fill(gtk_print_current_cr);
- cairo_stroke(gtk_print_current_cr);
-
- return true;
-}
bool nsgtk_print_plot_clip(int clip_x0, int clip_y0,
diff --git a/gtk/gtk_thumbnail.c b/gtk/gtk_thumbnail.c
index 32f670958..bbf7c4dd2 100644
--- a/gtk/gtk_thumbnail.c
+++ b/gtk/gtk_thumbnail.c
@@ -95,7 +95,7 @@ bool thumbnail_create(struct content *content, struct bitmap *bitmap,
#ifdef CAIRO_VERSION
current_cr = gdk_cairo_create(current_drawable);
#endif
- plot.fill(0, 0, cwidth, cwidth, plot_style_fill_white);
+ plot.rectangle(0, 0, cwidth, cwidth, plot_style_fill_white);
/* render the content */
content_redraw(content, 0, 0, content->width, content->width,
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 5be0e4c37..ad695158c 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -153,7 +153,7 @@ bool html_redraw(struct content *c, int x, int y,
if (c->data.html.background_colour != TRANSPARENT)
pstyle_fill_bg.fill_colour = c->data.html.background_colour;
- result &= plot.fill(clip_x0, clip_y0, clip_x1, clip_y1, &pstyle_fill_bg);
+ result &= plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, &pstyle_fill_bg);
result &= html_redraw_box(box, x, y,
clip_x0, clip_y0, clip_x1, clip_y1,
@@ -315,23 +315,22 @@ bool html_redraw_box(struct box *box,
/* dotted debug outlines */
if (html_redraw_debug) {
- if (!plot.rectangle(x, y, padding_width, padding_height,
- 1, 0x0000ff, true, false))
+ if (!plot.rectangle(x, y,
+ x + padding_width, y + padding_height,
+ plot_style_stroke_red))
return false;
- if (!plot.rectangle(x + padding_left, y + padding_top,
- width, height, 1, 0xff0000, true, false))
+ if (!plot.rectangle(x + padding_left,
+ y + padding_top,
+ x + padding_left + width,
+ y + padding_top + height,
+ plot_style_stroke_blue))
return false;
- if (!plot.rectangle(x - (box->border[LEFT] +
- box->margin[LEFT]) * scale,
- y - (box->border[TOP] +
- box->margin[TOP]) * scale,
- padding_width + (box->border[LEFT] +
- box->margin[LEFT] + box->border[RIGHT] +
- box->margin[RIGHT]) * scale,
- padding_height + (box->border[TOP] +
- box->margin[TOP] + box->border[BOTTOM] +
- box->margin[BOTTOM]) * scale,
- 1, 0x00ffff, true, false))
+ if (!plot.rectangle(
+ x - (box->border[LEFT] + box->margin[LEFT]) * scale,
+ y - (box->border[TOP] + box->margin[TOP]) * scale,
+ (x - (box->border[LEFT] + box->margin[LEFT]) * scale) + (padding_width + (box->border[LEFT] + box->margin[LEFT] + box->border[RIGHT] + box->margin[RIGHT]) * scale),
+ (y - (box->border[TOP] + box->margin[TOP]) * scale) + (padding_height + (box->border[TOP] + box->margin[TOP] + box->border[BOTTOM] + box->margin[BOTTOM]) * scale),
+ plot_style_stroke_yellow))
return false;
}
@@ -858,7 +857,7 @@ bool text_redraw(const char *utf8_text, size_t utf8_len,
pstyle_fill_hback = plot_style_fill_black;
/* highlighted portion */
- if (!plot.fill(x + startx, y, x + endx,
+ if (!plot.rectangle(x + startx, y, x + endx,
y + height * scale,
pstyle_fill_hback))
return false;
@@ -1319,7 +1318,7 @@ bool html_redraw_checkbox(int x, int y, int width, int height,
if (z == 0)
z = 1;
- if (!(plot.fill(x, y, x + width, y + height, &pstyle_fill_wbasec) &&
+ if (!(plot.rectangle(x, y, x + width, y + height, &pstyle_fill_wbasec) &&
plot.line(x, y, x + width, y, 1, dark, false, false) &&
plot.line(x, y, x, y + height, 1, dark, false, false) &&
plot.line(x + width, y, x + width, y + height, 1, lite,
@@ -1331,7 +1330,7 @@ bool html_redraw_checkbox(int x, int y, int width, int height,
if (selected) {
if (width < 12 || height < 12) {
/* render a solid box instead of a tick */
- if (!plot.fill(x + z + z, y + z + z,
+ if (!plot.rectangle(x + z + z, y + z + z,
x + width - z, y + height - z,
&pstyle_fill_wblobc))
return false;
@@ -1605,7 +1604,7 @@ bool html_redraw_background(int x, int y, struct box *box, float scale,
pstyle_fill_bg.fill_colour =
background->style->background_color;
if (plot_colour)
- if (!plot.fill(clip_x0, clip_y0,
+ if (!plot.rectangle(clip_x0, clip_y0,
clip_x1, clip_y1,
&pstyle_fill_bg))
return false;
@@ -1774,7 +1773,7 @@ bool html_redraw_inline_background(int x, int y, struct box *box, float scale,
box->style->background_color;
if (plot_colour)
- if (!plot.fill(clip_x0, clip_y0,
+ if (!plot.rectangle(clip_x0, clip_y0,
clip_x1, clip_y1,
&pstyle_fill_bg))
return false;
@@ -2012,7 +2011,7 @@ bool html_redraw_scrollbars(struct box *box, float scale,
y + padding_height - 2,
css_scrollbar_fg_colour, false);
/* left arrow icon background */
- if (!plot.fill(x + 2,
+ if (!plot.rectangle(x + 2,
y + padding_height - w + 2,
x + w - 2,
y + padding_height - 2,
@@ -2028,7 +2027,7 @@ bool html_redraw_scrollbars(struct box *box, float scale,
if (!plot.polygon(v, 3, css_scrollbar_arrow_colour))
return false;
/* scroll well background */
- if (!plot.fill(x + w - 1,
+ if (!plot.rectangle(x + w - 1,
y + padding_height - w + 1,
x + w + well_width + (vscroll ? 2 : 1),
y + padding_height - 1,
@@ -2040,7 +2039,7 @@ bool html_redraw_scrollbars(struct box *box, float scale,
x + w + bar_left + bar_width + (vscroll? 1 : 0),
y + padding_height - 2,
css_scrollbar_fg_colour, false);
- if (!plot.fill(x + w + bar_left + 1,
+ if (!plot.rectangle(x + w + bar_left + 1,
y + padding_height - w + 2,
x + w + bar_left + bar_width + (vscroll? 1 : 0),
y + padding_height - 2,
@@ -2053,7 +2052,7 @@ bool html_redraw_scrollbars(struct box *box, float scale,
y + padding_height - 2,
css_scrollbar_fg_colour, false);
/* right arrow icon background */
- if (!plot.fill(x + w + well_width + 3,
+ if (!plot.rectangle(x + w + well_width + 3,
y + padding_height - w + 2,
x + w + well_width + w - (vscroll ? 1 : 2),
y + padding_height - 2,
@@ -2084,7 +2083,7 @@ bool html_redraw_scrollbars(struct box *box, float scale,
x + padding_width - 2,
y + w - 2,
css_scrollbar_fg_colour, false);
- if (!plot.fill(x + padding_width - w + 2,
+ if (!plot.rectangle(x + padding_width - w + 2,
y + 2,
x + padding_width - 2,
y + w - 2,
@@ -2100,7 +2099,7 @@ bool html_redraw_scrollbars(struct box *box, float scale,
if (!plot.polygon(v, 3, css_scrollbar_arrow_colour))
return false;
/* scroll well background */
- if (!plot.fill(x + padding_width - w + 1,
+ if (!plot.rectangle(x + padding_width - w + 1,
y + w - 1,
x + padding_width - 1,
y + padding_height - w + 1,
@@ -2112,7 +2111,7 @@ bool html_redraw_scrollbars(struct box *box, float scale,
x + padding_width - 2,
y + w + bar_top + bar_height,
css_scrollbar_fg_colour, false);
- if (!plot.fill(x + padding_width - w + 2,
+ if (!plot.rectangle(x + padding_width - w + 2,
y + w + bar_top + 1,
x + padding_width - 2,
y + w + bar_top + bar_height,
@@ -2124,7 +2123,7 @@ bool html_redraw_scrollbars(struct box *box, float scale,
x + padding_width - 2,
y + padding_height - 2,
css_scrollbar_fg_colour, false);
- if (!plot.fill(x + padding_width - w + 2,
+ if (!plot.rectangle(x + padding_width - w + 2,
y + padding_height - w + 2,
x + padding_width - 2,
y + padding_height - 2,
diff --git a/render/textplain.c b/render/textplain.c
index 50ce937dd..c1ee1cf43 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -358,7 +358,7 @@ bool textplain_redraw(struct content *c, int x, int y,
if (line1 < line0)
line1 = line0;
- if (!plot.fill(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white))
+ if (!plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white))
return false;
if (!line)
@@ -437,9 +437,9 @@ bool textplain_redraw(struct content *c, int x, int y,
if (highlighted) {
int sy = y + (lineno * scaled_line_height);
- if (!plot.fill(tx, sy,
- ntx, sy + scaled_line_height,
- plot_style_highlight))
+ if (!plot.rectangle(tx, sy,
+ ntx, sy + scaled_line_height,
+ plot_style_highlight))
return false;
}
}
diff --git a/riscos/gui/progress_bar.c b/riscos/gui/progress_bar.c
index f1f214b01..bee9581aa 100644
--- a/riscos/gui/progress_bar.c
+++ b/riscos/gui/progress_bar.c
@@ -509,9 +509,9 @@ void ro_gui_progress_bar_redraw_window(wimp_draw *redraw,
progress_ymid - progress_height,
tinct_FILL_HORIZONTALLY);
} else {
- plot.fill(clip_x0, clip_y0,
- clip_x1, clip_y1,
- plot_style_fill_red);
+ plot.rectangle(clip_x0, clip_y0,
+ clip_x1, clip_y1,
+ plot_style_fill_red);
}
}
}
diff --git a/riscos/gui/status_bar.c b/riscos/gui/status_bar.c
index 37af0f75f..b56529f07 100644
--- a/riscos/gui/status_bar.c
+++ b/riscos/gui/status_bar.c
@@ -495,7 +495,7 @@ void ro_gui_status_bar_redraw(wimp_draw *redraw)
}
/* separate the widget from the text with a line */
- plot.fill((redraw->box.x0 + sb->width - WIDGET_WIDTH - 2) >> 1,
+ plot.rectangle((redraw->box.x0 + sb->width - WIDGET_WIDTH - 2) >> 1,
-redraw->box.y0 >> 1,
(redraw->box.x0 + sb->width - WIDGET_WIDTH) >> 1,
-redraw->box.y1 >> 1,
diff --git a/riscos/plotters.c b/riscos/plotters.c
index 5422d3211..88a3179fd 100644
--- a/riscos/plotters.c
+++ b/riscos/plotters.c
@@ -34,8 +34,7 @@
#include "utils/log.h"
-static bool ro_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
+static bool ro_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool ro_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool ro_plot_draw_path(const draw_path * const path, int width,
@@ -43,7 +42,6 @@ static bool ro_plot_draw_path(const draw_path * const path, int width,
static bool ro_plot_polygon(const int *p, unsigned int n, colour fill);
static bool ro_plot_path(const float *p, unsigned int n, colour fill, float width,
colour c, const float transform[6]);
-static bool ro_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
static bool ro_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
static bool ro_plot_text(int x, int y, const struct css_style *style,
@@ -62,7 +60,6 @@ const struct plotter_table ro_plotters = {
.rectangle = ro_plot_rectangle,
.line = ro_plot_line,
.polygon = ro_plot_polygon,
- .fill = ro_plot_fill,
.clip = ro_plot_clip,
.text = ro_plot_text,
.disc = ro_plot_disc,
@@ -81,29 +78,72 @@ bool ro_plot_patterned_lines = true;
-
-bool ro_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
+bool ro_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
- const int path[] = { draw_MOVE_TO,
- (ro_plot_origin_x + x0 * 2) * 256,
- (ro_plot_origin_y - y0 * 2 - 1) * 256,
- draw_LINE_TO,
- (ro_plot_origin_x + (x0 + width) * 2) * 256,
- (ro_plot_origin_y - y0 * 2 - 1) * 256,
- draw_LINE_TO,
- (ro_plot_origin_x + (x0 + width) * 2) * 256,
- (ro_plot_origin_y - (y0 + height) * 2 - 1) * 256,
- draw_LINE_TO,
- (ro_plot_origin_x + x0 * 2) * 256,
- (ro_plot_origin_y - (y0 + height) * 2 - 1) * 256,
- draw_CLOSE_LINE,
- (ro_plot_origin_x + x0 * 2) * 256,
- (ro_plot_origin_y - y0 * 2 - 1) * 256,
- draw_END_PATH };
+ os_error *error;
+
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+
+ error = xcolourtrans_set_gcol(style->fill_colour << 8,
+ colourtrans_USE_ECFS_GCOL,
+ os_ACTION_OVERWRITE, 0, 0);
+ if (error) {
+ LOG(("xcolourtrans_set_gcol: 0x%x: %s",
+ error->errnum, error->errmess));
+ return false;
+ }
+
+ error = xos_plot(os_MOVE_TO,
+ ro_plot_origin_x + x0 * 2,
+ ro_plot_origin_y - y0 * 2 - 1);
+ if (error) {
+ LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
+ return false;
+ }
+
+ error = xos_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
+ ro_plot_origin_x + x1 * 2 - 1,
+ ro_plot_origin_y - y1 * 2);
+ if (error) {
+ LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
+ return false;
+ }
+ }
- return ro_plot_draw_path((const draw_path *) path, line_width, c,
- dotted, dashed);
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+ bool dotted = false;
+ bool dashed = false;
+
+ const int path[] = { draw_MOVE_TO,
+ (ro_plot_origin_x + x0 * 2) * 256,
+ (ro_plot_origin_y - y0 * 2 - 1) * 256,
+ draw_LINE_TO,
+ (ro_plot_origin_x + (x1) * 2) * 256,
+ (ro_plot_origin_y - y0 * 2 - 1) * 256,
+ draw_LINE_TO,
+ (ro_plot_origin_x + (x1) * 2) * 256,
+ (ro_plot_origin_y - (y1) * 2 - 1) * 256,
+ draw_LINE_TO,
+ (ro_plot_origin_x + x0 * 2) * 256,
+ (ro_plot_origin_y - (y1) * 2 - 1) * 256,
+ draw_CLOSE_LINE,
+ (ro_plot_origin_x + x0 * 2) * 256,
+ (ro_plot_origin_y - y0 * 2 - 1) * 256,
+ draw_END_PATH };
+
+ if (style->stroke_type == PLOT_OP_TYPE_DOT)
+ dotted = true;
+
+ if (style->stroke_type == PLOT_OP_TYPE_DASH)
+ dashed = true;
+
+ ro_plot_draw_path((const draw_path *)path,
+ style->stroke_width,
+ style->stroke_colour,
+ dotted, dashed);
+ }
+
+ return true;
}
@@ -303,37 +343,6 @@ error:
}
-bool ro_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
- os_error *error;
-
- error = xcolourtrans_set_gcol(style->fill_colour << 8,
- colourtrans_USE_ECFS_GCOL,
- os_ACTION_OVERWRITE, 0, 0);
- if (error) {
- LOG(("xcolourtrans_set_gcol: 0x%x: %s",
- error->errnum, error->errmess));
- return false;
- }
-
- error = xos_plot(os_MOVE_TO,
- ro_plot_origin_x + x0 * 2,
- ro_plot_origin_y - y0 * 2 - 1);
- if (error) {
- LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
-
- error = xos_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
- ro_plot_origin_x + x1 * 2 - 1,
- ro_plot_origin_y - y1 * 2);
- if (error) {
- LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
-
- return true;
-}
bool ro_plot_clip(int clip_x0, int clip_y0,
diff --git a/riscos/print.c b/riscos/print.c
index a216bbee4..c06b235dd 100644
--- a/riscos/print.c
+++ b/riscos/print.c
@@ -97,12 +97,10 @@ static void print_send_printsave(struct content *c);
static bool print_send_printtypeknown(wimp_message *m);
static bool print_document(struct gui_window *g, const char *filename);
static const char *print_declare_fonts(struct content *content);
-static bool print_fonts_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
+static bool print_fonts_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool print_fonts_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool print_fonts_plot_polygon(const int *p, unsigned int n, colour fill);
-static bool print_fonts_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
static bool print_fonts_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
static bool print_fonts_plot_text(int x, int y, const struct css_style *style,
@@ -128,7 +126,6 @@ static const struct plotter_table print_fonts_plotters = {
.rectangle = print_fonts_plot_rectangle,
.line = print_fonts_plot_line,
.polygon = print_fonts_plot_polygon,
- .fill = print_fonts_plot_fill,
.clip = print_fonts_plot_clip,
.text = print_fonts_plot_text,
.disc = print_fonts_plot_disc,
@@ -807,12 +804,12 @@ end:
}
-bool print_fonts_plot_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
+bool print_fonts_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
return true;
}
+
bool print_fonts_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
@@ -824,10 +821,6 @@ bool print_fonts_plot_polygon(const int *p, unsigned int n, colour fill)
return true;
}
-bool print_fonts_plot_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
- return true;
-}
bool print_fonts_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1)
diff --git a/riscos/save_draw.c b/riscos/save_draw.c
index f74608cf3..4a8f8d64d 100644
--- a/riscos/save_draw.c
+++ b/riscos/save_draw.c
@@ -37,14 +37,12 @@
#include "utils/log.h"
#include "utils/utils.h"
-static bool ro_save_draw_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed);
+static bool ro_save_draw_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool ro_save_draw_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed);
static bool ro_save_draw_polygon(const int *p, unsigned int n, colour fill);
static bool ro_save_draw_path(const float *p, unsigned int n, colour fill,
float width, colour c, const float transform[6]);
-static bool ro_save_draw_fill(int x0, int y0, int x1, int y1, plot_style_t *style);
static bool ro_save_draw_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1);
static bool ro_save_draw_text(int x, int y, const struct css_style *style,
@@ -64,7 +62,6 @@ static const struct plotter_table ro_save_draw_plotters = {
.rectangle = ro_save_draw_rectangle,
.line = ro_save_draw_line,
.polygon = ro_save_draw_polygon,
- .fill = ro_save_draw_fill,
.clip = ro_save_draw_clip,
.text = ro_save_draw_text,
.disc = ro_save_draw_disc,
@@ -143,25 +140,54 @@ bool save_as_draw(struct content *c, const char *path)
return true;
}
-bool ro_save_draw_rectangle(int x0, int y0, int width, int height,
- int line_width, colour c, bool dotted, bool dashed)
+bool ro_save_draw_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
pencil_code code;
const int path[] = { draw_MOVE_TO, x0 * 2, -y0 * 2 - 1,
- draw_LINE_TO, (x0 + width) * 2, -y0 * 2 - 1,
- draw_LINE_TO, (x0 + width) * 2, -(y0 + height) * 2 - 1,
- draw_LINE_TO, x0 * 2, -(y0 + height) * 2 - 1,
- draw_CLOSE_LINE,
- draw_END_PATH };
-
- code = pencil_path(ro_save_draw_diagram, path,
- sizeof path / sizeof path[0],
- pencil_TRANSPARENT, c << 8, width, pencil_JOIN_MITRED,
- pencil_CAP_BUTT, pencil_CAP_BUTT, 0, 0, false,
- pencil_SOLID);
- if (code != pencil_OK)
- return ro_save_draw_error(code);
+ draw_LINE_TO, x1 * 2, -y0 * 2 - 1,
+ draw_LINE_TO, x1 * 2, -y1 * 2 - 1,
+ draw_LINE_TO, x0 * 2, -y1 * 2 - 1,
+ draw_CLOSE_LINE,
+ draw_END_PATH };
+
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+
+ code = pencil_path(ro_save_draw_diagram,
+ path,
+ sizeof path / sizeof path[0],
+ style->fill_colour << 8,
+ pencil_TRANSPARENT,
+ 0,
+ pencil_JOIN_MITRED,
+ pencil_CAP_BUTT,
+ pencil_CAP_BUTT,
+ 0,
+ 0,
+ false,
+ pencil_SOLID);
+ if (code != pencil_OK)
+ return ro_save_draw_error(code);
+ }
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+
+ code = pencil_path(ro_save_draw_diagram,
+ path,
+ sizeof path / sizeof path[0],
+ pencil_TRANSPARENT,
+ style->stroke_colour << 8,
+ style->stroke_width,
+ pencil_JOIN_MITRED,
+ pencil_CAP_BUTT,
+ pencil_CAP_BUTT,
+ 0,
+ 0,
+ false,
+ pencil_SOLID);
+
+ if (code != pencil_OK)
+ return ro_save_draw_error(code);
+ }
return true;
}
@@ -302,27 +328,6 @@ bool ro_save_draw_path(const float *p, unsigned int n, colour fill,
}
-bool ro_save_draw_fill(int x0, int y0, int x1, int y1, plot_style_t *style)
-{
- pencil_code code;
- const int path[] = { draw_MOVE_TO, x0 * 2, -y0 * 2 - 1,
- draw_LINE_TO, x1 * 2, -y0 * 2 - 1,
- draw_LINE_TO, x1 * 2, -y1 * 2 - 1,
- draw_LINE_TO, x0 * 2, -y1 * 2 - 1,
- draw_CLOSE_LINE,
- draw_END_PATH };
-
- code = pencil_path(ro_save_draw_diagram, path,
- sizeof path / sizeof path[0],
- style->fill_colour << 8,
- pencil_TRANSPARENT, 0, pencil_JOIN_MITRED,
- pencil_CAP_BUTT, pencil_CAP_BUTT, 0, 0, false,
- pencil_SOLID);
- if (code != pencil_OK)
- return ro_save_draw_error(code);
-
- return true;
-}
bool ro_save_draw_clip(int clip_x0, int clip_y0,
diff --git a/riscos/window.c b/riscos/window.c
index 5b73d8783..d8637661b 100644
--- a/riscos/window.c
+++ b/riscos/window.c
@@ -1483,7 +1483,7 @@ void ro_gui_window_redraw(wimp_draw *redraw)
plot.clip(clip_x0, clip_y0, clip_x1, clip_y1);
if (c->type != CONTENT_HTML)
- plot.fill(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white);
+ plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, plot_style_fill_white);
/* Redraw the clip rectangle area of the content */
content_redraw(c, 0, 0,