Commit 8db457ad authored by Johannes Simon's avatar Johannes Simon

Fix transformation retrieval of child shapes of a KoShapeContainer. Before,...

Fix transformation retrieval of child shapes of a KoShapeContainer. Before, the transformation did not include the parent's offset, which caused the selection decoration to be painted incorrectly.

svn path=/trunk/koffice/; revision=1066252
parent d55d261b
......@@ -345,9 +345,11 @@ QMatrix KoShape::absoluteTransformation(const KoViewConverter *converter) const
// apply parents matrix to inherit any transformations done there.
KoShapeContainer * container = d->parent;
if (container) {
if (container->childClipped(this))
matrix = container->absoluteTransformation(0);
else {
if (container->childClipped(this)) {
// We do need to pass the converter here, otherwise the parent's
// translation is not inherited.
matrix = container->absoluteTransformation(converter);
} else {
QSizeF containerSize = container->size();
QPointF containerPos = container->absolutePosition() - QPointF(0.5 * containerSize.width(), 0.5 * containerSize.height());
if (converter)
......
......@@ -131,7 +131,11 @@ void KoShapeContainer::paint(QPainter &painter, const KoViewConverter &converter
QList<KoShape*> sortedObjects = d->children->childShapes();
qSort(sortedObjects.begin(), sortedObjects.end(), KoShape::compareShapeZIndex);
QMatrix baseMatrix = absoluteTransformation(0).inverted() * painter.matrix();
// Do the following to revert the absolute transformation of the container
// that is re-applied in shape->absoluteTransformation() later on. The transformation matrix
// of the container has already been applied once before this function is called.
// FIXME: How much performance does it cost us to (unnecessarily) apply a matrix and its inverse?
QMatrix baseMatrix = absoluteTransformation(&converter).inverted() * painter.matrix();
// clip the children to the parent outline.
QMatrix m;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment