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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
852 | 852 |
853 private: | 853 private: |
854 bool disable_optimizations_ = false; | 854 bool disable_optimizations_ = false; |
855 std::vector<std::unique_ptr<ColorTransformInternal>> transforms_; | 855 std::vector<std::unique_ptr<ColorTransformInternal>> transforms_; |
856 }; | 856 }; |
857 | 857 |
858 class ColorSpaceToColorSpaceTransform { | 858 class ColorSpaceToColorSpaceTransform { |
859 public: | 859 public: |
860 static Transform GetPrimaryTransform(const ColorSpace& c) { | 860 static Transform GetPrimaryTransform(const ColorSpace& c) { |
861 if (c.primaries_ == ColorSpace::PrimaryID::CUSTOM) { | 861 if (c.primaries_ == ColorSpace::PrimaryID::CUSTOM) { |
862 return Transform(c.custom_primary_matrix_[0], c.custom_primary_matrix_[1], | 862 SkMatrix44 sk_matrix; |
863 c.custom_primary_matrix_[2], c.custom_primary_matrix_[3], | 863 c.GetPrimaryMatrix(&sk_matrix); |
864 c.custom_primary_matrix_[4], c.custom_primary_matrix_[5], | 864 return Transform(sk_matrix); |
865 c.custom_primary_matrix_[6], c.custom_primary_matrix_[7], | |
866 c.custom_primary_matrix_[8], c.custom_primary_matrix_[9], | |
867 c.custom_primary_matrix_[10], | |
868 c.custom_primary_matrix_[11], 0.0f, 0.0f, 0.0f, 1.0f); | |
869 } else { | 865 } else { |
870 return GetPrimaryMatrix(c.primaries_); | 866 return GetPrimaryMatrix(c.primaries_); |
871 } | 867 } |
872 } | 868 } |
873 | 869 |
874 static void ColorSpaceToColorSpace(ColorSpace from, | 870 static void ColorSpaceToColorSpace(ColorSpace from, |
875 ColorSpace to, | 871 ColorSpace to, |
876 ColorTransform::Intent intent, | 872 ColorTransform::Intent intent, |
877 TransformBuilder* builder) { | 873 TransformBuilder* builder) { |
878 if (intent == ColorTransform::Intent::INTENT_PERCEPTUAL) { | 874 if (intent == ColorTransform::Intent::INTENT_PERCEPTUAL) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 to_profile ? ColorSpace::CreateXYZD50() : to, intent, &builder); | 1018 to_profile ? ColorSpace::CreateXYZD50() : to, intent, &builder); |
1023 if (to_profile) { | 1019 if (to_profile) { |
1024 builder.Append(std::unique_ptr<ColorTransformInternal>( | 1020 builder.Append(std::unique_ptr<ColorTransformInternal>( |
1025 new QCMSColorTransform(GetXYZD50Profile(), to_profile))); | 1021 new QCMSColorTransform(GetXYZD50Profile(), to_profile))); |
1026 } | 1022 } |
1027 | 1023 |
1028 return builder.GetTransform(); | 1024 return builder.GetTransform(); |
1029 } | 1025 } |
1030 | 1026 |
1031 } // namespace gfx | 1027 } // namespace gfx |
OLD | NEW |