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

Side by Side Diff: tools/visualize_color_gamut.cpp

Issue 2212493002: Convert SkAutoTUnref<SkData> to sk_sp<SkData>. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « tools/skiaserve/urlhandlers/BreakHandler.cpp ('k') | 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 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 152
153 // Draw gamut for the input image. 153 // Draw gamut for the input image.
154 sk_sp<SkColorSpace> colorSpace = sk_ref_sp(codec->getInfo().colorSpace()); 154 sk_sp<SkColorSpace> colorSpace = sk_ref_sp(codec->getInfo().colorSpace());
155 if (!colorSpace) { 155 if (!colorSpace) {
156 SkDebugf("Image had no embedded color space information. Defaulting to sRGB.\n"); 156 SkDebugf("Image had no embedded color space information. Defaulting to sRGB.\n");
157 colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named); 157 colorSpace = SkColorSpace::NewNamed(SkColorSpace::kSRGB_Named);
158 } 158 }
159 draw_gamut(&canvas, colorSpace->xyz(), input, 0xFF000000, true); 159 draw_gamut(&canvas, colorSpace->xyz(), input, 0xFF000000, true);
160 160
161 // Finally, encode the result to the output file. 161 // Finally, encode the result to the output file.
162 SkAutoTUnref<SkData> out(SkImageEncoder::EncodeData(gamut, SkImageEncoder::k PNG_Type, 100)); 162 sk_sp<SkData> out(SkImageEncoder::EncodeData(gamut, SkImageEncoder::kPNG_Typ e, 100));
163 if (!out) { 163 if (!out) {
164 SkDebugf("Failed to encode gamut output.\n"); 164 SkDebugf("Failed to encode gamut output.\n");
165 return -1; 165 return -1;
166 } 166 }
167 SkFILEWStream stream(output); 167 SkFILEWStream stream(output);
168 bool result = stream.write(out->data(), out->size()); 168 bool result = stream.write(out->data(), out->size());
169 if (!result) { 169 if (!result) {
170 SkDebugf("Failed to write gamut output.\n"); 170 SkDebugf("Failed to write gamut output.\n");
171 return -1; 171 return -1;
172 } 172 }
(...skipping 19 matching lines...) Expand all
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
« no previous file with comments | « tools/skiaserve/urlhandlers/BreakHandler.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698