| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/gfx/color_space.h" | 5 #include "ui/gfx/color_space.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <sstream> | 8 #include <sstream> |
| 9 | 9 |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 return SkColorSpace::MakeSRGB(); | 400 return SkColorSpace::MakeSRGB(); |
| 401 if (transfer_ == TransferID::LINEAR || transfer_ == TransferID::LINEAR_HDR) | 401 if (transfer_ == TransferID::LINEAR || transfer_ == TransferID::LINEAR_HDR) |
| 402 return SkColorSpace::MakeSRGBLinear(); | 402 return SkColorSpace::MakeSRGBLinear(); |
| 403 } | 403 } |
| 404 | 404 |
| 405 SkMatrix44 to_xyz_d50; | 405 SkMatrix44 to_xyz_d50; |
| 406 GetPrimaryMatrix(&to_xyz_d50); | 406 GetPrimaryMatrix(&to_xyz_d50); |
| 407 | 407 |
| 408 // Use the named sRGB and linear transfer functions. | 408 // Use the named sRGB and linear transfer functions. |
| 409 if (transfer_ == TransferID::IEC61966_2_1) { | 409 if (transfer_ == TransferID::IEC61966_2_1) { |
| 410 return SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma, |
| 411 to_xyz_d50); |
| 412 } |
| 413 if (transfer_ == TransferID::LINEAR || transfer_ == TransferID::LINEAR_HDR) { |
| 410 return SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma, | 414 return SkColorSpace::MakeRGB(SkColorSpace::kLinear_RenderTargetGamma, |
| 411 to_xyz_d50); | 415 to_xyz_d50); |
| 412 } | 416 } |
| 413 if (transfer_ == TransferID::LINEAR || transfer_ == TransferID::LINEAR_HDR) { | |
| 414 return SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma, | |
| 415 to_xyz_d50); | |
| 416 } | |
| 417 | 417 |
| 418 // Use the parametric transfer function if no other option is available. | 418 // Use the parametric transfer function if no other option is available. |
| 419 SkColorSpaceTransferFn fn; | 419 SkColorSpaceTransferFn fn; |
| 420 if (!GetTransferFunction(&fn)) { | 420 if (!GetTransferFunction(&fn)) { |
| 421 DLOG(ERROR) << "Failed to parameterize transfer function for SkColorSpace"; | 421 DLOG(ERROR) << "Failed to parameterize transfer function for SkColorSpace"; |
| 422 return nullptr; | 422 return nullptr; |
| 423 } | 423 } |
| 424 return SkColorSpace::MakeRGB(fn, to_xyz_d50); | 424 return SkColorSpace::MakeRGB(fn, to_xyz_d50); |
| 425 } | 425 } |
| 426 | 426 |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 matrix->postTranslate(-16.0f/219.0f, -15.5f/224.0f, -15.5f/224.0f); | 812 matrix->postTranslate(-16.0f/219.0f, -15.5f/224.0f, -15.5f/224.0f); |
| 813 break; | 813 break; |
| 814 } | 814 } |
| 815 } | 815 } |
| 816 | 816 |
| 817 std::ostream& operator<<(std::ostream& out, const ColorSpace& color_space) { | 817 std::ostream& operator<<(std::ostream& out, const ColorSpace& color_space) { |
| 818 return out << color_space.ToString(); | 818 return out << color_space.ToString(); |
| 819 } | 819 } |
| 820 | 820 |
| 821 } // namespace gfx | 821 } // namespace gfx |
| OLD | NEW |