OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkPdfNativeDoc_DEFINED | 8 #ifndef SkPdfNativeDoc_DEFINED |
9 #define SkPdfNativeDoc_DEFINED | 9 #define SkPdfNativeDoc_DEFINED |
10 | 10 |
(...skipping 18 matching lines...) Expand all Loading... |
29 class SkStream; | 29 class SkStream; |
30 | 30 |
31 class SkPdfNativeDoc { | 31 class SkPdfNativeDoc { |
32 private: | 32 private: |
33 struct PublicObjectEntry { | 33 struct PublicObjectEntry { |
34 long fOffset; | 34 long fOffset; |
35 // long endOffset; // TODO(edisonn): determine the end of the object, t
o be used when the doc is corrupted | 35 // long endOffset; // TODO(edisonn): determine the end of the object, t
o be used when the doc is corrupted |
36 SkPdfNativeObject* fObj; | 36 SkPdfNativeObject* fObj; |
37 // TODO(edisonn): perf ... probably it does not make sense to cache the
ref. test it! | 37 // TODO(edisonn): perf ... probably it does not make sense to cache the
ref. test it! |
38 SkPdfNativeObject* fResolvedReference; | 38 SkPdfNativeObject* fResolvedReference; |
| 39 bool fIsReferenceResolved; |
39 }; | 40 }; |
40 | 41 |
41 public: | 42 public: |
42 // TODO(edisonn): read methods: file, stream, http(s)://url, url with seek? | 43 // TODO(edisonn): read methods: file, stream, http(s)://url, url with seek? |
43 // TODO(edisonn): read first page asap, linearized | 44 // TODO(edisonn): read first page asap, linearized |
44 // TODO(edisonn): read page N asap, read all file | 45 // TODO(edisonn): read page N asap, read all file |
45 // TODO(edisonn): allow corruptions of file (e.g. missing endobj, missing st
ream length, ...) | 46 // TODO(edisonn): allow corruptions of file (e.g. missing endobj, missing st
ream length, ...) |
46 // TODO(edisonn): encryption | 47 // TODO(edisonn): encryption |
47 | 48 |
48 SkPdfNativeDoc(const char* path); | 49 SkPdfNativeDoc(const char* path); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 85 |
85 const unsigned char* readCrossReferenceSection(const unsigned char* xrefStar
t, const unsigned char* trailerEnd); | 86 const unsigned char* readCrossReferenceSection(const unsigned char* xrefStar
t, const unsigned char* trailerEnd); |
86 const unsigned char* readTrailer(const unsigned char* trailerStart, const un
signed char* trailerEnd, bool storeCatalog, long* prev, bool skipKeyword); | 87 const unsigned char* readTrailer(const unsigned char* trailerStart, const un
signed char* trailerEnd, bool storeCatalog, long* prev, bool skipKeyword); |
87 | 88 |
88 // TODO(edisonn): updates not supported right now, generation ignored | 89 // TODO(edisonn): updates not supported right now, generation ignored |
89 void addCrossSectionInfo(int id, int generation, int offset, bool isFreed); | 90 void addCrossSectionInfo(int id, int generation, int offset, bool isFreed); |
90 static void reset(PublicObjectEntry* obj) { | 91 static void reset(PublicObjectEntry* obj) { |
91 obj->fObj = NULL; | 92 obj->fObj = NULL; |
92 obj->fResolvedReference = NULL; | 93 obj->fResolvedReference = NULL; |
93 obj->fOffset = -1; | 94 obj->fOffset = -1; |
| 95 obj->fIsReferenceResolved = false; |
94 } | 96 } |
95 | 97 |
96 SkPdfNativeObject* readObject(int id/*, int generation*/); | 98 SkPdfNativeObject* readObject(int id/*, int generation*/); |
97 | 99 |
98 void fillPages(SkPdfPageTreeNodeDictionary* tree); | 100 void fillPages(SkPdfPageTreeNodeDictionary* tree); |
99 | 101 |
100 // private fields | 102 // private fields |
101 SkPdfAllocator* fAllocator; | 103 SkPdfAllocator* fAllocator; |
102 SkPdfMapper* fMapper; | 104 SkPdfMapper* fMapper; |
103 const unsigned char* fFileContent; | 105 const unsigned char* fFileContent; |
104 size_t fContentLength; | 106 size_t fContentLength; |
105 SkPdfNativeObject* fRootCatalogRef; | 107 SkPdfNativeObject* fRootCatalogRef; |
106 SkPdfCatalogDictionary* fRootCatalog; | 108 SkPdfCatalogDictionary* fRootCatalog; |
107 | 109 |
108 mutable SkTDArray<PublicObjectEntry> fObjects; | 110 mutable SkTDArray<PublicObjectEntry> fObjects; |
109 SkTDArray<SkPdfPageObjectDictionary*> fPages; | 111 SkTDArray<SkPdfPageObjectDictionary*> fPages; |
110 }; | 112 }; |
111 | 113 |
112 #endif // SkPdfNativeDoc_DEFINED | 114 #endif // SkPdfNativeDoc_DEFINED |
OLD | NEW |