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

Unified Diff: experimental/PdfViewer/SkPdfRenderer.cpp

Issue 23033022: pdfviewer: when q start, and an operator is called, it should not be able to see operands before q.… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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: experimental/PdfViewer/SkPdfRenderer.cpp
===================================================================
--- experimental/PdfViewer/SkPdfRenderer.cpp (revision 10872)
+++ experimental/PdfViewer/SkPdfRenderer.cpp (working copy)
@@ -1085,13 +1085,25 @@
// it is not possible to see under the previous q?
pdfContext->fStateStack.push(pdfContext->fGraphicsState);
canvas->save();
+ pdfContext->fObjectStack.nest();
return kOK_SkPdfResult;
}
SkPdfResult PdfOp_Q(SkPdfContext* pdfContext, SkCanvas* canvas, PdfTokenLooper** looper) {
- pdfContext->fGraphicsState = pdfContext->fStateStack.top();
- pdfContext->fStateStack.pop();
- canvas->restore();
+ if (pdfContext->fStateStack.count() > 0) {
+ pdfContext->fGraphicsState = pdfContext->fStateStack.top();
+ pdfContext->fStateStack.pop();
+ canvas->restore();
+
+ if (pdfContext->fObjectStack.nests() <= 0) {
+ return kIgnoreError_SkPdfResult;
+ } else {
+ pdfContext->fObjectStack.unnest();
+ }
+ } else {
+ return kIgnoreError_SkPdfResult;
+ }
+
return kOK_SkPdfResult;
}
@@ -2775,6 +2787,10 @@
SkScalar w = dst.width();
SkScalar h = dst.height();
+ if (SkScalarTruncToInt(w) <= 0 || SkScalarTruncToInt(h) <= 0) {
+ return true;
+ }
+
SkScalar wp = fPdfDoc->MediaBox(page).width();
SkScalar hp = fPdfDoc->MediaBox(page).height();
« no previous file with comments | « experimental/PdfViewer/SkPdfGraphicsState.h ('k') | experimental/PdfViewer/pdfparser/native/SkPdfNativeDoc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698