gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/canvas.h
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年07月03日 23:12:30 +0200
committerunknown <Maria@abbate-95206d9a.(none)>2012年07月03日 23:12:30 +0200
commit639c8880bab5c8ea792c773c5aa11216802411a6 (patch)
tree4e2c4bb65e8d209fefe724e51a07353a59cc1e3d /agg-plot/canvas.h
parent54816985901c2bfc286a33cd549c3aa20cd556bd (diff)
downloadgsl-shell-639c8880bab5c8ea792c773c5aa11216802411a6.tar.gz
Canvas code rationalization to support subpixel rendering
Diffstat (limited to 'agg-plot/canvas.h')
-rw-r--r--agg-plot/canvas.h 43
1 files changed, 26 insertions, 17 deletions
diff --git a/agg-plot/canvas.h b/agg-plot/canvas.h
index 27fe7725..6b780e7d 100644
--- a/agg-plot/canvas.h
+++ b/agg-plot/canvas.h
@@ -66,23 +66,31 @@ public:
void reset_clipping() { this->rb.reset_clipping(true); };
+ template <class VertexSource>
+ void draw_solid(VertexSource& vs, agg::rgba8 c)
+ {
+ this->ras.add_path(vs);
+ this->rs.color(c);
+ agg::render_scanlines(this->ras, this->sl, this->rs);
+ }
+
+ template <class VertexSource>
+ void draw_solid_subpixel(VertexSource& vs, agg::rgba8 c)
+ {
+ agg::trans_affine_scaling subpixel_mtx(double(subpixel_scale), 1.0);
+ agg::conv_transform<VertexSource> trans(vs, subpixel_mtx);
+ this->ras.add_path(trans);
+ this->rs_subpixel.color(c);
+ agg::render_scanlines(this->ras, this->sl, this->rs_subpixel);
+ }
+
void draw(sg_object& vs, agg::rgba8 c)
{
if (vs.use_subpixel())
- {
- agg::trans_affine_scaling subpixel_mtx(double(subpixel_scale), 1.0);
- agg::conv_transform<sg_object> trans(vs, subpixel_mtx);
- this->ras.add_path(trans);
- this->rs_subpixel.color(c);
- agg::render_scanlines(this->ras, this->sl, this->rs_subpixel);
- }
+ draw_solid_subpixel(vs, c);
else
- {
- this->ras.add_path(vs);
- this->rs.color(c);
- agg::render_scanlines(this->ras, this->sl, this->rs);
- }
- };
+ draw_solid(vs, c);
+ }
void draw_outline(sg_object& vs, agg::rgba8 c)
{
@@ -90,10 +98,11 @@ public:
line.width(Pixel::line_width / 100.0);
line.line_cap(agg::round_cap);
- this->ras.add_path(line);
- this->rs.color(c);
- agg::render_scanlines(this->ras, this->sl, this->rs);
- };
+ if (vs.use_subpixel())
+ draw_solid_subpixel(line, c);
+ else
+ draw_solid(line, c);
+ }
};
struct virtual_canvas {
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月17日 04:37:44 +0000

AltStyle によって変換されたページ (->オリジナル) /