OLD | NEW |
1 #include "DMSrcSink.h" | 1 #include "DMSrcSink.h" |
2 #include "SamplePipeControllers.h" | 2 #include "SamplePipeControllers.h" |
3 #include "SkCommonFlags.h" | 3 #include "SkCommonFlags.h" |
4 #include "SkCodec.h" | 4 #include "SkCodec.h" |
5 #include "SkDocument.h" | 5 #include "SkDocument.h" |
6 #include "SkError.h" | 6 #include "SkError.h" |
7 #include "SkMultiPictureDraw.h" | 7 #include "SkMultiPictureDraw.h" |
8 #include "SkNullCanvas.h" | 8 #include "SkNullCanvas.h" |
9 #include "SkOSFile.h" | 9 #include "SkOSFile.h" |
10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 return Error::Nonfatal("Incompatible colortype conversion"); | 81 return Error::Nonfatal("Incompatible colortype conversion"); |
82 default: | 82 default: |
83 // Everything else is considered a failure. | 83 // Everything else is considered a failure. |
84 return SkStringPrintf("Couldn't getPixels %s.", fPath.c_str()); | 84 return SkStringPrintf("Couldn't getPixels %s.", fPath.c_str()); |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 SkISize CodecSrc::size() const { | 88 SkISize CodecSrc::size() const { |
89 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); | 89 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
90 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); | 90 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); |
91 if (NULL != codec) { | 91 return codec->getInfo().dimensions(); |
92 return codec->getInfo().dimensions(); | |
93 } else { | |
94 return SkISize::Make(0, 0); | |
95 } | |
96 } | 92 } |
97 | 93 |
98 Name CodecSrc::name() const { | 94 Name CodecSrc::name() const { |
99 return SkOSPath::Basename(fPath.c_str()); | 95 return SkOSPath::Basename(fPath.c_str()); |
100 } | 96 } |
101 | 97 |
102 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 98 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
103 | 99 |
104 ImageSrc::ImageSrc(Path path, int divisor) : fPath(path), fDivisor(divisor) {} | 100 ImageSrc::ImageSrc(Path path, int divisor) : fPath(path), fDivisor(divisor) {} |
105 | 101 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 surfaces.unrefAll(); | 574 surfaces.unrefAll(); |
579 return ""; | 575 return ""; |
580 } | 576 } |
581 SkISize size() const SK_OVERRIDE { return fSize; } | 577 SkISize size() const SK_OVERRIDE { return fSize; } |
582 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. | 578 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. |
583 } proxy(fW, fH, pic, src.size()); | 579 } proxy(fW, fH, pic, src.size()); |
584 return fSink->draw(proxy, bitmap, stream, log); | 580 return fSink->draw(proxy, bitmap, stream, log); |
585 } | 581 } |
586 | 582 |
587 } // namespace DM | 583 } // namespace DM |
OLD | NEW |