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

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
Index: src/pdf/SkPDFDevice.cpp
===================================================================
--- src/pdf/SkPDFDevice.cpp (revision 11092)
+++ src/pdf/SkPDFDevice.cpp (working copy)
@@ -679,6 +679,7 @@
fLastMarginContentEntry(NULL),
fClipStack(NULL),
fEncoder(NULL) {
+ SkASSERT(!initialTransform.hasPerspective());
vandebo (ex-Chrome) 2013/09/12 21:37:05 If you want to assert, just pass true for the seco
edisonn 2013/09/17 15:14:23 Done.
// 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.
@@ -690,6 +691,11 @@
fExistingClipRegion.setRect(existingClip);
this->init();
+ if (initialTransform.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
+ }
}
// TODO(vandebo) change layerSize to SkSize.
@@ -777,6 +783,14 @@
if (!totalTransform.invert(&inverse)) {
return;
}
+
+ if (totalTransform.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;
+ }
+
inverse.mapRect(&bbox);
SkPDFUtils::AppendRectangle(bbox, &contentEntry->fContent);
@@ -890,6 +904,13 @@
return;
}
+ if (d.fMatrix->hasPerspective()) {
vandebo (ex-Chrome) 2013/09/12 21:37:05 If you put this in ScopedContentEntry, you'll cove
edisonn 2013/09/17 15:14:23 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, d, paint);
if (!content.entry()) {
return;
@@ -915,11 +936,19 @@
origPath.transform(*prePathMatrix, pathPtr);
} else {
if (!matrix.preConcat(*prePathMatrix)) {
+ // TODO(edisonn): report somewhow why we failed?
return;
}
}
}
+ if (matrix.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.getPathEffect()) {
if (d.fClip->isEmpty()) {
return;
@@ -1902,6 +1931,14 @@
scaled.postScale(SkIntToScalar(subset.width()),
SkIntToScalar(subset.height()));
scaled.postConcat(matrix);
+
+ if (scaled.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;
+ }
+
ScopedContentEntry content(this, clipStack, clipRegion, scaled, paint);
if (!content.entry()) {
return;

Powered by Google App Engine
This is Rietveld 408576698