pdf: report NYI features, and fail gracefully when something is not supported in pdf.
R=vandebo@chromium.org
Review URL: https://codereview.chromium.org/23654036
git-svn-id: http://skia.googlecode.com/svn/trunk/src@11388 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/pdf/SkPDFDevice.cpp b/pdf/SkPDFDevice.cpp
index bd26311..e80984e 100644
--- a/pdf/SkPDFDevice.cpp
+++ b/pdf/SkPDFDevice.cpp
@@ -632,6 +632,16 @@
void init(const SkClipStack* clipStack, const SkRegion& clipRegion,
const SkMatrix& matrix, const SkPaint& paint, bool hasText) {
fDstFormXObject = NULL;
+ if (matrix.hasPerspective() ||
+ (paint.getShader() &&
+ paint.getShader()->getLocalMatrix().hasPerspective())) {
+ // Just report that PDF does not supports perspective
+ // TODO(edisonn): update the shape when possible
+ // or dump in an image otherwise
+ NOT_IMPLEMENTED(true, false);
+ return;
+ }
+
if (paint.getXfermode()) {
paint.getXfermode()->asMode(&fXfermode);
}
@@ -679,6 +689,11 @@
fLastMarginContentEntry(NULL),
fClipStack(NULL),
fEncoder(NULL) {
+ // just report that PDF does not supports perspective
+ // TODO(edisonn): update the shape when possible
+ // or dump in an image otherwise
+ NOT_IMPLEMENTED(initialTransform.hasPerspective(), true);
+
// Skia generally uses the top left as the origin but PDF natively has the
// origin at the bottom left. This matrix corrects for that. But that only
// needs to be done once, we don't do it when layering.
@@ -915,6 +930,7 @@
origPath.transform(*prePathMatrix, pathPtr);
} else {
if (!matrix.preConcat(*prePathMatrix)) {
+ // TODO(edisonn): report somehow why we failed?
return;
}
}