OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkPdfNativeDoc.h" | 8 #include "SkPdfNativeDoc.h" |
9 | 9 |
10 #include <stdio.h> | 10 #include <stdio.h> |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 SkPdfPageObjectDictionary* current = fPages[page]; | 472 SkPdfPageObjectDictionary* current = fPages[page]; |
473 while (!current->has_MediaBox() && current->has_Parent()) { | 473 while (!current->has_MediaBox() && current->has_Parent()) { |
474 current = (SkPdfPageObjectDictionary*)current->Parent(this); | 474 current = (SkPdfPageObjectDictionary*)current->Parent(this); |
475 } | 475 } |
476 if (current) { | 476 if (current) { |
477 return current->MediaBox(this); | 477 return current->MediaBox(this); |
478 } | 478 } |
479 return SkRect::MakeEmpty(); | 479 return SkRect::MakeEmpty(); |
480 } | 480 } |
481 | 481 |
482 SkPdfNativeTokenizer* SkPdfNativeDoc::tokenizerOfStream(SkPdfNativeObject* strea
m, | |
483 SkPdfAllocator* allocato
r) { | |
484 if (stream == NULL) { | |
485 return NULL; | |
486 } | |
487 | |
488 return new SkPdfNativeTokenizer(stream, allocator, this); | |
489 } | |
490 | |
491 size_t SkPdfNativeDoc::objects() const { | 482 size_t SkPdfNativeDoc::objects() const { |
492 return fObjects.count(); | 483 return fObjects.count(); |
493 } | 484 } |
494 | 485 |
495 SkPdfNativeObject* SkPdfNativeDoc::object(int i) { | 486 SkPdfNativeObject* SkPdfNativeDoc::object(int i) { |
496 SkASSERT(!(i < 0 || i > fObjects.count())); | 487 SkASSERT(!(i < 0 || i > fObjects.count())); |
497 | 488 |
498 if (i < 0 || i > fObjects.count()) { | 489 if (i < 0 || i > fObjects.count()) { |
499 return NULL; | 490 return NULL; |
500 } | 491 } |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 return (SkPdfNativeObject*)ref; | 573 return (SkPdfNativeObject*)ref; |
583 } | 574 } |
584 | 575 |
585 size_t SkPdfNativeDoc::bytesUsed() const { | 576 size_t SkPdfNativeDoc::bytesUsed() const { |
586 return fAllocator->bytesUsed() + | 577 return fAllocator->bytesUsed() + |
587 fContentLength + | 578 fContentLength + |
588 fObjects.count() * sizeof(PublicObjectEntry) + | 579 fObjects.count() * sizeof(PublicObjectEntry) + |
589 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + | 580 fPages.count() * sizeof(SkPdfPageObjectDictionary*) + |
590 sizeof(*this); | 581 sizeof(*this); |
591 } | 582 } |
OLD | NEW |