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

Side by Side Diff: dm/DM.cpp

Issue 2045293002: Add support for multiple frames in SkCodec (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix a test - we now draw transparent background for missing color table Created 4 years, 1 month 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 | « cmake/CMakeLists.txt ('k') | dm/DMSrcSink.h » ('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 "DMJsonWriter.h" 8 #include "DMJsonWriter.h"
9 #include "DMSrcSink.h" 9 #include "DMSrcSink.h"
10 #include "DMSrcSinkAndroid.h" 10 #include "DMSrcSinkAndroid.h"
(...skipping 18 matching lines...) Expand all
29 #include "SkSpinlock.h" 29 #include "SkSpinlock.h"
30 #include "SkTHash.h" 30 #include "SkTHash.h"
31 #include "SkTaskGroup.h" 31 #include "SkTaskGroup.h"
32 #include "SkThreadUtils.h" 32 #include "SkThreadUtils.h"
33 #include "Test.h" 33 #include "Test.h"
34 #include "Timer.h" 34 #include "Timer.h"
35 #include "picture_utils.h" 35 #include "picture_utils.h"
36 #include "sk_tool_utils.h" 36 #include "sk_tool_utils.h"
37 #include "SkScan.h" 37 #include "SkScan.h"
38 38
39 #include <vector>
40
39 #ifdef SK_PDF_IMAGE_STATS 41 #ifdef SK_PDF_IMAGE_STATS
40 extern void SkPDFImageDumpStats(); 42 extern void SkPDFImageDumpStats();
41 #endif 43 #endif
42 44
43 #include "png.h" 45 #include "png.h"
44 46
45 #include <stdlib.h> 47 #include <stdlib.h>
46 48
47 #ifndef SK_BUILD_FOR_WIN32 49 #ifndef SK_BUILD_FOR_WIN32
48 #include <unistd.h> 50 #include <unistd.h>
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 TaggedSrc& s = gSrcs.push_back(); 352 TaggedSrc& s = gSrcs.push_back();
351 s.reset(src.release()); 353 s.reset(src.release());
352 s.tag = tag; 354 s.tag = tag;
353 s.options = options; 355 s.options = options;
354 } 356 }
355 } 357 }
356 358
357 static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorTyp e dstColorType, 359 static void push_codec_src(Path path, CodecSrc::Mode mode, CodecSrc::DstColorTyp e dstColorType,
358 SkAlphaType dstAlphaType, float scale) { 360 SkAlphaType dstAlphaType, float scale) {
359 if (FLAGS_simpleCodec) { 361 if (FLAGS_simpleCodec) {
360 if (mode != CodecSrc::kCodec_Mode || dstColorType != CodecSrc::kGetFromC anvas_DstColorType 362 const bool simple = CodecSrc::kCodec_Mode == mode || CodecSrc::kAnimated _Mode == mode;
361 || scale != 1.0f) 363 if (!simple || dstColorType != CodecSrc::kGetFromCanvas_DstColorType || scale != 1.0f) {
362 // Only decode in the simple case. 364 // Only decode in the simple case.
363 return; 365 return;
366 }
364 } 367 }
365 SkString folder; 368 SkString folder;
366 switch (mode) { 369 switch (mode) {
367 case CodecSrc::kCodec_Mode: 370 case CodecSrc::kCodec_Mode:
368 folder.append("codec"); 371 folder.append("codec");
369 break; 372 break;
370 case CodecSrc::kCodecZeroInit_Mode: 373 case CodecSrc::kCodecZeroInit_Mode:
371 folder.append("codec_zero_init"); 374 folder.append("codec_zero_init");
372 break; 375 break;
373 case CodecSrc::kScanline_Mode: 376 case CodecSrc::kScanline_Mode:
374 folder.append("scanline"); 377 folder.append("scanline");
375 break; 378 break;
376 case CodecSrc::kStripe_Mode: 379 case CodecSrc::kStripe_Mode:
377 folder.append("stripe"); 380 folder.append("stripe");
378 break; 381 break;
379 case CodecSrc::kCroppedScanline_Mode: 382 case CodecSrc::kCroppedScanline_Mode:
380 folder.append("crop"); 383 folder.append("crop");
381 break; 384 break;
382 case CodecSrc::kSubset_Mode: 385 case CodecSrc::kSubset_Mode:
383 folder.append("codec_subset"); 386 folder.append("codec_subset");
384 break; 387 break;
388 case CodecSrc::kAnimated_Mode:
389 folder.append("codec_animated");
390 break;
385 } 391 }
386 392
387 switch (dstColorType) { 393 switch (dstColorType) {
388 case CodecSrc::kGrayscale_Always_DstColorType: 394 case CodecSrc::kGrayscale_Always_DstColorType:
389 folder.append("_kGray8"); 395 folder.append("_kGray8");
390 break; 396 break;
391 case CodecSrc::kIndex8_Always_DstColorType: 397 case CodecSrc::kIndex8_Always_DstColorType:
392 folder.append("_kIndex8"); 398 folder.append("_kIndex8");
393 break; 399 break;
394 case CodecSrc::kNonNative8888_Always_DstColorType: 400 case CodecSrc::kNonNative8888_Always_DstColorType:
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 // Native Scales 573 // Native Scales
568 // SkJpegCodec natively supports scaling to the following: 574 // SkJpegCodec natively supports scaling to the following:
569 for (auto scale : { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.7 50f, 0.875f }) { 575 for (auto scale : { 0.125f, 0.25f, 0.375f, 0.5f, 0.625f, 0.7 50f, 0.875f }) {
570 push_codec_src(path, mode, colorType, alphaType, scale); 576 push_codec_src(path, mode, colorType, alphaType, scale);
571 } 577 }
572 } 578 }
573 } 579 }
574 } 580 }
575 } 581 }
576 582
583 {
584 std::vector<SkCodec::FrameInfo> frameInfos = codec->getFrameInfo();
585 if (frameInfos.size() > 1) {
586 push_codec_src(path, CodecSrc::kAnimated_Mode, CodecSrc::kGetFromCan vas_DstColorType,
587 kPremul_SkAlphaType, 1.0f);
588 }
589
590 }
591
577 if (FLAGS_simpleCodec) { 592 if (FLAGS_simpleCodec) {
578 return; 593 return;
579 } 594 }
580 595
581 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 }; 596 const int sampleSizes[] = { 1, 2, 3, 4, 5, 6, 7, 8 };
582 597
583 for (int sampleSize : sampleSizes) { 598 for (int sampleSize : sampleSizes) {
584 for (CodecSrc::DstColorType colorType : colorTypes) { 599 for (CodecSrc::DstColorType colorType : colorTypes) {
585 for (SkAlphaType alphaType : alphaModes) { 600 for (SkAlphaType alphaType : alphaModes) {
586 // We can exercise all of the kNonNative support code in the swi zzler with just a 601 // We can exercise all of the kNonNative support code in the swi zzler with just a
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 #endif 1442 #endif
1428 } 1443 }
1429 } // namespace skiatest 1444 } // namespace skiatest
1430 1445
1431 #if !defined(SK_BUILD_FOR_IOS) 1446 #if !defined(SK_BUILD_FOR_IOS)
1432 int main(int argc, char** argv) { 1447 int main(int argc, char** argv) {
1433 SkCommandLineFlags::Parse(argc, argv); 1448 SkCommandLineFlags::Parse(argc, argv);
1434 return dm_main(); 1449 return dm_main();
1435 } 1450 }
1436 #endif 1451 #endif
OLDNEW
« no previous file with comments | « cmake/CMakeLists.txt ('k') | dm/DMSrcSink.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698