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年06月30日 23:43:40 +0200
committerunknown <Maria@abbate-95206d9a.(none)>2012年07月03日 16:14:56 +0200
commitff82ea90e8046da871fd3885588e1b0538257a9b (patch)
tree1cb280dedcf609042e9e0af7dec9160c1733abc8 /agg-plot/canvas.h
parent71d027c178756db13d44ae52ddd13bb010d4151d (diff)
downloadgsl-shell-ff82ea90e8046da871fd3885588e1b0538257a9b.tar.gz
Add a generic mechanism to enable subpixel rendering for sg_objects
Diffstat (limited to 'agg-plot/canvas.h')
-rw-r--r--agg-plot/canvas.h 19
1 files changed, 16 insertions, 3 deletions
diff --git a/agg-plot/canvas.h b/agg-plot/canvas.h
index 2f0eedf2..27fe7725 100644
--- a/agg-plot/canvas.h
+++ b/agg-plot/canvas.h
@@ -18,12 +18,18 @@
template <class Pixel>
class canvas_gen : private Pixel {
+
+ enum { subpixel_scale = 3 };
+
typedef agg::renderer_base<typename Pixel::fmt> renderer_base;
typedef agg::renderer_scanline_aa_solid<renderer_base> renderer_solid;
renderer_base rb;
renderer_solid rs;
+ agg::renderer_base<typename Pixel::lcd_fmt> rb_subpixel;
+ agg::renderer_scanline_aa_solid<agg::renderer_base<typename Pixel::lcd_fmt> > rs_subpixel;
+
agg::rasterizer_scanline_aa<> ras;
agg::scanline_u8 sl;
@@ -36,6 +42,7 @@ public:
canvas_gen(agg::rendering_buffer& ren_buf, double width, double height,
agg::rgba bgcol):
Pixel(ren_buf), rb(Pixel::pixfmt), rs(rb),
+ rb_subpixel(Pixel::pixfmt_lcd), rs_subpixel(rb_subpixel),
ras(), sl(), bg_color(bgcol),
m_width(width), m_height(height)
{
@@ -61,9 +68,15 @@ public:
void draw(sg_object& vs, agg::rgba8 c)
{
- bool direct_render = vs.render(this->pixfmt_lcd, this->ras, this->sl, c);
-
- if (!direct_render)
+ 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);
+ }
+ else
{
this->ras.add_path(vs);
this->rs.color(c);
generated by cgit v1.2.3 (git 2.25.1) at 2025年09月17日 09:19:32 +0000

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