| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "DMSrcSink.h" | 8 #include "DMSrcSink.h" |
| 9 #include "SamplePipeControllers.h" | 9 #include "SamplePipeControllers.h" |
| 10 #include "SkCodec.h" | 10 #include "SkCodec.h" |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 left += decodeInfo.width(); | 634 left += decodeInfo.width(); |
| 635 } | 635 } |
| 636 return ""; | 636 return ""; |
| 637 } | 637 } |
| 638 } | 638 } |
| 639 return ""; | 639 return ""; |
| 640 } | 640 } |
| 641 | 641 |
| 642 SkISize CodecSrc::size() const { | 642 SkISize CodecSrc::size() const { |
| 643 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); | 643 SkAutoTUnref<SkData> encoded(SkData::NewFromFileName(fPath.c_str())); |
| 644 SkAutoTDelete<SkCodec> codec(SkScaledCodec::NewFromData(encoded)); | 644 SkAutoTDelete<SkCodec> codec(nullptr); |
| 645 |
| 646 if (kScaledCodec_Mode == fMode) { |
| 647 codec.reset(SkScaledCodec::NewFromData(encoded)); |
| 648 } else { |
| 649 codec.reset(SkCodec::NewFromData(encoded)); |
| 650 } |
| 651 |
| 645 if (nullptr == codec) { | 652 if (nullptr == codec) { |
| 646 // scaledCodec not supported, try regular codec | 653 return SkISize::Make(0, 0); |
| 647 codec.reset(SkCodec::NewFromData(encoded)); | |
| 648 if (nullptr == codec) { | |
| 649 return SkISize::Make(0, 0); | |
| 650 } | |
| 651 } | 654 } |
| 652 SkISize size = codec->getScaledDimensions(fScale); | 655 return codec->getScaledDimensions(fScale); |
| 653 return size; | |
| 654 } | 656 } |
| 655 | 657 |
| 656 Name CodecSrc::name() const { | 658 Name CodecSrc::name() const { |
| 657 if (1.0f == fScale) { | 659 if (1.0f == fScale) { |
| 658 return SkOSPath::Basename(fPath.c_str()); | 660 return SkOSPath::Basename(fPath.c_str()); |
| 659 } | 661 } |
| 660 return get_scaled_name(fPath, fScale); | 662 return get_scaled_name(fPath, fScale); |
| 661 } | 663 } |
| 662 | 664 |
| 663 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 665 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1255 skr.visit<void>(i, drawsAsSingletonPictures); | 1257 skr.visit<void>(i, drawsAsSingletonPictures); |
| 1256 } | 1258 } |
| 1257 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); | 1259 SkAutoTUnref<SkPicture> macroPic(macroRec.endRecordingAsPicture()); |
| 1258 | 1260 |
| 1259 canvas->drawPicture(macroPic); | 1261 canvas->drawPicture(macroPic); |
| 1260 return ""; | 1262 return ""; |
| 1261 }); | 1263 }); |
| 1262 } | 1264 } |
| 1263 | 1265 |
| 1264 } // namespace DM | 1266 } // namespace DM |
| OLD | NEW |