aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/PdfViewer
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/PdfViewer')
-rw-r--r--experimental/PdfViewer/SkPdfRenderer.cpp16
-rw-r--r--experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp11
-rw-r--r--experimental/PdfViewer/pdfparser/native/SkPdfObject.h7
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) {