diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-07-10 18:36:49 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-07-10 18:36:49 +0000 |
commit | 680298e61ce664e95b3f8143c0c0b814d5966f2a (patch) | |
tree | cd4bdf673143a3ff8496498927de526adfb9804e /beos/beos_plotters.cpp | |
parent | 5feb7018c5228a22d370d070c1f7c3dad2c71e25 (diff) | |
download | netsurf-680298e61ce664e95b3f8143c0c0b814d5966f2a.tar.gz netsurf-680298e61ce664e95b3f8143c0c0b814d5966f2a.tar.bz2 |
plotters line refactor
svn path=/trunk/netsurf/; revision=8446
Diffstat (limited to 'beos/beos_plotters.cpp')
-rw-r--r-- | beos/beos_plotters.cpp | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/beos/beos_plotters.cpp b/beos/beos_plotters.cpp index 36ea8b6b0..cbe447ee6 100644 --- a/beos/beos_plotters.cpp +++ b/beos/beos_plotters.cpp @@ -62,8 +62,7 @@ cairo_t *current_cr; */ 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_line(int x0, int y0, int x1, int y1, const plot_style_t *style); 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]); @@ -229,16 +228,25 @@ bool nsbeos_plot_rectangle(int x0, int y0, int x1, int y1, const plot_style_t *s -bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width, - colour c, bool dotted, bool dashed) +bool nsbeos_plot_line(int x0, int y0, int x1, int y1, const plot_style_t *style) { - pattern pat = B_SOLID_HIGH; + pattern pat; BView *view; - if (dotted) + switch (style->stroke_type) { + case PLOT_OP_TYPE_SOLID: /**< Solid colour */ + default: + pat = B_SOLID_HIGH; + break; + + case PLOT_OP_TYPE_DOT: /**< Doted plot */ pat = kDottedPattern; - else if (dashed) + break; + + case PLOT_OP_TYPE_DASH: /**< dashed plot */ pat = kDashedPattern; + break; + } view = nsbeos_current_gc/*_lock*/(); if (view == NULL) { @@ -246,10 +254,10 @@ bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width, return false; } - nsbeos_set_colour(c); + nsbeos_set_colour(style->stroke_colour); float pensize = view->PenSize(); - view->SetPenSize(width); + view->SetPenSize(style->stroke_width); BPoint start(x0, y0); BPoint end(x1, y1); @@ -271,8 +279,8 @@ bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width, cairo_stroke(current_cr); } else #endif - gdk_draw_line(current_drawable, current_gc, - x0, y0, x1, y1); + gdk_draw_line(current_drawable, current_gc, + x0, y0, x1, y1); #endif return true; } |