| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 return Error::Nonfatal("Uninteresting to decode image with alpha
into 565."); | 134 return Error::Nonfatal("Uninteresting to decode image with alpha
into 565."); |
| 135 } | 135 } |
| 136 canvas->drawBitmap(subset, SkIntToScalar(x), SkIntToScalar(y)); | 136 canvas->drawBitmap(subset, SkIntToScalar(x), SkIntToScalar(y)); |
| 137 } | 137 } |
| 138 } | 138 } |
| 139 return ""; | 139 return ""; |
| 140 } | 140 } |
| 141 | 141 |
| 142 SkISize ImageSrc::size() const { | 142 SkISize ImageSrc::size() const { |
| 143 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); | 143 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
| 144 if (FLAGS_codec) { | 144 SkBitmap bitmap; |
| 145 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(encoded)); | 145 if (!encoded || !SkImageDecoder::DecodeMemory(encoded->data(), |
| 146 if (!codec) { | 146 encoded->size(), |
| 147 return SkISize::Make(0,0); | 147 &bitmap, |
| 148 } | 148 kUnknown_SkColorType, |
| 149 SkImageInfo info; | 149 SkImageDecoder::kDecodeBounds_
Mode)) { |
| 150 if (!codec->getInfo(&info)) { | 150 return SkISize::Make(0,0); |
| 151 return SkISize::Make(0,0); | |
| 152 } | |
| 153 return info.dimensions(); | |
| 154 } else { | |
| 155 SkBitmap bitmap; | |
| 156 if (!encoded || !SkImageDecoder::DecodeMemory(encoded->data(), | |
| 157 encoded->size(), | |
| 158 &bitmap, | |
| 159 kUnknown_SkColorType, | |
| 160 SkImageDecoder::kDecodeBou
nds_Mode)) { | |
| 161 return SkISize::Make(0,0); | |
| 162 } | |
| 163 return bitmap.dimensions(); | |
| 164 } | 151 } |
| 152 return bitmap.dimensions(); |
| 165 } | 153 } |
| 166 | 154 |
| 167 Name ImageSrc::name() const { | 155 Name ImageSrc::name() const { |
| 168 return SkOSPath::Basename(fPath.c_str()); | 156 return SkOSPath::Basename(fPath.c_str()); |
| 169 } | 157 } |
| 170 | 158 |
| 171 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 159 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 172 | 160 |
| 173 static const SkRect kSKPViewport = {0,0, 1000,1000}; | 161 static const SkRect kSKPViewport = {0,0, 1000,1000}; |
| 174 | 162 |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 surfaces.unrefAll(); | 545 surfaces.unrefAll(); |
| 558 return ""; | 546 return ""; |
| 559 } | 547 } |
| 560 SkISize size() const SK_OVERRIDE { return fSize; } | 548 SkISize size() const SK_OVERRIDE { return fSize; } |
| 561 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. | 549 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. |
| 562 } proxy(fW, fH, pic, src.size()); | 550 } proxy(fW, fH, pic, src.size()); |
| 563 return fSink->draw(proxy, bitmap, stream, log); | 551 return fSink->draw(proxy, bitmap, stream, log); |
| 564 } | 552 } |
| 565 | 553 |
| 566 } // namespace DM | 554 } // namespace DM |
| OLD | NEW |