SkPDF: when drawing stroked path, draw using SVG rules for zero-length segments
The "zeroPath" and emptystroke GMs capture this issue.
This CL changes the following PDF GMs: emptystroke dashing4
lineclosepath dashing3 zeroPath linepath
complexclip3_complex complexclip3_simple roundrects
degeneratesegments filltypes strokerect pathfill
inverse_paths desk_chalkboard.skp
After this change, all PDF GMs look better (closer to 8888).
The dashing4, emptystroke, and zeroPath GMs still need a lot
of work to make them look right.
BUG=538726
Review URL: https://codereview.chromium.org/1374383004
diff --git a/src/pdf/SkPDFDevice.cpp b/src/pdf/SkPDFDevice.cpp
index b6500c1..9134d80 100644
--- a/src/pdf/SkPDFDevice.cpp
+++ b/src/pdf/SkPDFDevice.cpp
@@ -1035,7 +1035,12 @@
if (!content.entry()) {
return;
}
+ bool consumeDegeratePathSegments =
+ paint.getStyle() == SkPaint::kFill_Style ||
+ (paint.getStrokeCap() != SkPaint::kRound_Cap &&
+ paint.getStrokeCap() != SkPaint::kSquare_Cap);
SkPDFUtils::EmitPath(*pathPtr, paint.getStyle(),
+ consumeDegeratePathSegments,
&content.entry()->fContent);
SkPDFUtils::PaintPath(paint.getStyle(), pathPtr->getFillType(),
&content.entry()->fContent);