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 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f,
0.875f, 1.0f }; | 311 const float nativeScales[] = { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.750f,
0.875f, 1.0f }; |
312 | 312 |
313 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kSca
nline_Mode, | 313 const CodecSrc::Mode nativeModes[] = { CodecSrc::kCodec_Mode, CodecSrc::kSca
nline_Mode, |
314 CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode, CodecSrc::k
Subset_Mode }; | 314 CodecSrc::kScanline_Subset_Mode, CodecSrc::kStripe_Mode, CodecSrc::k
Subset_Mode }; |
315 | 315 |
316 CodecSrc::DstColorType colorTypes[3]; | 316 CodecSrc::DstColorType colorTypes[3]; |
317 uint32_t numColorTypes; | 317 uint32_t numColorTypes; |
318 switch (codec->getInfo().colorType()) { | 318 switch (codec->getInfo().colorType()) { |
319 case kGray_8_SkColorType: | 319 case kGray_8_SkColorType: |
320 // FIXME: Is this a long term solution for testing wbmps decodes to
kIndex8? | 320 // FIXME: Is this a long term solution for testing wbmps decodes to
kIndex8? |
321 // Further discussion on this topic is at skbug.com/3683. | 321 // Further discussion on this topic is at https://bug.skia.org/3683
. |
322 // This causes us to try to convert grayscale jpegs to kIndex8. We
currently | 322 // This causes us to try to convert grayscale jpegs to kIndex8. We
currently |
323 // fail non-fatally in this case. | 323 // fail non-fatally in this case. |
324 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 324 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
325 colorTypes[1] = CodecSrc::kGrayscale_Always_DstColorType; | 325 colorTypes[1] = CodecSrc::kGrayscale_Always_DstColorType; |
326 colorTypes[2] = CodecSrc::kIndex8_Always_DstColorType; | 326 colorTypes[2] = CodecSrc::kIndex8_Always_DstColorType; |
327 numColorTypes = 3; | 327 numColorTypes = 3; |
328 break; | 328 break; |
329 case kIndex_8_SkColorType: | 329 case kIndex_8_SkColorType: |
330 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 330 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
331 colorTypes[1] = CodecSrc::kIndex8_Always_DstColorType; | 331 colorTypes[1] = CodecSrc::kIndex8_Always_DstColorType; |
332 numColorTypes = 2; | 332 numColorTypes = 2; |
333 break; | 333 break; |
334 default: | 334 default: |
335 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; | 335 colorTypes[0] = CodecSrc::kGetFromCanvas_DstColorType; |
336 numColorTypes = 1; | 336 numColorTypes = 1; |
337 break; | 337 break; |
338 } | 338 } |
339 | 339 |
340 for (float scale : nativeScales) { | 340 for (float scale : nativeScales) { |
341 for (CodecSrc::Mode mode : nativeModes) { | 341 for (CodecSrc::Mode mode : nativeModes) { |
342 for (uint32_t i = 0; i < numColorTypes; i++) { | 342 for (uint32_t i = 0; i < numColorTypes; i++) { |
343 push_codec_src(path, mode, colorTypes[i], scale); | 343 push_codec_src(path, mode, colorTypes[i], scale); |
344 } | 344 } |
345 } | 345 } |
346 } | 346 } |
347 | 347 |
348 // skbug.com/4428 | 348 // https://bug.skia.org/4428 |
349 static const char* const exts[] = { | 349 static const char* const exts[] = { |
350 "jpg", "jpeg", "png", "webp", | 350 "jpg", "jpeg", "png", "webp", |
351 "JPG", "JPEG", "PNG", "WEBP", | 351 "JPG", "JPEG", "PNG", "WEBP", |
352 }; | 352 }; |
353 bool supported = false; | 353 bool supported = false; |
354 for (const char* ext : exts) { | 354 for (const char* ext : exts) { |
355 if (path.endsWith(ext)) { | 355 if (path.endsWith(ext)) { |
356 supported = true; | 356 supported = true; |
357 break; | 357 break; |
358 } | 358 } |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1164 #endif // SK_PDF_IMAGE_STATS | 1164 #endif // SK_PDF_IMAGE_STATS |
1165 return 0; | 1165 return 0; |
1166 } | 1166 } |
1167 | 1167 |
1168 #if !defined(SK_BUILD_FOR_IOS) | 1168 #if !defined(SK_BUILD_FOR_IOS) |
1169 int main(int argc, char** argv) { | 1169 int main(int argc, char** argv) { |
1170 SkCommandLineFlags::Parse(argc, argv); | 1170 SkCommandLineFlags::Parse(argc, argv); |
1171 return dm_main(); | 1171 return dm_main(); |
1172 } | 1172 } |
1173 #endif | 1173 #endif |
OLD | NEW |