| 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 910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 case ColorSpace::TransferID::SMPTE170M: | 921 case ColorSpace::TransferID::SMPTE170M: |
| 922 // SMPTE 1886 suggests that we should be using gamma 2.4 for BT709 | 922 // SMPTE 1886 suggests that we should be using gamma 2.4 for BT709 |
| 923 // content. However, most displays actually use a gamma of 2.2, and | 923 // content. However, most displays actually use a gamma of 2.2, and |
| 924 // user studies shows that users don't really care. Using the same | 924 // user studies shows that users don't really care. Using the same |
| 925 // gamma as the display will let us optimize a lot more, so lets stick | 925 // gamma as the display will let us optimize a lot more, so lets stick |
| 926 // with using the SRGB transfer function. | 926 // with using the SRGB transfer function. |
| 927 from.transfer_ = ColorSpace::TransferID::IEC61966_2_1; | 927 from.transfer_ = ColorSpace::TransferID::IEC61966_2_1; |
| 928 break; | 928 break; |
| 929 | 929 |
| 930 case ColorSpace::TransferID::SMPTEST2084: | 930 case ColorSpace::TransferID::SMPTEST2084: |
| 931 // We don't have an HDR display, so replace SMPTE 2084 with something | 931 if (!to.IsHDR()) { |
| 932 // that returns ranges more or less suitable for a normal display. | 932 // We don't have an HDR display, so replace SMPTE 2084 with |
| 933 from.transfer_ = ColorSpace::TransferID::SMPTEST2084_NON_HDR; | 933 // something that returns ranges more or less suitable for a normal |
| 934 // display. |
| 935 from.transfer_ = ColorSpace::TransferID::SMPTEST2084_NON_HDR; |
| 936 } |
| 934 break; | 937 break; |
| 935 | 938 |
| 936 case ColorSpace::TransferID::ARIB_STD_B67: | 939 case ColorSpace::TransferID::ARIB_STD_B67: |
| 937 // Interpreting HLG using a gamma 2.4 works reasonably well for SDR | 940 if (!to.IsHDR()) { |
| 938 // displays. Once we have HDR output capabilies, we'll need to | 941 // Interpreting HLG using a gamma 2.4 works reasonably well for SDR |
| 939 // change this. | 942 // displays. |
| 940 from.transfer_ = ColorSpace::TransferID::GAMMA24; | 943 from.transfer_ = ColorSpace::TransferID::GAMMA24; |
| 944 } |
| 941 break; | 945 break; |
| 942 | 946 |
| 943 default: // Do nothing | 947 default: // Do nothing |
| 944 break; | 948 break; |
| 945 } | 949 } |
| 946 | 950 |
| 947 // TODO(hubbe): shrink gamuts here (never stretch gamuts) | 951 // TODO(hubbe): shrink gamuts here (never stretch gamuts) |
| 948 } | 952 } |
| 949 builder->Append(base::MakeUnique<ColorTransformMatrix>( | 953 builder->Append(base::MakeUnique<ColorTransformMatrix>( |
| 950 GetRangeAdjustMatrix(from.range_, from.matrix_))); | 954 GetRangeAdjustMatrix(from.range_, from.matrix_))); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1057 to_profile ? ColorSpace::CreateXYZD50() : to, intent, &builder); | 1061 to_profile ? ColorSpace::CreateXYZD50() : to, intent, &builder); |
| 1058 if (to_profile) { | 1062 if (to_profile) { |
| 1059 builder.Append(std::unique_ptr<ColorTransformInternal>( | 1063 builder.Append(std::unique_ptr<ColorTransformInternal>( |
| 1060 new QCMSColorTransform(GetXYZD50Profile(), to_profile))); | 1064 new QCMSColorTransform(GetXYZD50Profile(), to_profile))); |
| 1061 } | 1065 } |
| 1062 | 1066 |
| 1063 return builder.GetTransform(); | 1067 return builder.GetTransform(); |
| 1064 } | 1068 } |
| 1065 | 1069 |
| 1066 } // namespace gfx | 1070 } // namespace gfx |
| OLD | NEW |