fix gradient pattern origin translation for time axis view items
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 26 Jun 2013 00:41:24 +0000 (20:41 -0400)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 26 Jun 2013 00:41:24 +0000 (20:41 -0400)
note: the solution is non-obvious, but the obvious one of applying a translational Cairo::Matrix to the gradient
caused an exception to be thrown because of a non-invertible matrix.

libs/canvas/fill.cc

index 9947415cf9462f433750dac108cbe9b84bb8c91e..e33c5d2bc063cf5cf990610fd4beb2d7222f4780 100644 (file)
@@ -60,7 +60,14 @@ void
 Fill::setup_fill_context (Cairo::RefPtr<Cairo::Context> context) const
 {
        if (_gradient) {
+               Cairo::Matrix m;
+
+               Duple origin = item_to_window (Duple (0, 0));
+
+               context->translate (origin.x, origin.y);
                context->set_source (_gradient);
+               context->translate (-origin.x, -origin.y);
+
        } else {
                set_source_rgba (context, _fill_color);
        }