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 "CrashHandler.h" | 8 #include "CrashHandler.h" |
9 #include "DMJsonWriter.h" | 9 #include "DMJsonWriter.h" |
10 #include "DMSrcSink.h" | 10 #include "DMSrcSink.h" |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 break; | 237 break; |
238 case CodecSrc::kScanline_Mode: | 238 case CodecSrc::kScanline_Mode: |
239 folder.append("scanline"); | 239 folder.append("scanline"); |
240 break; | 240 break; |
241 case CodecSrc::kStripe_Mode: | 241 case CodecSrc::kStripe_Mode: |
242 folder.append("stripe"); | 242 folder.append("stripe"); |
243 break; | 243 break; |
244 case CodecSrc::kSubset_Mode: | 244 case CodecSrc::kSubset_Mode: |
245 folder.append("codec_subset"); | 245 folder.append("codec_subset"); |
246 break; | 246 break; |
| 247 case CodecSrc::kGen_Mode: |
| 248 folder.append("gen"); |
| 249 break; |
247 } | 250 } |
248 | 251 |
249 switch (dstColorType) { | 252 switch (dstColorType) { |
250 case CodecSrc::kGrayscale_Always_DstColorType: | 253 case CodecSrc::kGrayscale_Always_DstColorType: |
251 folder.append("_kGray8"); | 254 folder.append("_kGray8"); |
252 break; | 255 break; |
253 case CodecSrc::kIndex8_Always_DstColorType: | 256 case CodecSrc::kIndex8_Always_DstColorType: |
254 folder.append("_kIndex8"); | 257 folder.append("_kIndex8"); |
255 break; | 258 break; |
256 default: | 259 default: |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 return; | 311 return; |
309 } | 312 } |
310 | 313 |
311 // Native Scales | 314 // Native Scales |
312 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co
mpare with these | 315 // TODO (msarett): Implement scaling tests for SkImageDecoder in order to co
mpare with these |
313 // tests. SkImageDecoder supports downscales by integer fac
tors. | 316 // tests. SkImageDecoder supports downscales by integer fac
tors. |
314 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625,
0.75, 0.875 | 317 // SkJpegCodec natively supports scaling to: 0.125, 0.25, 0.375, 0.5, 0.625,
0.75, 0.875 |
315 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f,
0.875f, 1.0f }; | 318 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f,
0.875f, 1.0f }; |
316 | 319 |
317 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kCod
ecZeroInit_Mode, | 320 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kCod
ecZeroInit_Mode, |
318 CodecSrc::kScanline_Mode, CodecSrc::kStripe_Mode, CodecSrc::kSubset_
Mode }; | 321 CodecSrc::kScanline_Mode, CodecSrc::kStripe_Mode, CodecSrc::kSubset_
Mode, |
| 322 CodecSrc::kGen_Mode }; |
319 | 323 |
320 CodecSrc::DstColorType colorTypes[3]; | 324 CodecSrc::DstColorType colorTypes[3]; |
321 uint32_t numColorTypes; | 325 uint32_t numColorTypes; |
322 switch (codec->getInfo().colorType()) { | 326 switch (codec->getInfo().colorType()) { |
323 case kGray_8_SkColorType: | 327 case kGray_8_SkColorType: |
324 // FIXME: Is this a long term solution for testing wbmps decodes to
kIndex8? | 328 // FIXME: Is this a long term solution for testing wbmps decodes to
kIndex8? |
325 // Further discussion on this topic is at https://bug.skia.org/3683
. | 329 // Further discussion on this topic is at https://bug.skia.org/3683
. |
326 // This causes us to try to convert grayscale jpegs to kIndex8. We
currently | 330 // This causes us to try to convert grayscale jpegs to kIndex8. We
currently |
327 // fail non-fatally in this case. | 331 // fail non-fatally in this case. |
328 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 332 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
329 colorTypes[1] = CodecSrc::kGrayscale_Always_DstColorType; | 333 colorTypes[1] = CodecSrc::kGrayscale_Always_DstColorType; |
330 colorTypes[2] = CodecSrc::kIndex8_Always_DstColorType; | 334 colorTypes[2] = CodecSrc::kIndex8_Always_DstColorType; |
331 numColorTypes = 3; | 335 numColorTypes = 3; |
332 break; | 336 break; |
333 case kIndex_8_SkColorType: | 337 case kIndex_8_SkColorType: |
334 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 338 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
335 colorTypes[1] = CodecSrc::kIndex8_Always_DstColorType; | 339 colorTypes[1] = CodecSrc::kIndex8_Always_DstColorType; |
336 numColorTypes = 2; | 340 numColorTypes = 2; |
337 break; | 341 break; |
338 default: | 342 default: |
339 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 343 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
340 numColorTypes = 1; | 344 numColorTypes = 1; |
341 break; | 345 break; |
342 } | 346 } |
343 | 347 |
344 for (float scale : nativeScales) { | 348 |
345 for (CodecSrc::Mode mode : nativeModes) { | 349 for (CodecSrc::Mode mode : nativeModes) { |
| 350 // SkCodecImageGenerator only runs for the default colorType |
| 351 // recommended by SkCodec. There is no need to generate multiple |
| 352 // tests for different colorTypes. |
| 353 // TODO (msarett): Add scaling support to SkCodecImageGenerator. |
| 354 if (CodecSrc::kGen_Mode == mode) { |
| 355 // FIXME: The gpu backend does not draw kGray sources correctly. (sk
bug.com/4822) |
| 356 if (kGray_8_SkColorType != codec->getInfo().colorType()) { |
| 357 push_codec_src(path, mode, CodecSrc::kGetFromCanvas_DstColorType
, 1.0f); |
| 358 } |
| 359 continue; |
| 360 } |
| 361 |
| 362 for (float scale : nativeScales) { |
346 for (uint32_t i = 0; i < numColorTypes; i++) { | 363 for (uint32_t i = 0; i < numColorTypes; i++) { |
347 push_codec_src(path, mode, colorTypes[i], scale); | 364 push_codec_src(path, mode, colorTypes[i], scale); |
348 } | 365 } |
349 } | 366 } |
350 } | 367 } |
351 | 368 |
352 // https://bug.skia.org/4428 | 369 // https://bug.skia.org/4428 |
353 bool subset = false; | 370 bool subset = false; |
354 // The following image types are supported by BitmapRegionDecoder, | 371 // The following image types are supported by BitmapRegionDecoder, |
355 // so we will test full image decodes and subset decodes. | 372 // so we will test full image decodes and subset decodes. |
(...skipping 887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1243 Reporter* reporter, | 1260 Reporter* reporter, |
1244 GrContextFactory* fac
tory); | 1261 GrContextFactory* fac
tory); |
1245 } // namespace skiatest | 1262 } // namespace skiatest |
1246 | 1263 |
1247 #if !defined(SK_BUILD_FOR_IOS) | 1264 #if !defined(SK_BUILD_FOR_IOS) |
1248 int main(int argc, char** argv) { | 1265 int main(int argc, char** argv) { |
1249 SkCommandLineFlags::Parse(argc, argv); | 1266 SkCommandLineFlags::Parse(argc, argv); |
1250 return dm_main(); | 1267 return dm_main(); |
1251 } | 1268 } |
1252 #endif | 1269 #endif |
OLD | NEW |