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 return codec->getInfo().dimensions(); | 91 if (NULL != codec) { |
| 92 return codec->getInfo().dimensions(); |
| 93 } else { |
| 94 return SkISize::Make(0, 0); |
| 95 } |
92 } | 96 } |
93 | 97 |
94 Name CodecSrc::name() const { | 98 Name CodecSrc::name() const { |
95 return SkOSPath::Basename(fPath.c_str()); | 99 return SkOSPath::Basename(fPath.c_str()); |
96 } | 100 } |
97 | 101 |
98 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 102 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
99 | 103 |
100 ImageSrc::ImageSrc(Path path, int divisor) : fPath(path), fDivisor(divisor) {} | 104 ImageSrc::ImageSrc(Path path, int divisor) : fPath(path), fDivisor(divisor) {} |
101 | 105 |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 surfaces.unrefAll(); | 578 surfaces.unrefAll(); |
575 return ""; | 579 return ""; |
576 } | 580 } |
577 SkISize size() const SK_OVERRIDE { return fSize; } | 581 SkISize size() const SK_OVERRIDE { return fSize; } |
578 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. | 582 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. |
579 } proxy(fW, fH, pic, src.size()); | 583 } proxy(fW, fH, pic, src.size()); |
580 return fSink->draw(proxy, bitmap, stream, log); | 584 return fSink->draw(proxy, bitmap, stream, log); |
581 } | 585 } |
582 | 586 |
583 } // namespace DM | 587 } // namespace DM |
OLD | NEW |