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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 draw_gamut(&canvas, sRGBSpace->xyz(), "sRGB", 0xFFFF9394, false); | 144 draw_gamut(&canvas, sRGBSpace->xyz(), "sRGB", 0xFFFF9394, false); |
145 } | 145 } |
146 | 146 |
147 // Draw the Adobe RGB gamut if requested. | 147 // Draw the Adobe RGB gamut if requested. |
148 if (FLAGS_adobeRGB) { | 148 if (FLAGS_adobeRGB) { |
149 sk_sp<SkColorSpace> adobeRGBSpace = SkColorSpace::NewNamed(SkColorSpace:
:kAdobeRGB_Named); | 149 sk_sp<SkColorSpace> adobeRGBSpace = SkColorSpace::NewNamed(SkColorSpace:
:kAdobeRGB_Named); |
150 draw_gamut(&canvas, adobeRGBSpace->xyz(), "Adobe RGB", 0xFF31a9e1, false
); | 150 draw_gamut(&canvas, adobeRGBSpace->xyz(), "Adobe RGB", 0xFF31a9e1, false
); |
151 } | 151 } |
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->getColorSpace()); | 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 SkAutoTUnref<SkData> out(SkImageEncoder::EncodeData(gamut, SkImageEncoder::k
PNG_Type, 100)); |
163 if (!out) { | 163 if (!out) { |
164 SkDebugf("Failed to encode gamut output.\n"); | 164 SkDebugf("Failed to encode gamut output.\n"); |
(...skipping 27 matching lines...) Expand all 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 |