diff options
author | Robin Gareus <robin@gareus.org> | 2014-05-27 19:28:56 +0200 |
---|---|---|
committer | Robin Gareus <robin@gareus.org> | 2014-05-27 19:36:10 +0200 |
commit | c03b6585314d2a972cf14c2f04dfdd760e98b57f (patch) | |
tree | 905462847b54327a93c4d1db8628bc7eece3c2bc /libs/canvas/curve.cc | |
parent | d9b7c8b8648d5d67d67735decac36a290a479190 (diff) |
Curve: anti-aliasing.
use cairo for anti-aliasing, and ignore explicit Catmull-Rom
points for that fall on the same x-cordinate.
Diffstat (limited to 'libs/canvas/curve.cc')
-rw-r--r-- | libs/canvas/curve.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/libs/canvas/curve.cc b/libs/canvas/curve.cc index 7a45ca90bf..e5db740d66 100644 --- a/libs/canvas/curve.cc +++ b/libs/canvas/curve.cc @@ -383,9 +383,12 @@ Curve::render (Rect const & area, Cairo::RefPtr<Cairo::Context> context) const /* draw line between samples */ window_space = item_to_window (Duple (samples[left].x, samples[left].y)); context->move_to (window_space.x, window_space.y); + Coord last_x = round(window_space.x); for (uint32_t idx = left + 1; idx < right; ++idx) { window_space = item_to_window (Duple (samples[idx].x, samples[idx].y)); - context->line_to (window_space.x, window_space.y); + if (last_x == round(window_space.x)) continue; + last_x = round(window_space.x); + context->line_to (last_x - .5 , window_space.y); } switch (curve_fill) { |