OLD | NEW |
1 #ifndef EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ | 1 #ifndef EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ |
2 #define EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ | 2 #define EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ |
3 | 3 |
4 #include <stdint.h> | 4 #include <stdint.h> |
5 #include <string.h> | 5 #include <string.h> |
6 #include <string> | 6 #include <string> |
7 #include "SkTDArray.h" | 7 #include "SkTDArray.h" |
8 #include "SkTDict.h" | 8 #include "SkTDict.h" |
9 #include "SkRect.h" | 9 #include "SkRect.h" |
10 #include "SkMatrix.h" | 10 #include "SkMatrix.h" |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 inline double numberValue() const { | 600 inline double numberValue() const { |
601 SkASSERT(isNumber()); | 601 SkASSERT(isNumber()); |
602 | 602 |
603 if (!isNumber()) { | 603 if (!isNumber()) { |
604 // TODO(edisonn): log err | 604 // TODO(edisonn): log err |
605 return 0; | 605 return 0; |
606 } | 606 } |
607 return fObjectType == kReal_PdfObjectType ? fRealValue : fIntegerValue; | 607 return fObjectType == kReal_PdfObjectType ? fRealValue : fIntegerValue; |
608 } | 608 } |
609 | 609 |
| 610 inline SkScalar scalarValue() const { |
| 611 SkASSERT(isNumber()); |
| 612 |
| 613 if (!isNumber()) { |
| 614 // TODO(edisonn): log err |
| 615 return SkIntToScalar(0); |
| 616 } |
| 617 return fObjectType == kReal_PdfObjectType ? SkDoubleToScalar(fRealValue)
: |
| 618 SkIntToScalar(fIntegerValue)
; |
| 619 } |
| 620 |
610 int referenceId() const { | 621 int referenceId() const { |
611 SkASSERT(fObjectType == kReference_PdfObjectType); | 622 SkASSERT(fObjectType == kReference_PdfObjectType); |
612 return fRef.fId; | 623 return fRef.fId; |
613 } | 624 } |
614 | 625 |
615 int referenceGeneration() const { | 626 int referenceGeneration() const { |
616 SkASSERT(fObjectType == kReference_PdfObjectType); | 627 SkASSERT(fObjectType == kReference_PdfObjectType); |
617 return fRef.fGen; | 628 return fRef.fGen; |
618 } | 629 } |
619 | 630 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
899 SkPdfName() : SkPdfObject() { | 910 SkPdfName() : SkPdfObject() { |
900 SkPdfObject::makeName((const unsigned char*)"", this); | 911 SkPdfObject::makeName((const unsigned char*)"", this); |
901 } | 912 } |
902 public: | 913 public: |
903 SkPdfName(char* name) : SkPdfObject() { | 914 SkPdfName(char* name) : SkPdfObject() { |
904 this->makeName((const unsigned char*)name, this); | 915 this->makeName((const unsigned char*)name, this); |
905 } | 916 } |
906 }; | 917 }; |
907 | 918 |
908 #endif // EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ | 919 #endif // EXPERIMENTAL_PDFVIEWER_PDFPARSER_NATIVE_SKPDFOBJECT_H_ |
OLD | NEW |