OLD | NEW |
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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 218 } |
219 return SkNEW_ARGS(SkMemoryStream, (data.get())); | 219 return SkNEW_ARGS(SkMemoryStream, (data.get())); |
220 } | 220 } |
221 | 221 |
222 // For every format that supports tile based decoding, ensure that | 222 // For every format that supports tile based decoding, ensure that |
223 // calling decodeSubset will not fail if the caller has unreffed the | 223 // calling decodeSubset will not fail if the caller has unreffed the |
224 // stream provided in buildTileIndex. | 224 // stream provided in buildTileIndex. |
225 // Only runs in debug mode since we are testing for a crash. | 225 // Only runs in debug mode since we are testing for a crash. |
226 static void test_stream_life() { | 226 static void test_stream_life() { |
227 const SkImageEncoder::Type gTypes[] = { | 227 const SkImageEncoder::Type gTypes[] = { |
228 #ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK | 228 #ifdef SK_BUILD_FOR_ANDROID |
229 SkImageEncoder::kJPEG_Type, | 229 SkImageEncoder::kJPEG_Type, |
230 #endif | |
231 #ifdef SK_BUILD_FOR_ANDROID | |
232 SkImageEncoder::kPNG_Type, | 230 SkImageEncoder::kPNG_Type, |
233 #endif | 231 #endif |
234 SkImageEncoder::kWEBP_Type, | 232 SkImageEncoder::kWEBP_Type, |
235 }; | 233 }; |
236 for (size_t i = 0; i < SK_ARRAY_COUNT(gTypes); ++i) { | 234 for (size_t i = 0; i < SK_ARRAY_COUNT(gTypes); ++i) { |
237 SkDebugf("encoding to %i\n", i); | 235 SkDebugf("encoding to %i\n", i); |
238 SkAutoTUnref<SkStream> stream(create_image_stream(gTypes[i])); | 236 SkAutoTUnref<SkStream> stream(create_image_stream(gTypes[i])); |
239 if (NULL == stream.get()) { | 237 if (NULL == stream.get()) { |
240 SkDebugf("no stream\n"); | 238 SkDebugf("no stream\n"); |
241 continue; | 239 continue; |
(...skipping 21 matching lines...) Expand all Loading... |
263 test_unpremul(reporter); | 261 test_unpremul(reporter); |
264 test_pref_config_table(reporter); | 262 test_pref_config_table(reporter); |
265 #ifdef SK_DEBUG | 263 #ifdef SK_DEBUG |
266 test_stream_life(); | 264 test_stream_life(); |
267 #endif | 265 #endif |
268 } | 266 } |
269 | 267 |
270 #include "TestClassDef.h" | 268 #include "TestClassDef.h" |
271 DEFINE_TESTCLASS("ImageDecoding", ImageDecodingTestClass, | 269 DEFINE_TESTCLASS("ImageDecoding", ImageDecodingTestClass, |
272 test_imageDecodingTests) | 270 test_imageDecodingTests) |
OLD | NEW |