Fixed path write issue
This commit is contained in:
parent
8e4732c1e0
commit
ca71dbd9d3
2 changed files with 6 additions and 6 deletions
|
|
@ -58,15 +58,17 @@ template <typename Archive> void skpath_write(const SkPath& p, Archive& a) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a(contourSizes);
|
a(p.getFillType() == SkPathFillType::kEvenOdd, contourSizes);
|
||||||
for(const SkPoint& p : points)
|
for(const SkPoint& p : points)
|
||||||
a(p);
|
a(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Archive> SkPath skpath_read(Archive& a) {
|
template <typename Archive> SkPath skpath_read(Archive& a) {
|
||||||
|
bool isEvenOdd;
|
||||||
SkPathBuilder builder;
|
SkPathBuilder builder;
|
||||||
std::vector<uint32_t> contourSizes;
|
std::vector<uint32_t> contourSizes;
|
||||||
a(contourSizes);
|
a(isEvenOdd, contourSizes);
|
||||||
|
builder.setFillType(isEvenOdd ? SkPathFillType::kEvenOdd : SkPathFillType::kWinding);
|
||||||
for(uint32_t contourSize : contourSizes) {
|
for(uint32_t contourSize : contourSizes) {
|
||||||
SkPoint p;
|
SkPoint p;
|
||||||
if(contourSize == 0)
|
if(contourSize == 0)
|
||||||
|
|
@ -289,7 +291,7 @@ std::vector<CanvasComponentContainer*> MeshCanvasComponent::attempt_split(Drawin
|
||||||
|
|
||||||
clipper.AddSubject(clippingSubjects);
|
clipper.AddSubject(clippingSubjects);
|
||||||
clipper.AddClip(clippingSubjects);
|
clipper.AddClip(clippingSubjects);
|
||||||
clipper.Execute(ClipType::Union, FillRule::EvenOdd, solutionTree);
|
clipper.Execute(ClipType::Union, d.meshPath.getFillType() == SkPathFillType::kEvenOdd ? FillRule::EvenOdd : FillRule::NonZero, solutionTree);
|
||||||
|
|
||||||
std::vector<SkPath> splitPaths;
|
std::vector<SkPath> splitPaths;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,9 +84,7 @@ void BrushTool::commit_data(bool final) {
|
||||||
MeshCanvasComponent& newMesh = static_cast<MeshCanvasComponent&>(containerPtr->get_comp());
|
MeshCanvasComponent& newMesh = static_cast<MeshCanvasComponent&>(containerPtr->get_comp());
|
||||||
newMesh.d.meshPath = BrushComponentCode::brush_stroke_to_skpath(genData.brushPoints, drawP.world.main.toolConfig.brush.hasRoundCaps);
|
newMesh.d.meshPath = BrushComponentCode::brush_stroke_to_skpath(genData.brushPoints, drawP.world.main.toolConfig.brush.hasRoundCaps);
|
||||||
if(final) {
|
if(final) {
|
||||||
std::optional<SkPath> simplified = Simplify(newMesh.d.meshPath);
|
containerPtr->get_comp().simplify_paths();
|
||||||
if(simplified.has_value())
|
|
||||||
newMesh.d.meshPath = simplified.value();
|
|
||||||
containerPtr->normalize_object_coordinates();
|
containerPtr->normalize_object_coordinates();
|
||||||
}
|
}
|
||||||
containerPtr->commit_update(drawP);
|
containerPtr->commit_update(drawP);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue