Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: tests/CodecTest.cpp

Issue 2212493002: Convert SkAutoTUnref<SkData> to sk_sp<SkData>. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/ports/SkImageGeneratorWIC.h ('k') | tests/PDFJpegEmbedTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « src/ports/SkImageGeneratorWIC.h ('k') | tests/PDFJpegEmbedTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698