Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

PSD Vector: Fix saving straight lines, fix loading multiple paths.

Wolthera van Hövell tot Westerflier33d65b62dbe6
diff --git a/libs/psd/psd_additional_layer_info_block.cpp b/libs/psd/psd_additional_layer_info_block.cpp
index 98dd5d123b..3c828c0e08 100644
--- a/libs/psd/psd_additional_layer_info_block.cpp
+++ b/libs/psd/psd_additional_layer_info_block.cpp
@@ -277,6 +277,7 @@ void PsdAdditionalLayerInfoBlock::readImpl(QIODevice &io)
currentPath = psd_path_sub_path();
currentPath.isClosed = (recordType == 0);
}
+ firstPath = false;
io.skip(22);
} else if (recordType == 8) {
quint16 length;
diff --git a/libs/psd/psd_layer_record.cpp b/libs/psd/psd_layer_record.cpp
index e1032b0abb..b73f50cc17 100644
--- a/libs/psd/psd_layer_record.cpp
+++ b/libs/psd/psd_layer_record.cpp
@@ -30,6 +30,7 @@
#include <KoColorSpaceTraits.h>
#include <KoPathShape.h>
+#include <KoPathSegment.h>
#include <KoPathPoint.h>
#include <asl/kis_asl_reader_utils.h>
@@ -974,6 +975,7 @@ KoPathShape *PSDLayerRecord::constructPathShape(psd_path path, double shapeWidth
}
shape->closeMerge();
}
+
}
if (shape->pointCount() > 0) {
shape->loadNodeTypes(nodeTypes);
@@ -987,15 +989,17 @@ void PSDLayerRecord::addPathShapeToPSDPath(psd_path &path, KoPathShape *shape, d
QTransform tf = QTransform::fromScale(shapeWidth, shapeHeight).inverted();
tf = shape->absoluteTransformation()*tf;
+
for (int i = 0; i < shape->subpathCount(); i++) {
psd_path_sub_path subPath;
subPath.isClosed = shape->isClosedSubpath(i);
while(subPath.nodes.size() < shape->subpathPointCount(i)) {
- KoPathPoint *point = shape->pointByIndex(KoPathPointIndex(i, subPath.nodes.size()));
+ const KoPathPoint *point = shape->pointByIndex(KoPathPointIndex(i, subPath.nodes.size()));
psd_path_node node;
- node.control1 = tf.map(point->controlPoint1());
- node.control2 = tf.map(point->controlPoint2());
node.node = tf.map(point->point());
+ node.control1 = point->activeControlPoint1()? tf.map(point->controlPoint1()): node.node;
+ node.control2 = point->activeControlPoint2()? tf.map(point->controlPoint2()): node.node;
+
node.isSmooth = (point->properties().testFlag(KoPathPoint::IsSmooth)
|| point->properties().testFlag(KoPathPoint::IsSymmetric));
subPath.nodes.append(node);