OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |