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

Side by Side Diff: tests/YUVTest.cpp

Issue 1809733002: detach -> release (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: (C) Created 4 years, 9 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 | « tests/UtilsTest.cpp ('k') | tools/Resources.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 2013 Google Inc. 2 * Copyright 2013 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 "SkCodec.h" 8 #include "SkCodec.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkStream.h" 10 #include "SkStream.h"
11 #include "SkTemplates.h" 11 #include "SkTemplates.h"
12 #include "SkYUVSizeInfo.h" 12 #include "SkYUVSizeInfo.h"
13 #include "Test.h" 13 #include "Test.h"
14 14
15 static SkStreamAsset* resource(const char path[]) { 15 static SkStreamAsset* resource(const char path[]) {
16 SkString fullPath = GetResourcePath(path); 16 SkString fullPath = GetResourcePath(path);
17 return SkStream::NewFromFile(fullPath.c_str()); 17 return SkStream::NewFromFile(fullPath.c_str());
18 } 18 }
19 19
20 static void codec_yuv(skiatest::Reporter* reporter, 20 static void codec_yuv(skiatest::Reporter* reporter,
21 const char path[], 21 const char path[],
22 SkISize expectedSizes[3]) { 22 SkISize expectedSizes[3]) {
23 SkAutoTDelete<SkStream> stream(resource(path)); 23 SkAutoTDelete<SkStream> stream(resource(path));
24 if (!stream) { 24 if (!stream) {
25 INFOF(reporter, "Missing resource '%s'\n", path); 25 INFOF(reporter, "Missing resource '%s'\n", path);
26 return; 26 return;
27 } 27 }
28 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach())); 28 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.release()));
29 REPORTER_ASSERT(reporter, codec); 29 REPORTER_ASSERT(reporter, codec);
30 if (!codec) { 30 if (!codec) {
31 return; 31 return;
32 } 32 }
33 33
34 // Test queryYUV8() 34 // Test queryYUV8()
35 SkYUVSizeInfo info; 35 SkYUVSizeInfo info;
36 bool success = codec->queryYUV8(nullptr, nullptr); 36 bool success = codec->queryYUV8(nullptr, nullptr);
37 REPORTER_ASSERT(reporter, !success); 37 REPORTER_ASSERT(reporter, !success);
38 success = codec->queryYUV8(&info, nullptr); 38 success = codec->queryYUV8(&info, nullptr);
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 codec_yuv(r, "brickwork-texture.jpg", sizes); 122 codec_yuv(r, "brickwork-texture.jpg", sizes);
123 codec_yuv(r, "brickwork_normal-map.jpg", sizes); 123 codec_yuv(r, "brickwork_normal-map.jpg", sizes);
124 124
125 // A CMYK encoded image should fail. 125 // A CMYK encoded image should fail.
126 codec_yuv(r, "CMYK.jpg", nullptr); 126 codec_yuv(r, "CMYK.jpg", nullptr);
127 // A grayscale encoded image should fail. 127 // A grayscale encoded image should fail.
128 codec_yuv(r, "grayscale.jpg", nullptr); 128 codec_yuv(r, "grayscale.jpg", nullptr);
129 // A PNG should fail. 129 // A PNG should fail.
130 codec_yuv(r, "arrow.png", nullptr); 130 codec_yuv(r, "arrow.png", nullptr);
131 } 131 }
OLDNEW
« no previous file with comments | « tests/UtilsTest.cpp ('k') | tools/Resources.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698