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

Unified Diff: experimental/PdfViewer/pdf_viewer_main.cpp

Issue 16968007: Pdfviewer: generate isAFoo() and getAsFoo() api for fields that can have multiple types. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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 | « experimental/PdfViewer/pdf_auto_gen.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/PdfViewer/pdf_viewer_main.cpp
===================================================================
--- experimental/PdfViewer/pdf_viewer_main.cpp (revision 9643)
+++ experimental/PdfViewer/pdf_viewer_main.cpp (working copy)
@@ -76,8 +76,104 @@
SkPdfObject** data);
+struct SkPdfFileSpec {};
+class SkPdfArray;
+struct SkPdfStream {};
+struct SkPdfDate {};
+struct SkPdfTree {};
+struct SkPdfFunction {};
+
+bool ArrayFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfArray* data);
+
+
+bool FileSpecFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfFileSpec* data);
+
+
+bool StreamFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfStream* data);
+
+bool TreeFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfTree** data);
+
+bool DateFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfDate* data);
+
+bool SkRectFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkRect* data);
+
+bool FunctionFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfFunction* data);
+
+
#include "pdf_auto_gen.h"
+bool ArrayFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfArray* data) {return false;}
+
+bool FileSpecFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfFileSpec* data) {return false;}
+
+bool StreamFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfStream* data) {return false;}
+
+bool TreeFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfTree** data) {return false;}
+
+bool DateFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfDate* data) {return false;}
+
+bool SkRectFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkRect* data) {return false;}
+
+bool FunctionFromDictionary(const PdfMemDocument* pdfDoc,
+ const PdfDictionary& dict,
+ const char* key,
+ const char* abr,
+ SkPdfFunction* data) {return false;}
+
+
+
/*
* TODO(edisonn):
* - encapsulate podofo in the pdf api so the skpdf does not know anything about podofo
@@ -1134,12 +1230,11 @@
long bpc = image->BitsPerComponent();
long width = image->Width();
long height = image->Height();
- SkPdfObject* colorSpaceDict = image->ColorSpace();
std::string colorSpace = "DeviceRGB";
- // TODO(edisonn): for multiple type fileds, generate code, like, isName(), isArray(), ...and fields like colorSpace_name(), colorSpace_array()
- // so we do nto go to podofo anywhere in our cpp file
- if (colorSpaceDict && colorSpaceDict->podofo() && colorSpaceDict->podofo()->IsName()) {
- colorSpace = colorSpaceDict->podofo()->GetName().GetName();
+
+ // TODO(edisonn): color space can be an array too!
+ if (image->isColorSpaceAName()) {
+ colorSpace = image->getColorSpaceAsName();
}
/*
« no previous file with comments | « experimental/PdfViewer/pdf_auto_gen.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698