Index: src/pdf/SkPDFUtils.cpp |
diff --git a/src/pdf/SkPDFUtils.cpp b/src/pdf/SkPDFUtils.cpp |
index 0fe6fb59a9dfe6691fc7df08dace0ac42af12af2..5371a8187c1022b1845c7a3fd31c0da5c6a53172 100644 |
--- a/src/pdf/SkPDFUtils.cpp |
+++ b/src/pdf/SkPDFUtils.cpp |
@@ -122,6 +122,25 @@ void SkPDFUtils::EmitPath(const SkPath& path, SkPaint::Style paintStyle, |
// Chrome expects to be able to draw some such entities with no visible |
// result, so we detect those cases and discard the drawing for them. |
// Specifically: moveTo(X), lineTo(Y) and moveTo(X), lineTo(X), lineTo(Y). |
+ |
+ SkRect rect; |
+ bool isClosed; |
+ SkPath::Direction direction; |
+ if (path.isRect(&rect, &isClosed, &direction)) { |
+ if (isClosed && SkPath::kCW_Direction == direction) { |
bungeman-skia
2016/08/22 19:28:18
Is the check for CW really needed? What's the outp
|
+ //SkPDFUtils::AppendRectangle(rect, content); |
bungeman-skia
2016/08/22 19:28:18
Either this should be written and used or the comm
|
+ SkPDFUtils::AppendScalar(rect.left(), content); |
+ content->writeText(" "); |
+ SkPDFUtils::AppendScalar(rect.top(), content); |
+ content->writeText(" "); |
+ SkPDFUtils::AppendScalar(rect.width(), content); |
+ content->writeText(" "); |
+ SkPDFUtils::AppendScalar(rect.height(), content); |
+ content->writeText(" re\n"); |
+ return; |
+ } |
+ } |
+ |
enum SkipFillState { |
kEmpty_SkipFillState, |
kSingleLine_SkipFillState, |