Paste P216

Masterwork From Distant Lands
ActivePublic

Authored by dkazakov on May 12 2018, 7:49 AM.
diff --git a/libs/ui/flake/kis_shape_layer.cc b/libs/ui/flake/kis_shape_layer.cc
index c2d6980..1d8bdae 100644
--- a/libs/ui/flake/kis_shape_layer.cc
+++ b/libs/ui/flake/kis_shape_layer.cc
@@ -490,7 +490,34 @@ bool KisShapeLayer::saveShapesToStore(KoStore *store, QList<KoShape *> shapes, c
KoStoreDevice storeDev(store);
storeDev.open(QIODevice::WriteOnly);
- std::sort(shapes.begin(), shapes.end(), KoShape::compareShapeZIndex);
+ ENTER_FUNCTION() << "==============================";
+
+ {
+
+ std::vector<KoShape*> vector = shapes.toVector().toStdVector();
+ shapes.clear();
+
+ for (auto it = vector.begin(); it != vector.end(); ++it) {
+ ENTER_FUNCTION() << ppVar(*it) << ppVar((*it)->shapeId()) << ppVar((*it)->parent());
+ }
+
+ auto it = vector.begin();
+ auto prevIt = it;
+ it++;
+ for (; it != vector.end(); ++it) {
+ const bool aLessB = KoShape::compareShapeZIndex(*prevIt, *it);
+ const bool bLessA = KoShape::compareShapeZIndex(*it, *prevIt);
+
+ KIS_SAFE_ASSERT_RECOVER_NOOP(aLessB || (!aLessB && !bLessA));
+
+ it++;
+ prevIt++;
+ }
+
+ std::sort(vector.begin(), vector.end(), KoShape::compareShapeZIndex);
+
+ shapes = QList<KoShape*>::fromVector(QVector<KoShape*>::fromStdVector(vector));
+ }
SvgWriter writer(shapes);
writer.save(storeDev, sizeInPt);
dkazakov edited the content of this paste. (Show Details)May 12 2018, 7:49 AM
dkazakov changed the title of this paste from untitled to Masterwork From Distant Lands.
dkazakov updated the paste's language from autodetect to autodetect.