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@11388 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
edisonn@google.com 2013-09-19 17:36:47 +00:00
parent 962c8864e4
commit aa6c4d2587

View File

@ -632,6 +632,16 @@ private:
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 @@ SkPDFDevice::SkPDFDevice(const SkISize& pageSize, const SkISize& contentSize,
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 @@ void SkPDFDevice::drawPath(const SkDraw& d, const SkPath& origPath,
origPath.transform(*prePathMatrix, pathPtr);
} else {
if (!matrix.preConcat(*prePathMatrix)) {
// TODO(edisonn): report somehow why we failed?
return;
}
}