diff options
author | edisonn@google.com <edisonn@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-01 21:20:47 +0000 |
---|---|---|
committer | edisonn@google.com <edisonn@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-08-01 21:20:47 +0000 |
commit | 276fed9e0ae2e4457efd61eeb14738040feb65f1 (patch) | |
tree | 585bcb855b255d1161dfe74ce492ec4b83f23b74 /experimental | |
parent | 397a9546e460494c925985dbed332582deabbdbc (diff) |
pdfviewer: debug the parameters for snc, and for resolveReference
Review URL: https://codereview.chromium.org/21604003
git-svn-id: http://skia.googlecode.com/svn/trunk@10498 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'experimental')
-rw-r--r-- | experimental/PdfViewer/SkPdfRenderer.cpp | 16 | ||||
-rw-r--r-- | experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp | 11 | ||||
-rw-r--r-- | experimental/PdfViewer/pdfparser/native/SkPdfObject.h | 7 |
3 files changed, 29 insertions, 5 deletions
diff --git a/experimental/PdfViewer/SkPdfRenderer.cpp b/experimental/PdfViewer/SkPdfRenderer.cpp index e15f165185..bbd036a00b 100644 --- a/experimental/PdfViewer/SkPdfRenderer.cpp +++ b/experimental/PdfViewer/SkPdfRenderer.cpp @@ -1455,10 +1455,20 @@ static PdfResult PdfOp_sc(PdfContext* pdfContext, SkCanvas* canvas, PdfTokenLoop } static PdfResult PdfOp_SCN_scn(PdfContext* pdfContext, SkCanvas* canvas, SkPdfColorOperator* colorOperator) { - //SkPdfString* name; if (pdfContext->fObjectStack.top()->isName()) { - // TODO(edisonn): get name, pass it - pdfContext->fObjectStack.pop(); + SkPdfObject* name = pdfContext->fObjectStack.top(); pdfContext->fObjectStack.pop(); + + //Next, get the ExtGState Dictionary from the Resource Dictionary: + SkPdfDictionary* extGStateDictionary = pdfContext->fGraphicsState.fResources->Pattern(pdfContext->fPdfDoc); + + if (extGStateDictionary == NULL) { +#ifdef PDF_TRACE + printf("ExtGState is NULL!\n"); +#endif + return kIgnoreError_PdfResult; + } + + /*SkPdfObject* value = */pdfContext->fPdfDoc->resolveReference(extGStateDictionary->get(name)); } // TODO(edisonn): SCN supports more color spaces than SCN. Read and implement spec. diff --git a/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp b/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp index 597dfcdb6c..306bf0716b 100644 --- a/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp +++ b/experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp @@ -519,6 +519,11 @@ SkPdfObject* SkNativeParsedPDF::resolveReference(const SkPdfObject* ref) { } if (fObjects[id].fResolvedReference != NULL) { + +#ifdef PDF_TRACE + printf("\nresolve(%s) = %s\n", ref->toString(0).c_str(), fObjects[id].fResolvedReference->toString(0, ref->toString().size() + 13).c_str()); +#endif + return fObjects[id].fResolvedReference; } @@ -534,8 +539,14 @@ SkPdfObject* SkNativeParsedPDF::resolveReference(const SkPdfObject* ref) { } } +#ifdef PDF_TRACE + printf("\nresolve(%s) = %s\n", ref->toString(0).c_str(), fObjects[id].fResolvedReference->toString(0, ref->toString().size() + 13).c_str()); +#endif return fObjects[id].fResolvedReference; } + + + // TODO(edisonn): fix the mess with const, probably we need to remove it pretty much everywhere return (SkPdfObject*)ref; } diff --git a/experimental/PdfViewer/pdfparser/native/SkPdfObject.h b/experimental/PdfViewer/pdfparser/native/SkPdfObject.h index f3832b2854..5e3bcdbe1d 100644 --- a/experimental/PdfViewer/pdfparser/native/SkPdfObject.h +++ b/experimental/PdfViewer/pdfparser/native/SkPdfObject.h @@ -123,6 +123,7 @@ public: case kString_PdfObjectType: case kHexString_PdfObjectType: case kKeyword_PdfObjectType: + case kName_PdfObjectType: return (const char*)fStr.fBuffer; default: @@ -136,6 +137,7 @@ public: case kString_PdfObjectType: case kHexString_PdfObjectType: case kKeyword_PdfObjectType: + case kName_PdfObjectType: return fStr.fBytes; default: @@ -682,6 +684,7 @@ public: case kString_PdfObjectType: case kHexString_PdfObjectType: case kKeyword_PdfObjectType: + case kName_PdfObjectType: return fStr; default: @@ -830,13 +833,13 @@ public: return true; } - void appendSpaces(SkString* str, int level) { + static void appendSpaces(SkString* str, int level) { for (int i = 0 ; i < level; i++) { str->append(" "); } } - SkString toString(int firstRowLevel = 0, int level = 0) { + SkString toString(int firstRowLevel = 0, int level = 0) const { SkString str; appendSpaces(&str, firstRowLevel); switch (fObjectType) { |