OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 float value = png_inverted_fixed_point_to_float(gamma); | 322 float value = png_inverted_fixed_point_to_float(gamma); |
323 gammas[0] = value; | 323 gammas[0] = value; |
324 gammas[1] = value; | 324 gammas[1] = value; |
325 gammas[2] = value; | 325 gammas[2] = value; |
326 | 326 |
327 return SkColorSpace_Base::NewRGB(gammas, toXYZD50); | 327 return SkColorSpace_Base::NewRGB(gammas, toXYZD50); |
328 } | 328 } |
329 | 329 |
330 // Default to sRGB gamma if the image has color space information, | 330 // Default to sRGB gamma if the image has color space information, |
331 // but does not specify gamma. | 331 // but does not specify gamma. |
332 return SkColorSpace::NewRGB(SkColorSpace::kSRGB_GammaNamed, toXYZD50); | 332 return SkColorSpace::NewRGB(SkColorSpace::kSRGB_RenderTargetGamma, toXYZ
D50); |
333 } | 333 } |
334 | 334 |
335 // Last, check for gamma. | 335 // Last, check for gamma. |
336 if (PNG_INFO_gAMA == png_get_gAMA_fixed(png_ptr, info_ptr, &gamma)) { | 336 if (PNG_INFO_gAMA == png_get_gAMA_fixed(png_ptr, info_ptr, &gamma)) { |
337 | 337 |
338 // Set the gammas. | 338 // Set the gammas. |
339 float value = png_inverted_fixed_point_to_float(gamma); | 339 float value = png_inverted_fixed_point_to_float(gamma); |
340 gammas[0] = value; | 340 gammas[0] = value; |
341 gammas[1] = value; | 341 gammas[1] = value; |
342 gammas[2] = value; | 342 gammas[2] = value; |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 SkCodec* outCodec; | 945 SkCodec* outCodec; |
946 if (read_header(stream, chunkReader, &outCodec, nullptr, nullptr)) { | 946 if (read_header(stream, chunkReader, &outCodec, nullptr, nullptr)) { |
947 // Codec has taken ownership of the stream. | 947 // Codec has taken ownership of the stream. |
948 SkASSERT(outCodec); | 948 SkASSERT(outCodec); |
949 streamDeleter.release(); | 949 streamDeleter.release(); |
950 return outCodec; | 950 return outCodec; |
951 } | 951 } |
952 | 952 |
953 return nullptr; | 953 return nullptr; |
954 } | 954 } |
OLD | NEW |