Comment 7 for bug 953992

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

I've been able to pin-point the bug, now we only need a solution ;-)

The imported pattern has a view box, whereas the stock pattern hasn't. As soon as the object with the pattern is moved, an extra pattern is inserted into the chain of references, in order to handle the transformation. So far so good. In sp-pattern though, the viewbox is being calculated, and this breaks as soon as the extra pattern is added. The relevant code is in sp-pattern.cpp

// viewBox to pattern server
    Geom::Affine vb2ps = Geom::identity();
    if (pat->viewBox_set) {
        Geom::Rect vb = *pattern_viewBox(pat);
        gdouble tmp_x = pattern_width (pat) / vb.width();
        gdouble tmp_y = pattern_height (pat) / vb.height();

        // FIXME: preserveAspectRatio must be taken into account here too!
        vb2ps = Geom::Affine(tmp_x, 0.0, 0.0, tmp_y, pattern_x(pat) - vb.left() * tmp_x, pattern_y(pat) - vb.top() * tmp_y);
    }

When I force the vb2ps variable to keep it's initial value, i.e. the value before the transformation of the object, then the pattern remains visible, even after translating the object. When I allow the code above to execute normally though, the pattern disappears after the transformation!