| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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_transform.h" | 5 #include "ui/gfx/color_transform.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 xyz.blue.Y = 1.0f; | 679 xyz.blue.Y = 1.0f; |
| 680 w.x = 0.34567f; | 680 w.x = 0.34567f; |
| 681 w.y = 0.35850f; | 681 w.y = 0.35850f; |
| 682 w.Y = 1.0f; | 682 w.Y = 1.0f; |
| 683 return ScopedQcmsProfile(qcms_profile_create_rgb_with_gamma(w, xyz, 1.0f)); | 683 return ScopedQcmsProfile(qcms_profile_create_rgb_with_gamma(w, xyz, 1.0f)); |
| 684 } | 684 } |
| 685 | 685 |
| 686 ColorTransformInternal::ColorTransformInternal(const ColorSpace& from, | 686 ColorTransformInternal::ColorTransformInternal(const ColorSpace& from, |
| 687 const ColorSpace& to, | 687 const ColorSpace& to, |
| 688 Intent intent) { | 688 Intent intent) { |
| 689 // If no source color space is specified, do no transformation. |
| 690 // TODO(ccameron): We may want to assume sRGB at some point in the future. |
| 691 if (!from.IsValid()) |
| 692 return; |
| 693 |
| 689 ScopedQcmsProfile from_profile = GetQCMSProfileIfAvailable(from); | 694 ScopedQcmsProfile from_profile = GetQCMSProfileIfAvailable(from); |
| 690 ScopedQcmsProfile to_profile = GetQCMSProfileIfAvailable(to); | 695 ScopedQcmsProfile to_profile = GetQCMSProfileIfAvailable(to); |
| 691 bool has_from_profile = !!from_profile; | 696 bool has_from_profile = !!from_profile; |
| 692 bool has_to_profile = !!to_profile; | 697 bool has_to_profile = !!to_profile; |
| 693 | 698 |
| 694 if (from_profile) { | 699 if (from_profile) { |
| 695 steps_.push_back(base::MakeUnique<QCMSColorTransform>( | 700 steps_.push_back(base::MakeUnique<QCMSColorTransform>( |
| 696 std::move(from_profile), GetXYZD50Profile())); | 701 std::move(from_profile), GetXYZD50Profile())); |
| 697 } | 702 } |
| 698 | 703 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 748 const ColorSpace& to, | 753 const ColorSpace& to, |
| 749 Intent intent) { | 754 Intent intent) { |
| 750 return std::unique_ptr<ColorTransform>( | 755 return std::unique_ptr<ColorTransform>( |
| 751 new ColorTransformInternal(from, to, intent)); | 756 new ColorTransformInternal(from, to, intent)); |
| 752 } | 757 } |
| 753 | 758 |
| 754 ColorTransform::ColorTransform() {} | 759 ColorTransform::ColorTransform() {} |
| 755 ColorTransform::~ColorTransform() {} | 760 ColorTransform::~ColorTransform() {} |
| 756 | 761 |
| 757 } // namespace gfx | 762 } // namespace gfx |
| OLD | NEW |