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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 | 218 |
219 } | 219 } |
220 | 220 |
221 // TODO(edisonn): NYI | 221 // TODO(edisonn): NYI |
222 SkNativeParsedPDF::~SkNativeParsedPDF() { | 222 SkNativeParsedPDF::~SkNativeParsedPDF() { |
223 sk_free((void*)fFileContent); | 223 sk_free((void*)fFileContent); |
224 delete fAllocator; | 224 delete fAllocator; |
225 } | 225 } |
226 | 226 |
227 const unsigned char* SkNativeParsedPDF::readCrossReferenceSection(const unsigned
char* xrefStart, const unsigned char* trailerEnd) { | 227 const unsigned char* SkNativeParsedPDF::readCrossReferenceSection(const unsigned
char* xrefStart, const unsigned char* trailerEnd) { |
228 const unsigned char* current = ignoreLine(xrefStart, trailerEnd); // TODO(e
disonn): verify next keyord is "xref", use nextObject here | 228 SkPdfObject xref; |
| 229 const unsigned char* current = nextObject(0, xrefStart, trailerEnd, &xref, N
ULL, NULL); |
| 230 |
| 231 if (!xref.isKeyword("xref")) { |
| 232 return trailerEnd; |
| 233 } |
229 | 234 |
230 SkPdfObject token; | 235 SkPdfObject token; |
231 while (current < trailerEnd) { | 236 while (current < trailerEnd) { |
232 token.reset(); | 237 token.reset(); |
233 const unsigned char* previous = current; | 238 const unsigned char* previous = current; |
234 current = nextObject(0, current, trailerEnd, &token, NULL, NULL); | 239 current = nextObject(0, current, trailerEnd, &token, NULL, NULL); |
235 if (!token.isInteger()) { | 240 if (!token.isInteger()) { |
236 return previous; | 241 return previous; |
237 } | 242 } |
238 | 243 |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 return (SkPdfObject*)ref; | 556 return (SkPdfObject*)ref; |
552 } | 557 } |
553 | 558 |
554 size_t SkNativeParsedPDF::bytesUsed() const { | 559 size_t SkNativeParsedPDF::bytesUsed() const { |
555 return fAllocator->bytesUsed() + | 560 return fAllocator->bytesUsed() + |
556 fContentLength + | 561 fContentLength + |
557 fObjects.count() * sizeof(PublicObjectEntry) + | 562 fObjects.count() * sizeof(PublicObjectEntry) + |
558 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + | 563 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + |
559 sizeof(*this); | 564 sizeof(*this); |
560 } | 565 } |
OLD | NEW |