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

Side by Side Diff: dm/DM.cpp

Issue 1332903002: DM: add --key and --properties to PNG description field. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | no next file » | 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 "CrashHandler.h" 8 #include "CrashHandler.h"
9 #include "DMJsonWriter.h" 9 #include "DMJsonWriter.h"
10 #include "DMSrcSink.h" 10 #include "DMSrcSink.h"
(...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 return false; 667 return false;
668 } 668 }
669 669
670 png_infop info = png_create_info_struct(png); 670 png_infop info = png_create_info_struct(png);
671 if (!info) { 671 if (!info) {
672 png_destroy_write_struct(&png, &info); 672 png_destroy_write_struct(&png, &info);
673 fclose(f); 673 fclose(f);
674 return false; 674 return false;
675 } 675 }
676 676
677 SkString description;
678 description.append("Key: ");
679 for (int i = 0; i < FLAGS_key.count(); i++) {
680 description.appendf("%s ", FLAGS_key[i]);
681 }
682 description.append("Properties: ");
683 for (int i = 0; i < FLAGS_properties.count(); i++) {
684 description.appendf("%s ", FLAGS_properties[i]);
685 }
686 description.appendf("MD5: %s", md5);
687
677 png_text text[2]; 688 png_text text[2];
678 text[0].key = (png_charp)"Author"; 689 text[0].key = (png_charp)"Author";
679 text[0].text = (png_charp)"DM dump_png()"; 690 text[0].text = (png_charp)"DM dump_png()";
680 text[0].compression = PNG_TEXT_COMPRESSION_NONE; 691 text[0].compression = PNG_TEXT_COMPRESSION_NONE;
681 text[1].key = (png_charp)"Description"; 692 text[1].key = (png_charp)"Description";
682 text[1].text = (png_charp)md5; 693 text[1].text = (png_charp)description.c_str();
683 text[1].compression = PNG_TEXT_COMPRESSION_NONE; 694 text[1].compression = PNG_TEXT_COMPRESSION_NONE;
684 png_set_text(png, info, text, 2); 695 png_set_text(png, info, text, 2);
685 696
686 png_init_io(png, f); 697 png_init_io(png, f);
687 png_set_IHDR(png, info, (png_uint_32)w, (png_uint_32)h, 8, 698 png_set_IHDR(png, info, (png_uint_32)w, (png_uint_32)h, 8,
688 PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, 699 PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE,
689 PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); 700 PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
690 png_write_info(png, info); 701 png_write_info(png, info);
691 for (int j = 0; j < h; j++) { 702 for (int j = 0; j < h; j++) {
692 png_bytep row = (png_bytep)(rgba.get() + w*j); 703 png_bytep row = (png_bytep)(rgba.get() + w*j);
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 } 1083 }
1073 return 0; 1084 return 0;
1074 } 1085 }
1075 1086
1076 #if !defined(SK_BUILD_FOR_IOS) 1087 #if !defined(SK_BUILD_FOR_IOS)
1077 int main(int argc, char** argv) { 1088 int main(int argc, char** argv) {
1078 SkCommandLineFlags::Parse(argc, argv); 1089 SkCommandLineFlags::Parse(argc, argv);
1079 return dm_main(); 1090 return dm_main();
1080 } 1091 }
1081 #endif 1092 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698