diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-07-14 10:03:58 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-07-14 10:03:58 +0000 |
commit | 86232d72a6709243136496770aade7c4d47ef28a (patch) | |
tree | e6c849cb2f755a6ef314ccdb5a05122bec7dcd52 /amiga | |
parent | ed2206316ceb8fe422085a4a50c028aa7718d644 (diff) | |
download | netsurf-86232d72a6709243136496770aade7c4d47ef28a.tar.gz netsurf-86232d72a6709243136496770aade7c4d47ef28a.tar.bz2 |
next round of plotter refactor
svn path=/trunk/netsurf/; revision=8512
Diffstat (limited to 'amiga')
-rwxr-xr-x | amiga/plotters.c | 72 | ||||
-rwxr-xr-x | amiga/plotters.h | 6 |
2 files changed, 48 insertions, 30 deletions
diff --git a/amiga/plotters.c b/amiga/plotters.c index 8f7e525cc..f7a4dff5e 100755 --- a/amiga/plotters.c +++ b/amiga/plotters.c @@ -321,7 +321,7 @@ bool ami_line(int x0, int y0, int x1, int y1, const plot_style_t *style) return true; } -bool ami_polygon(const int *p, unsigned int n, colour fill) +bool ami_polygon(const int *p, unsigned int n, const plot_style_t *style) { int k; #ifndef NS_AMIGA_CAIRO @@ -329,10 +329,13 @@ bool ami_polygon(const int *p, unsigned int n, colour fill) //DebugPrintF("poly\n"); - SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill), - RPTAG_OPenColor,p96EncodeColor(RGBFB_A8B8G8R8,fill), + SetRPAttrs(&glob->rp, + RPTAG_APenColor, + p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour), + RPTAG_OPenColor, + p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour), // RPTAG_OPenColor,0xffffffff, - TAG_DONE); + TAG_DONE); AreaMove(&glob->rp,p[0],p[1]); @@ -344,7 +347,7 @@ bool ami_polygon(const int *p, unsigned int n, colour fill) AreaEnd(&glob->rp); BNDRYOFF(&glob->rp); #else - ami_cairo_set_colour(glob->cr,fill); + ami_cairo_set_colour(glob->cr, style->fill_colour); ami_cairo_set_solid(glob->cr); cairo_set_line_width(glob->cr, 0); @@ -404,45 +407,58 @@ bool ami_text(int x, int y, const struct css_style *style, return true; } -bool ami_disc(int x, int y, int radius, colour c, bool filled) +bool ami_disc(int x, int y, int radius, const plot_style_t *style) { #ifndef NS_AMIGA_CAIRO_ALL - SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c), - TAG_DONE); - - if(filled) - { + if (style->fill_type != PLOT_OP_TYPE_NONE) { + SetRPAttrs(&glob->rp, + RPTAG_APenColor, + p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour), + TAG_DONE); AreaCircle(&glob->rp,x,y,radius); AreaEnd(&glob->rp); } - else - { - DrawEllipse(&glob->rp,x,y,radius,radius); // NB: does not support fill, need to use AreaCircle for that + + if (style->stroke_type != PLOT_OP_TYPE_NONE) { + SetRPAttrs(&glob->rp, + RPTAG_APenColor, + p96EncodeColor(RGBFB_A8B8G8R8, style->stroke_colour), + TAG_DONE); + + DrawEllipse(&glob->rp,x,y,radius,radius); } #else - ami_cairo_set_colour(glob->cr,c); - ami_cairo_set_solid(glob->cr); + if (style->fill_type != PLOT_OP_TYPE_NONE) { + ami_cairo_set_colour(glob->cr, style->fill_colour); + ami_cairo_set_solid(glob->cr); - if (filled) cairo_set_line_width(glob->cr, 0); - else - cairo_set_line_width(glob->cr, 1); - cairo_arc(glob->cr, x, y, radius, 0, M_PI * 2); + cairo_arc(glob->cr, x, y, radius, 0, M_PI * 2); - if (filled) cairo_fill(glob->cr); - cairo_stroke(glob->cr); + cairo_stroke(glob->cr); + } + + if (style->stroke_type != PLOT_OP_TYPE_NONE) { + ami_cairo_set_colour(glob->cr, style->stroke_colour); + ami_cairo_set_solid(glob->cr); + + cairo_set_line_width(glob->cr, 1); + + cairo_arc(glob->cr, x, y, radius, 0, M_PI * 2); + + cairo_stroke(glob->cr); + } #endif return true; } -bool ami_arc(int x, int y, int radius, int angle1, int angle2, - colour c) +bool ami_arc(int x, int y, int radius, int angle1, int angle2, const plot_style_t *style) { #ifdef NS_AMIGA_CAIRO - ami_cairo_set_colour(glob->cr,c); + ami_cairo_set_colour(glob->cr, style->fill_colour); ami_cairo_set_solid(glob->cr); cairo_set_line_width(glob->cr, 1); @@ -455,8 +471,10 @@ bool ami_arc(int x, int y, int radius, int angle1, int angle2, CommonFuncsPPC.lha */ //DebugPrintF("arc\n"); - SetRPAttrs(&glob->rp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c), - TAG_DONE); + SetRPAttrs(&glob->rp, + RPTAG_APenColor, + p96EncodeColor(RGBFB_A8B8G8R8, style->fill_colour), + TAG_DONE); // DrawArc(&glob->rp,x,y,(float)angle1,(float)angle2,radius); #endif diff --git a/amiga/plotters.h b/amiga/plotters.h index 37c892f62..ce5008d86 100755 --- a/amiga/plotters.h +++ b/amiga/plotters.h @@ -44,13 +44,13 @@ extern const struct plotter_table amiplot; bool ami_clg(colour c); 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, const plot_style_t *style); -bool ami_polygon(const int *p, unsigned int n, colour fill); +bool ami_polygon(const int *p, unsigned int n, const 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); -bool ami_disc(int x, int y, int radius, colour c, bool filled); +bool ami_disc(int x, int y, int radius, const plot_style_t *style); bool ami_arc(int x, int y, int radius, int angle1, int angle2, - colour c); + const plot_style_t *style); bool ami_bitmap_tile(int x, int y, int width, int height, struct bitmap *bitmap, colour bg, bitmap_flags_t flags); |