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

Side by Side Diff: tools/visualize_color_gamut.cpp

Issue 2206633004: Move off SK_SUPPORT_LEGACY_DATA_FACTORIES. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Gotta catch 'em all. Created 4 years, 4 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 /* 1 /*
2 * Copyright 2016 Google Inc. 2 * Copyright 2016 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 "Resources.h" 8 #include "Resources.h"
9 9
10 #include "SkBitmap.h" 10 #include "SkBitmap.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 "Also, if a path is provided, writes uncorrected bytes to an unmarked " 112 "Also, if a path is provided, writes uncorrected bytes to an unmarked "
113 "png, for comparison with the input image.\n"); 113 "png, for comparison with the input image.\n");
114 SkCommandLineFlags::Parse(argc, argv); 114 SkCommandLineFlags::Parse(argc, argv);
115 const char* input = FLAGS_input[0]; 115 const char* input = FLAGS_input[0];
116 const char* output = FLAGS_output[0]; 116 const char* output = FLAGS_output[0];
117 if (!input || !output) { 117 if (!input || !output) {
118 SkCommandLineFlags::PrintUsage(); 118 SkCommandLineFlags::PrintUsage();
119 return -1; 119 return -1;
120 } 120 }
121 121
122 SkAutoTUnref<SkData> data(SkData::NewFromFileName(input)); 122 sk_sp<SkData> data(SkData::MakeFromFileName(input));
123 if (!data) { 123 if (!data) {
124 SkDebugf("Cannot find input image.\n"); 124 SkDebugf("Cannot find input image.\n");
125 return -1; 125 return -1;
126 } 126 }
127 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data)); 127 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data.get()));
128 if (!codec) { 128 if (!codec) {
129 SkDebugf("Invalid input image.\n"); 129 SkDebugf("Invalid input image.\n");
130 return -1; 130 return -1;
131 } 131 }
132 132
133 // Load a graph of the CIE XYZ color gamut. 133 // Load a graph of the CIE XYZ color gamut.
134 SkBitmap gamut; 134 SkBitmap gamut;
135 if (!GetResourceAsBitmap("gamut.png", &gamut)) { 135 if (!GetResourceAsBitmap("gamut.png", &gamut)) {
136 SkDebugf("Program failure.\n"); 136 SkDebugf("Program failure.\n");
137 return -1; 137 return -1;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 SkFILEWStream bitmapStream(FLAGS_uncorrected[0]); 192 SkFILEWStream bitmapStream(FLAGS_uncorrected[0]);
193 result = bitmapStream.write(out->data(), out->size()); 193 result = bitmapStream.write(out->data(), out->size());
194 if (!result) { 194 if (!result) {
195 SkDebugf("Failed to write uncorrected image output.\n"); 195 SkDebugf("Failed to write uncorrected image output.\n");
196 return -1; 196 return -1;
197 } 197 }
198 } 198 }
199 199
200 return 0; 200 return 0;
201 } 201 }
OLDNEW
« include/core/SkData.h ('K') | « tools/skiaserve/urlhandlers/InfoHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698