summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorVincent Sanders <vince@netsurf-browser.org>2009-07-14 10:03:58 +0000
committerVincent Sanders <vince@netsurf-browser.org>2009-07-14 10:03:58 +0000
commit86232d72a6709243136496770aade7c4d47ef28a (patch)
treee6c849cb2f755a6ef314ccdb5a05122bec7dcd52 /riscos
parented2206316ceb8fe422085a4a50c028aa7718d644 (diff)
downloadnetsurf-86232d72a6709243136496770aade7c4d47ef28a.tar.gz
netsurf-86232d72a6709243136496770aade7c4d47ef28a.tar.bz2
next round of plotter refactor
svn path=/trunk/netsurf/; revision=8512
Diffstat (limited to 'riscos')
-rw-r--r--riscos/plotters.c84
-rw-r--r--riscos/print.c15
-rw-r--r--riscos/save_draw.c29
3 files changed, 76 insertions, 52 deletions
diff --git a/riscos/plotters.c b/riscos/plotters.c
index ec55e81d6..23ea2783f 100644
--- a/riscos/plotters.c
+++ b/riscos/plotters.c
@@ -38,16 +38,16 @@ static bool ro_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t
static bool ro_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style);
static bool ro_plot_draw_path(const draw_path * const path, int width,
colour c, bool dotted, bool dashed);
-static bool ro_plot_polygon(const int *p, unsigned int n, colour fill);
+static bool ro_plot_polygon(const int *p, unsigned int n, const plot_style_t *style);
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_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,
const char *text, size_t length, colour bg, colour c);
-static bool ro_plot_disc(int x, int y, int radius, colour colour, bool filled);
+static bool ro_plot_disc(int x, int y, int radius, const plot_style_t *style);
static bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2,
- colour c);
+ const plot_style_t *style);
static bool ro_plot_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags);
@@ -216,7 +216,7 @@ bool ro_plot_draw_path(const draw_path * const path, int width,
}
-bool ro_plot_polygon(const int *p, unsigned int n, colour fill)
+bool ro_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
{
int path[n * 3 + 2];
unsigned int i;
@@ -231,7 +231,7 @@ bool ro_plot_polygon(const int *p, unsigned int n, colour fill)
path[n * 3] = draw_END_PATH;
path[n * 3 + 1] = 0;
- error = xcolourtrans_set_gcol(fill << 8, 0, os_ACTION_OVERWRITE, 0, 0);
+ error = xcolourtrans_set_gcol(style->fill_colour << 8, 0, os_ACTION_OVERWRITE, 0, 0);
if (error) {
LOG(("xcolourtrans_set_gcol: 0x%x: %s",
error->errnum, error->errmess));
@@ -414,39 +414,59 @@ bool ro_plot_text(int x, int y, const struct css_style *style,
}
-bool ro_plot_disc(int x, int y, int radius, colour colour, bool filled)
+bool ro_plot_disc(int x, int y, int radius, const plot_style_t *style)
{
os_error *error;
-
- error = xcolourtrans_set_gcol(colour << 8, 0,
- 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 + x * 2,
- ro_plot_origin_y - y * 2);
- if (error) {
- LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
- if (filled) {
- error = xos_plot(os_PLOT_CIRCLE | os_PLOT_BY, radius * 2, 0);
- } else {
- error = xos_plot(os_PLOT_CIRCLE_OUTLINE | os_PLOT_BY,
- radius * 2, 0);
+ if (style->fill_type != PLOT_OP_TYPE_NONE) {
+ error = xcolourtrans_set_gcol(style->fill_colour << 8, 0,
+ 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 + x * 2,
+ ro_plot_origin_y - y * 2);
+ if (error) {
+ LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
+ return false;
+ }
+ error = xos_plot(os_PLOT_CIRCLE | os_PLOT_BY, radius * 2, 0);
+ if (error) {
+ LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
+ return false;
+ }
}
- if (error) {
- LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
+ if (style->stroke_type != PLOT_OP_TYPE_NONE) {
+
+ error = xcolourtrans_set_gcol(style->stroke_colour << 8, 0,
+ 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 + x * 2,
+ ro_plot_origin_y - y * 2);
+ if (error) {
+ LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
+ return false;
+ }
+ error = xos_plot(os_PLOT_CIRCLE_OUTLINE | os_PLOT_BY,
+ radius * 2, 0);
+
+ if (error) {
+ LOG(("xos_plot: 0x%x: %s", error->errnum, error->errmess));
+ return false;
+ }
+ }
return true;
}
-bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c)
+bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style)
{
os_error *error;
int sx, sy, ex, ey;
@@ -456,7 +476,7 @@ bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c)
y = ro_plot_origin_y - y * 2;
radius <<= 1;
- error = xcolourtrans_set_gcol(c << 8, 0,
+ error = xcolourtrans_set_gcol(style->fill_colour << 8, 0,
os_ACTION_OVERWRITE, 0, 0);
if (error) {
diff --git a/riscos/print.c b/riscos/print.c
index 4cbe97506..108fe2d7c 100644
--- a/riscos/print.c
+++ b/riscos/print.c
@@ -99,15 +99,13 @@ 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 x1, int y1, const plot_style_t *style);
static bool print_fonts_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style);
-static bool print_fonts_plot_polygon(const int *p, unsigned int n, colour fill);
+static bool print_fonts_plot_polygon(const int *p, unsigned int n, const 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,
const char *text, size_t length, colour bg, colour c);
-static bool print_fonts_plot_disc(int x, int y, int radius, colour c,
- bool filled);
-static bool print_fonts_plot_arc(int x, int y, int radius, int angle1, int angle2,
- colour c);
+static bool print_fonts_plot_disc(int x, int y, int radius, const plot_style_t *style);
+static bool print_fonts_plot_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style);
static bool print_fonts_plot_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags);
@@ -814,7 +812,7 @@ bool print_fonts_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *s
return true;
}
-bool print_fonts_plot_polygon(const int *p, unsigned int n, colour fill)
+bool print_fonts_plot_polygon(const int *p, unsigned int n, const plot_style_t *style)
{
return true;
}
@@ -826,14 +824,13 @@ bool print_fonts_plot_clip(int clip_x0, int clip_y0,
return true;
}
-bool print_fonts_plot_disc(int x, int y, int radius, colour colour,
- bool filled)
+bool print_fonts_plot_disc(int x, int y, int radius, const plot_style_t *style)
{
return true;
}
bool print_fonts_plot_arc(int x, int y, int radius, int angle1, int angle2,
- colour c)
+ const plot_style_t *style)
{
return true;
}
diff --git a/riscos/save_draw.c b/riscos/save_draw.c
index da3e59799..d832d199d 100644
--- a/riscos/save_draw.c
+++ b/riscos/save_draw.c
@@ -39,17 +39,16 @@
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, const plot_style_t *style);
-static bool ro_save_draw_polygon(const int *p, unsigned int n, colour fill);
+static bool ro_save_draw_polygon(const int *p, unsigned int n, const plot_style_t *style);
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_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,
const char *text, size_t length, colour bg, colour c);
-static bool ro_save_draw_disc(int x, int y, int radius, colour colour,
- bool filled);
+static bool ro_save_draw_disc(int x, int y, int radius, const plot_style_t *style);
static bool ro_save_draw_arc(int x, int y, int radius, int angle1, int angle2,
- colour c);
+ const plot_style_t *style);
static bool ro_save_draw_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg, bitmap_flags_t flags);
static bool ro_save_draw_group_start(const char *name);
@@ -216,7 +215,7 @@ bool ro_save_draw_line(int x0, int y0, int x1, int y1, const plot_style_t *style
}
-bool ro_save_draw_polygon(const int *p, unsigned int n, colour fill)
+bool ro_save_draw_polygon(const int *p, unsigned int n, const plot_style_t *style)
{
pencil_code code;
int path[n * 3 + 1];
@@ -230,10 +229,18 @@ bool ro_save_draw_polygon(const int *p, unsigned int n, colour fill)
path[0] = draw_MOVE_TO;
path[n * 3] = draw_END_PATH;
- code = pencil_path(ro_save_draw_diagram, path, n * 3 + 1,
- fill << 8, pencil_TRANSPARENT, 0, pencil_JOIN_MITRED,
- pencil_CAP_BUTT, pencil_CAP_BUTT, 0, 0, false,
- pencil_SOLID);
+ code = pencil_path(ro_save_draw_diagram,
+ path, n * 3 + 1,
+ 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);
@@ -360,13 +367,13 @@ bool ro_save_draw_text(int x, int y, const struct css_style *style,
}
-bool ro_save_draw_disc(int x, int y, int radius, colour colour, bool filled)
+bool ro_save_draw_disc(int x, int y, int radius, const plot_style_t *style)
{
return true;
}
bool ro_save_draw_arc(int x, int y, int radius, int angle1, int angle2,
- colour c)
+ const plot_style_t *style)
{
return true;
}