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

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

Issue 22624002: pdfviewer: absolute minimal; to al least render (even if poorly) ICC based color spaces, based on R… (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/SkPdfRenderer.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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 long dummy; 200 long dummy;
201 current = readTrailer(current, end, true, &dummy, true); 201 current = readTrailer(current, end, true, &dummy, true);
202 } else if (token.isKeyword("startxref")) { 202 } else if (token.isKeyword("startxref")) {
203 token.reset(); 203 token.reset();
204 current = nextObject(0, current, end, &token, NULL, NULL); // ignor e 204 current = nextObject(0, current, end, &token, NULL, NULL); // ignor e
205 } 205 }
206 206
207 current = skipPdfWhiteSpaces(0, current, end); 207 current = skipPdfWhiteSpaces(0, current, end);
208 } 208 }
209 209
210 // TODO(edisonn): hack, detect root catalog - we need to implement liniarize d support, and remove this hack.
211 if (!fRootCatalogRef) {
212 for (unsigned int i = 0 ; i < objects(); i++) {
213 SkPdfObject* obj = object(i);
214 SkPdfObject* root = (obj && obj->isDictionary()) ? obj->get("Root") : NULL;
215 if (root && root->isReference()) {
216 fRootCatalogRef = root;
217 }
218 }
219 }
220
221
210 if (fRootCatalogRef) { 222 if (fRootCatalogRef) {
211 fRootCatalog = (SkPdfCatalogDictionary*)resolveReference(fRootCatalogRef ); 223 fRootCatalog = (SkPdfCatalogDictionary*)resolveReference(fRootCatalogRef );
212 if (fRootCatalog->isDictionary() && fRootCatalog->valid()) { 224 if (fRootCatalog->isDictionary() && fRootCatalog->valid()) {
213 SkPdfPageTreeNodeDictionary* tree = fRootCatalog->Pages(this); 225 SkPdfPageTreeNodeDictionary* tree = fRootCatalog->Pages(this);
214 if (tree && tree->isDictionary() && tree->valid()) { 226 if (tree && tree->isDictionary() && tree->valid()) {
215 fillPages(tree); 227 fillPages(tree);
216 } 228 }
217 } 229 }
218 } 230 }
219 231
232
220 } 233 }
221 234
222 // TODO(edisonn): NYI 235 // TODO(edisonn): NYI
223 SkNativeParsedPDF::~SkNativeParsedPDF() { 236 SkNativeParsedPDF::~SkNativeParsedPDF() {
224 sk_free((void*)fFileContent); 237 sk_free((void*)fFileContent);
225 delete fAllocator; 238 delete fAllocator;
226 } 239 }
227 240
228 const unsigned char* SkNativeParsedPDF::readCrossReferenceSection(const unsigned char* xrefStart, const unsigned char* trailerEnd) { 241 const unsigned char* SkNativeParsedPDF::readCrossReferenceSection(const unsigned char* xrefStart, const unsigned char* trailerEnd) {
229 SkPdfObject xref; 242 SkPdfObject xref;
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 return (SkPdfObject*)ref; 570 return (SkPdfObject*)ref;
558 } 571 }
559 572
560 size_t SkNativeParsedPDF::bytesUsed() const { 573 size_t SkNativeParsedPDF::bytesUsed() const {
561 return fAllocator->bytesUsed() + 574 return fAllocator->bytesUsed() +
562 fContentLength + 575 fContentLength +
563 fObjects.count() * sizeof(PublicObjectEntry) + 576 fObjects.count() * sizeof(PublicObjectEntry) +
564 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + 577 fPages.count() * sizeof(SkPdfPageObjectDictionary*) +
565 sizeof(*this); 578 sizeof(*this);
566 } 579 }
OLDNEW
« no previous file with comments | « experimental/PdfViewer/SkPdfRenderer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698