OLD | NEW |
1 #include "SkNativeParsedPDF.h" | 1 #include "SkNativeParsedPDF.h" |
2 #include "SkPdfNativeTokenizer.h" | 2 #include "SkPdfNativeTokenizer.h" |
3 #include "SkPdfBasics.h" | 3 #include "SkPdfBasics.h" |
4 #include "SkPdfObject.h" | 4 #include "SkPdfObject.h" |
5 | 5 |
6 #include <stdio.h> | 6 #include <stdio.h> |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 | 10 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 if (strcmp((char*)xrefstartKeywordLine, "startxref") != 0) { | 117 if (strcmp((char*)xrefstartKeywordLine, "startxref") != 0) { |
118 // TODO(edisonn): report/issue | 118 // TODO(edisonn): report/issue |
119 } | 119 } |
120 | 120 |
121 long xrefByteOffset = atol((const char*)xrefByteOffsetLine); | 121 long xrefByteOffset = atol((const char*)xrefByteOffsetLine); |
122 | 122 |
123 bool storeCatalog = true; | 123 bool storeCatalog = true; |
124 while (xrefByteOffset >= 0) { | 124 while (xrefByteOffset >= 0) { |
125 const unsigned char* trailerStart = readCrossReferenceSection(fFileConte
nt + xrefByteOffset, xrefstartKeywordLine); | 125 const unsigned char* trailerStart = readCrossReferenceSection(fFileConte
nt + xrefByteOffset, xrefstartKeywordLine); |
126 readTrailer(trailerStart, xrefstartKeywordLine, storeCatalog, &xrefByteO
ffset, false); | 126 xrefByteOffset = -1; |
127 storeCatalog = false; | 127 if (trailerStart < xrefstartKeywordLine) { |
| 128 readTrailer(trailerStart, xrefstartKeywordLine, storeCatalog, &xrefB
yteOffset, false); |
| 129 storeCatalog = false; |
| 130 } |
128 } | 131 } |
129 | 132 |
130 // TODO(edisonn): warn/error expect fObjects[fRefCatalogId].fGeneration == f
RefCatalogGeneration | 133 // TODO(edisonn): warn/error expect fObjects[fRefCatalogId].fGeneration == f
RefCatalogGeneration |
131 // TODO(edisonn): security, verify that SkPdfCatalogDictionary is indeed usi
ng mapper | 134 // TODO(edisonn): security, verify that SkPdfCatalogDictionary is indeed usi
ng mapper |
132 // load catalog | 135 // load catalog |
133 | 136 |
134 if (fRootCatalogRef) { | 137 if (fRootCatalogRef) { |
135 fRootCatalog = (SkPdfCatalogDictionary*)resolveReference(fRootCatalogRef
); | 138 fRootCatalog = (SkPdfCatalogDictionary*)resolveReference(fRootCatalogRef
); |
136 if (fRootCatalog->isDictionary() && fRootCatalog->valid()) { | 139 if (fRootCatalog->isDictionary() && fRootCatalog->valid()) { |
137 SkPdfPageTreeNodeDictionary* tree = fRootCatalog->Pages(this); | 140 SkPdfPageTreeNodeDictionary* tree = fRootCatalog->Pages(this); |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 return (SkPdfObject*)ref; | 540 return (SkPdfObject*)ref; |
538 } | 541 } |
539 | 542 |
540 size_t SkNativeParsedPDF::bytesUsed() const { | 543 size_t SkNativeParsedPDF::bytesUsed() const { |
541 return fAllocator->bytesUsed() + | 544 return fAllocator->bytesUsed() + |
542 fContentLength + | 545 fContentLength + |
543 fObjects.count() * sizeof(PublicObjectEntry) + | 546 fObjects.count() * sizeof(PublicObjectEntry) + |
544 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + | 547 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + |
545 sizeof(*this); | 548 sizeof(*this); |
546 } | 549 } |
OLD | NEW |