mirror of https://github.com/Chlumsky/msdfgen.git
Fixed edge coloring not restored if lost during preprocessing
This commit is contained in:
parent
22b3055247
commit
f1797ada88
|
|
@ -24,19 +24,12 @@ void shapeToSkiaPath(SkPath &skPath, const Shape &shape) {
|
|||
if (!contour->edges.empty()) {
|
||||
skPath.moveTo(pointToSkiaPoint(contour->edges.front()->point(0)));
|
||||
for (std::vector<EdgeHolder>::const_iterator edge = contour->edges.begin(); edge != contour->edges.end(); ++edge) {
|
||||
{
|
||||
const LinearSegment *linearSegment = dynamic_cast<const LinearSegment *>(&**edge);
|
||||
if (linearSegment)
|
||||
skPath.lineTo(pointToSkiaPoint(linearSegment->p[1]));
|
||||
} {
|
||||
const QuadraticSegment *quadraticSegment = dynamic_cast<const QuadraticSegment *>(&**edge);
|
||||
if (quadraticSegment)
|
||||
skPath.quadTo(pointToSkiaPoint(quadraticSegment->p[1]), pointToSkiaPoint(quadraticSegment->p[2]));
|
||||
} {
|
||||
const CubicSegment *cubicSegment = dynamic_cast<const CubicSegment *>(&**edge);
|
||||
if (cubicSegment)
|
||||
skPath.cubicTo(pointToSkiaPoint(cubicSegment->p[1]), pointToSkiaPoint(cubicSegment->p[2]), pointToSkiaPoint(cubicSegment->p[3]));
|
||||
}
|
||||
if (const LinearSegment *linearSegment = dynamic_cast<const LinearSegment *>(&**edge))
|
||||
skPath.lineTo(pointToSkiaPoint(linearSegment->p[1]));
|
||||
else if (const QuadraticSegment *quadraticSegment = dynamic_cast<const QuadraticSegment *>(&**edge))
|
||||
skPath.quadTo(pointToSkiaPoint(quadraticSegment->p[1]), pointToSkiaPoint(quadraticSegment->p[2]));
|
||||
else if (const CubicSegment *cubicSegment = dynamic_cast<const CubicSegment *>(&**edge))
|
||||
skPath.cubicTo(pointToSkiaPoint(cubicSegment->p[1]), pointToSkiaPoint(cubicSegment->p[2]), pointToSkiaPoint(cubicSegment->p[3]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4
main.cpp
4
main.cpp
|
|
@ -876,6 +876,10 @@ int main(int argc, const char * const *argv) {
|
|||
#ifdef MSDFGEN_USE_SKIA
|
||||
if (!resolveShapeGeometry(shape))
|
||||
puts("Shape geometry preprocessing failed, skipping.");
|
||||
else if (skipColoring) {
|
||||
skipColoring = false;
|
||||
puts("Note: Input shape coloring won't be preserved due to geometry preprocessing");
|
||||
}
|
||||
#else
|
||||
ABORT("Shape geometry preprocessing (-preprocess) is not available in this version because the Skia library is not present.");
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue