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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 // TODO(edisonn): generation/updates not supported now | 512 // TODO(edisonn): generation/updates not supported now |
513 //int gen = ref->referenceGeneration(); | 513 //int gen = ref->referenceGeneration(); |
514 | 514 |
515 // TODO(edisonn): verify id and gen expected | 515 // TODO(edisonn): verify id and gen expected |
516 if (id < 0 || id >= fObjects.count()) { | 516 if (id < 0 || id >= fObjects.count()) { |
517 // TODO(edisonn): report error/warning | 517 // TODO(edisonn): report error/warning |
518 return NULL; | 518 return NULL; |
519 } | 519 } |
520 | 520 |
521 if (fObjects[id].fResolvedReference != NULL) { | 521 if (fObjects[id].fResolvedReference != NULL) { |
| 522 |
| 523 #ifdef PDF_TRACE |
| 524 printf("\nresolve(%s) = %s\n", ref->toString(0).c_str(), fObjects[id
].fResolvedReference->toString(0, ref->toString().size() + 13).c_str()); |
| 525 #endif |
| 526 |
522 return fObjects[id].fResolvedReference; | 527 return fObjects[id].fResolvedReference; |
523 } | 528 } |
524 | 529 |
525 if (fObjects[id].fObj == NULL) { | 530 if (fObjects[id].fObj == NULL) { |
526 fObjects[id].fObj = readObject(id); | 531 fObjects[id].fObj = readObject(id); |
527 } | 532 } |
528 | 533 |
529 if (fObjects[id].fResolvedReference == NULL) { | 534 if (fObjects[id].fResolvedReference == NULL) { |
530 if (!fObjects[id].fObj->isReference()) { | 535 if (!fObjects[id].fObj->isReference()) { |
531 fObjects[id].fResolvedReference = fObjects[id].fObj; | 536 fObjects[id].fResolvedReference = fObjects[id].fObj; |
532 } else { | 537 } else { |
533 fObjects[id].fResolvedReference = resolveReference(fObjects[id].
fObj); | 538 fObjects[id].fResolvedReference = resolveReference(fObjects[id].
fObj); |
534 } | 539 } |
535 } | 540 } |
536 | 541 |
| 542 #ifdef PDF_TRACE |
| 543 printf("\nresolve(%s) = %s\n", ref->toString(0).c_str(), fObjects[id].fR
esolvedReference->toString(0, ref->toString().size() + 13).c_str()); |
| 544 #endif |
537 return fObjects[id].fResolvedReference; | 545 return fObjects[id].fResolvedReference; |
538 } | 546 } |
| 547 |
| 548 |
| 549 |
539 // TODO(edisonn): fix the mess with const, probably we need to remove it pre
tty much everywhere | 550 // TODO(edisonn): fix the mess with const, probably we need to remove it pre
tty much everywhere |
540 return (SkPdfObject*)ref; | 551 return (SkPdfObject*)ref; |
541 } | 552 } |
542 | 553 |
543 size_t SkNativeParsedPDF::bytesUsed() const { | 554 size_t SkNativeParsedPDF::bytesUsed() const { |
544 return fAllocator->bytesUsed() + | 555 return fAllocator->bytesUsed() + |
545 fContentLength + | 556 fContentLength + |
546 fObjects.count() * sizeof(PublicObjectEntry) + | 557 fObjects.count() * sizeof(PublicObjectEntry) + |
547 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + | 558 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + |
548 sizeof(*this); | 559 sizeof(*this); |
549 } | 560 } |
OLD | NEW |