Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(608)

Unified Diff: src/pdf/SkPDFDevice.cpp

Issue 23654036: pdf: report NYI features, and fail gracefully when something is not supported in pdf. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFDevice.cpp
===================================================================
--- src/pdf/SkPDFDevice.cpp (revision 11306)
+++ src/pdf/SkPDFDevice.cpp (working copy)
@@ -632,6 +632,14 @@
void init(const SkClipStack* clipStack, const SkRegion& clipRegion,
const SkMatrix& matrix, const SkPaint& paint, bool hasText) {
fDstFormXObject = NULL;
+ if (matrix.hasPerspective() ||
vandebo (ex-Chrome) 2013/09/17 16:35:09 The predominate style of this file is 80col. The
edisonn 2013/09/17 17:32:04 Done.
+ (paint.getShader() && paint.getShader()->getLocalMatrix().hasPerspective())) {
+ NOT_IMPLEMENTED(true, false); // just report that PDF does not supports perspective
+ // TODO(edisonn): update the shape when possible
+ // or dump in an image otherwise
+ return;
+ }
+
if (paint.getXfermode()) {
paint.getXfermode()->asMode(&fXfermode);
}
@@ -679,6 +687,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.
@@ -777,6 +790,14 @@
if (!totalTransform.invert(&inverse)) {
return;
}
+
+ if (totalTransform.hasPerspective()) {
vandebo (ex-Chrome) 2013/09/17 16:35:09 This isn't needed. totalTransform is formed from
edisonn 2013/09/17 17:32:04 Done.
+ NOT_IMPLEMENTED(true, false); // just report that PDF does not supports perspective
+ // TODO(edisonn): update the shape when possible
+ // or dump in an image otherwise
+ return;
+ }
+
inverse.mapRect(&bbox);
SkPDFUtils::AppendRectangle(bbox, &contentEntry->fContent);
@@ -915,11 +936,19 @@
origPath.transform(*prePathMatrix, pathPtr);
} else {
if (!matrix.preConcat(*prePathMatrix)) {
+ // TODO(edisonn): report somewhow why we failed?
vandebo (ex-Chrome) 2013/09/17 16:35:09 Log statement?
edisonn 2013/09/17 17:32:04 it is a todo, not looking for an answer in this cl
return;
}
}
}
+ if (matrix.hasPerspective()) {
vandebo (ex-Chrome) 2013/09/17 16:35:09 Not necessary, the matrix will eventually get chec
edisonn 2013/09/17 17:32:04 Done.
+ NOT_IMPLEMENTED(true, false); // just report that PDF does not supports perspective
+ // TODO(edisonn): update the shape when possible
+ // or dump in an image otherwise
+ return;
+ }
+
if (paint.getPathEffect()) {
if (d.fClip->isEmpty()) {
return;
@@ -1902,6 +1931,14 @@
scaled.postScale(SkIntToScalar(subset.width()),
SkIntToScalar(subset.height()));
scaled.postConcat(matrix);
+
+ if (scaled.hasPerspective()) {
vandebo (ex-Chrome) 2013/09/17 16:35:09 Not needed - scaled in passed into ScopedContentEn
edisonn 2013/09/17 17:32:04 Done.
+ NOT_IMPLEMENTED(true, false); // just report that PDF does not supports perspective
+ // TODO(edisonn): update the shape when possible
+ // or dump in an image otherwise
+ return;
+ }
+
ScopedContentEntry content(this, clipStack, clipRegion, scaled, paint);
if (!content.entry()) {
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698