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

Side by Side Diff: tests/GifTest.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/FrontBufferedStreamTest.cpp ('k') | tests/SerializationTest.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 "CodecPriv.h" 8 #include "CodecPriv.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkAndroidCodec.h" 10 #include "SkAndroidCodec.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // Regression test for decoding a gif image with sampleSize of 4, which was 191 // Regression test for decoding a gif image with sampleSize of 4, which was
192 // previously crashing. 192 // previously crashing.
193 DEF_TEST(Gif_Sampled, r) { 193 DEF_TEST(Gif_Sampled, r) {
194 SkAutoTDelete<SkFILEStream> stream( 194 SkAutoTDelete<SkFILEStream> stream(
195 new SkFILEStream(GetResourcePath("test640x479.gif").c_str())); 195 new SkFILEStream(GetResourcePath("test640x479.gif").c_str()));
196 REPORTER_ASSERT(r, stream->isValid()); 196 REPORTER_ASSERT(r, stream->isValid());
197 if (!stream->isValid()) { 197 if (!stream->isValid()) {
198 return; 198 return;
199 } 199 }
200 200
201 SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.det ach())); 201 SkAutoTDelete<SkAndroidCodec> codec(SkAndroidCodec::NewFromStream(stream.rel ease()));
202 REPORTER_ASSERT(r, codec); 202 REPORTER_ASSERT(r, codec);
203 if (!codec) { 203 if (!codec) {
204 return; 204 return;
205 } 205 }
206 206
207 // Construct a color table for the decode if necessary 207 // Construct a color table for the decode if necessary
208 SkAutoTUnref<SkColorTable> colorTable(nullptr); 208 SkAutoTUnref<SkColorTable> colorTable(nullptr);
209 SkPMColor* colorPtr = nullptr; 209 SkPMColor* colorPtr = nullptr;
210 int* colorCountPtr = nullptr; 210 int* colorCountPtr = nullptr;
211 int maxColors = 256; 211 int maxColors = 256;
212 if (kIndex_8_SkColorType == codec->getInfo().colorType()) { 212 if (kIndex_8_SkColorType == codec->getInfo().colorType()) {
213 SkPMColor colors[256]; 213 SkPMColor colors[256];
214 colorTable.reset(new SkColorTable(colors, maxColors)); 214 colorTable.reset(new SkColorTable(colors, maxColors));
215 colorPtr = const_cast<SkPMColor*>(colorTable->readColors()); 215 colorPtr = const_cast<SkPMColor*>(colorTable->readColors());
216 colorCountPtr = &maxColors; 216 colorCountPtr = &maxColors;
217 } 217 }
218 218
219 SkAndroidCodec::AndroidOptions options; 219 SkAndroidCodec::AndroidOptions options;
220 options.fSampleSize = 4; 220 options.fSampleSize = 4;
221 options.fColorPtr = colorPtr; 221 options.fColorPtr = colorPtr;
222 options.fColorCount = colorCountPtr; 222 options.fColorCount = colorCountPtr;
223 223
224 SkBitmap bm; 224 SkBitmap bm;
225 bm.allocPixels(codec->getInfo(), nullptr, colorTable.get()); 225 bm.allocPixels(codec->getInfo(), nullptr, colorTable.get());
226 const SkCodec::Result result = codec->getAndroidPixels(codec->getInfo(), bm. getPixels(), 226 const SkCodec::Result result = codec->getAndroidPixels(codec->getInfo(), bm. getPixels(),
227 bm.rowBytes(), &options); 227 bm.rowBytes(), &options);
228 REPORTER_ASSERT(r, result == SkCodec::kSuccess); 228 REPORTER_ASSERT(r, result == SkCodec::kSuccess);
229 } 229 }
OLDNEW
« no previous file with comments | « tests/FrontBufferedStreamTest.cpp ('k') | tests/SerializationTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698