| 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 "Resources.h" | 8 #include "Resources.h" |
| 9 #include "SkAndroidCodec.h" | 9 #include "SkAndroidCodec.h" |
| 10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
| (...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 } | 816 } |
| 817 | 817 |
| 818 private: | 818 private: |
| 819 skiatest::Reporter* fReporter; // Unowned | 819 skiatest::Reporter* fReporter; // Unowned |
| 820 bool fSeen[3]; | 820 bool fSeen[3]; |
| 821 }; | 821 }; |
| 822 | 822 |
| 823 ChunkReader chunkReader(r); | 823 ChunkReader chunkReader(r); |
| 824 | 824 |
| 825 // Now read the file with SkCodec. | 825 // Now read the file with SkCodec. |
| 826 SkAutoTUnref<SkData> data(wStream.copyToData()); | 826 sk_sp<SkData> data(wStream.copyToData()); |
| 827 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data, &chunkReader)); | 827 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data.get(), &chunkReader))
; |
| 828 REPORTER_ASSERT(r, codec); | 828 REPORTER_ASSERT(r, codec); |
| 829 if (!codec) { | 829 if (!codec) { |
| 830 return; | 830 return; |
| 831 } | 831 } |
| 832 | 832 |
| 833 // Now compare to the original. | 833 // Now compare to the original. |
| 834 SkBitmap decodedBm; | 834 SkBitmap decodedBm; |
| 835 decodedBm.setInfo(codec->getInfo()); | 835 decodedBm.setInfo(codec->getInfo()); |
| 836 decodedBm.allocPixels(); | 836 decodedBm.allocPixels(); |
| 837 SkCodec::Result result = codec->getPixels(codec->getInfo(), decodedBm.getPix
els(), | 837 SkCodec::Result result = codec->getPixels(codec->getInfo(), decodedBm.getPix
els(), |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1035 // Perform a sampled decode. | 1035 // Perform a sampled decode. |
| 1036 SkAndroidCodec::AndroidOptions opts; | 1036 SkAndroidCodec::AndroidOptions opts; |
| 1037 opts.fSampleSize = 12; | 1037 opts.fSampleSize = 12; |
| 1038 codec->getAndroidPixels(codec->getInfo().makeWH(width / 12, height / 12), pi
xelStorage.get(), | 1038 codec->getAndroidPixels(codec->getInfo().makeWH(width / 12, height / 12), pi
xelStorage.get(), |
| 1039 rowBytes, &opts); | 1039 rowBytes, &opts); |
| 1040 | 1040 |
| 1041 // Rewind the codec and perform a full image decode. | 1041 // Rewind the codec and perform a full image decode. |
| 1042 SkCodec::Result result = codec->getPixels(codec->getInfo(), pixelStorage.get
(), rowBytes); | 1042 SkCodec::Result result = codec->getPixels(codec->getInfo(), pixelStorage.get
(), rowBytes); |
| 1043 REPORTER_ASSERT(r, SkCodec::kSuccess == result); | 1043 REPORTER_ASSERT(r, SkCodec::kSuccess == result); |
| 1044 } | 1044 } |
| OLD | NEW |