OLD | NEW |
1 #ifndef EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKNATIVEPARSEDPDF_H_ | 1 #ifndef EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKNATIVEPARSEDPDF_H_ |
2 #define EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKNATIVEPARSEDPDF_H_ | 2 #define EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKNATIVEPARSEDPDF_H_ |
3 | 3 |
4 #include "SkRect.h" | 4 #include "SkRect.h" |
5 #include "SkTDArray.h" | 5 #include "SkTDArray.h" |
6 | 6 |
7 class SkCanvas; | 7 class SkCanvas; |
8 | 8 |
9 class SkPdfAllocator; | 9 class SkPdfAllocator; |
10 class SkPdfMapper; | 10 class SkPdfMapper; |
11 class SkPdfObject; | 11 class SkPdfObject; |
12 class SkPdfReal; | 12 class SkPdfReal; |
13 class SkPdfInteger; | 13 class SkPdfInteger; |
14 class SkPdfString; | 14 class SkPdfString; |
15 class SkPdfResourceDictionary; | 15 class SkPdfResourceDictionary; |
16 class SkPdfCatalogDictionary; | 16 class SkPdfCatalogDictionary; |
17 class SkPdfPageObjectDictionary; | 17 class SkPdfPageObjectDictionary; |
18 class SkPdfPageTreeNodeDictionary; | 18 class SkPdfPageTreeNodeDictionary; |
19 | 19 |
20 | |
21 | |
22 class SkPdfNativeTokenizer; | 20 class SkPdfNativeTokenizer; |
23 | 21 |
24 class SkNativeParsedPDF { | 22 class SkNativeParsedPDF { |
25 private: | 23 private: |
26 struct PublicObjectEntry { | 24 struct PublicObjectEntry { |
27 long fOffset; | 25 long fOffset; |
28 // long endOffset; // TODO(edisonn): determine the end of the object, t
o be used when the doc is corrupted | 26 // long endOffset; // TODO(edisonn): determine the end of the object, t
o be used when the doc is corrupted |
29 SkPdfObject* fObj; | 27 SkPdfObject* fObj; |
30 // TODO(edisonn): perf ... probably it does not make sense to cache the
ref. test it! | 28 // TODO(edisonn): perf ... probably it does not make sense to cache the
ref. test it! |
31 SkPdfObject* fResolvedReference; | 29 SkPdfObject* fResolvedReference; |
(...skipping 24 matching lines...) Expand all Loading... |
56 | 54 |
57 SkPdfReal* createReal(double value) const; | 55 SkPdfReal* createReal(double value) const; |
58 SkPdfInteger* createInteger(int value) const; | 56 SkPdfInteger* createInteger(int value) const; |
59 // the string does not own the char* | 57 // the string does not own the char* |
60 SkPdfString* createString(unsigned char* sz, size_t len) const; | 58 SkPdfString* createString(unsigned char* sz, size_t len) const; |
61 | 59 |
62 void drawPage(int page, SkCanvas* canvas); | 60 void drawPage(int page, SkCanvas* canvas); |
63 | 61 |
64 SkPdfObject* resolveReference(const SkPdfObject* ref); | 62 SkPdfObject* resolveReference(const SkPdfObject* ref); |
65 | 63 |
| 64 // Reports an approximation of all the memory usage. |
| 65 size_t bytesUsed(); |
| 66 |
66 private: | 67 private: |
67 | 68 |
68 unsigned char* readCrossReferenceSection(unsigned char* xrefStart, unsigned
char* trailerEnd); | 69 unsigned char* readCrossReferenceSection(unsigned char* xrefStart, unsigned
char* trailerEnd); |
69 long readTrailer(unsigned char* trailerStart, unsigned char* trailerEnd, boo
l storeCatalog); | 70 long readTrailer(unsigned char* trailerStart, unsigned char* trailerEnd, boo
l storeCatalog); |
70 | 71 |
71 // TODO(edisonn): updates not supported right now, generation ignored | 72 // TODO(edisonn): updates not supported right now, generation ignored |
72 void addCrossSectionInfo(int id, int generation, int offset, bool isFreed); | 73 void addCrossSectionInfo(int id, int generation, int offset, bool isFreed); |
73 static void reset(PublicObjectEntry* obj) { | 74 static void reset(PublicObjectEntry* obj) { |
74 obj->fObj = NULL; | 75 obj->fObj = NULL; |
75 obj->fResolvedReference = NULL; | 76 obj->fResolvedReference = NULL; |
(...skipping 10 matching lines...) Expand all Loading... |
86 unsigned char* fFileContent; | 87 unsigned char* fFileContent; |
87 size_t fContentLength; | 88 size_t fContentLength; |
88 const SkPdfObject* fRootCatalogRef; | 89 const SkPdfObject* fRootCatalogRef; |
89 SkPdfCatalogDictionary* fRootCatalog; | 90 SkPdfCatalogDictionary* fRootCatalog; |
90 | 91 |
91 mutable SkTDArray<PublicObjectEntry> fObjects; | 92 mutable SkTDArray<PublicObjectEntry> fObjects; |
92 SkTDArray<SkPdfPageObjectDictionary*> fPages; | 93 SkTDArray<SkPdfPageObjectDictionary*> fPages; |
93 }; | 94 }; |
94 | 95 |
95 #endif // EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKNATIVEPARSEDPDF_H_ | 96 #endif // EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKNATIVEPARSEDPDF_H_ |
OLD | NEW |