Curve: anti-aliasing.
authorRobin Gareus <robin@gareus.org>
Tue, 27 May 2014 17:28:56 +0000 (19:28 +0200)
committerRobin Gareus <robin@gareus.org>
Tue, 27 May 2014 17:36:10 +0000 (19:36 +0200)
use cairo for anti-aliasing, and ignore explicit Catmull-Rom
points for that fall on the same x-cordinate.

libs/canvas/curve.cc

index 7a45ca90bfc2ceccd54240d4908c58ea24eaacd4..e5db740d66b371898c05f092d7b97f3b1b2f96d8 100644 (file)
@@ -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) {