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

Side by Side Diff: experimental/PdfViewer/pdfparser/native/SkNativeParsedPDF.cpp

Issue 22465006: pdfviewer: pass the page number, report failure if at least one render fails, and check that xref s… (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « experimental/PdfViewer/pdf_viewer_main.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « experimental/PdfViewer/pdf_viewer_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698