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

Side by Side Diff: dm/DM.cpp

Issue 1018953003: Add SkEncodedFormat, used by SkCodec. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use a common enum for SkImageEncoder and SkImageDecoder and SkCodec Created 5 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
OLDNEW
1 #include "CrashHandler.h" 1 #include "CrashHandler.h"
2 #include "DMJsonWriter.h" 2 #include "DMJsonWriter.h"
3 #include "DMSrcSink.h" 3 #include "DMSrcSink.h"
4 #include "DMSrcSinkAndroid.h" 4 #include "DMSrcSinkAndroid.h"
5 #include "OverwriteLine.h" 5 #include "OverwriteLine.h"
6 #include "ProcStats.h" 6 #include "ProcStats.h"
7 #include "SkBBHFactory.h" 7 #include "SkBBHFactory.h"
8 #include "SkChecksum.h" 8 #include "SkChecksum.h"
9 #include "SkCommonFlags.h" 9 #include "SkCommonFlags.h"
10 #include "SkForceLinking.h" 10 #include "SkForceLinking.h"
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 if (bitmap) { 464 if (bitmap) {
465 // We can't encode A8 bitmaps as PNGs. Convert them to 8888 first. 465 // We can't encode A8 bitmaps as PNGs. Convert them to 8888 first.
466 SkBitmap converted; 466 SkBitmap converted;
467 if (bitmap->info().colorType() == kAlpha_8_SkColorType) { 467 if (bitmap->info().colorType() == kAlpha_8_SkColorType) {
468 if (!bitmap->copyTo(&converted, kN32_SkColorType)) { 468 if (!bitmap->copyTo(&converted, kN32_SkColorType)) {
469 fail("Can't convert A8 to 8888.\n"); 469 fail("Can't convert A8 to 8888.\n");
470 return; 470 return;
471 } 471 }
472 bitmap = &converted; 472 bitmap = &converted;
473 } 473 }
474 if (!SkImageEncoder::EncodeStream(&file, *bitmap, SkImageEncoder::kP NG_Type, 100)) { 474 if (!SkImageEncoder::EncodeStream(&file, *bitmap, kPNG_SkEncodedForm at, 100)) {
475 fail(SkStringPrintf("Can't encode PNG to %s.\n", path.c_str())); 475 fail(SkStringPrintf("Can't encode PNG to %s.\n", path.c_str()));
476 return; 476 return;
477 } 477 }
478 } else { 478 } else {
479 if (!file.writeStream(data, len)) { 479 if (!file.writeStream(data, len)) {
480 fail(SkStringPrintf("Can't write to %s.\n", path.c_str())); 480 fail(SkStringPrintf("Can't write to %s.\n", path.c_str()));
481 return; 481 return;
482 } 482 }
483 } 483 }
484 } 484 }
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
642 } 642 }
643 return 0; 643 return 0;
644 } 644 }
645 645
646 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 646 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
647 int main(int argc, char** argv) { 647 int main(int argc, char** argv) {
648 SkCommandLineFlags::Parse(argc, argv); 648 SkCommandLineFlags::Parse(argc, argv);
649 return dm_main(); 649 return dm_main();
650 } 650 }
651 #endif 651 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698