OSDN Git Service

Don't clamp when converting to XYZ
authorRomain Guy <romainguy@google.com>
Tue, 15 Nov 2016 20:01:07 +0000 (12:01 -0800)
committerRomain Guy <romainguy@google.com>
Tue, 15 Nov 2016 20:08:09 +0000 (12:08 -0800)
Test: colorspace_test
Bug: 29940137

Change-Id: I37bf0b6a7724e2ee155ab26835847fcbfd58e0fd

include/ui/ColorSpace.h
libs/ui/tests/colorspace_test.cpp

index 2543e7f..c6a20c9 100644 (file)
@@ -99,11 +99,10 @@ public:
     /**
      * Converts the supplied RGB value to XYZ. The input RGB value
      * is decoded using this color space's electro-optical function
-     * before being converted to XYZ. The returned result is clamped
-     * by this color space's clamping function.
+     * before being converted to XYZ.
      */
     constexpr float3 rgbToXYZ(const float3& rgb) const noexcept {
-        return apply(mRGBtoXYZ * toLinear(rgb), mClamper);
+        return mRGBtoXYZ * toLinear(rgb);
     }
 
     constexpr const std::string& getName() const noexcept {
index 5c127ad..b5a06e6 100644 (file)
@@ -134,7 +134,7 @@ TEST_F(ColorSpaceTest, TransferFunctions) {
 
 TEST_F(ColorSpaceTest, Clamping) {
     // Pick a color outside of sRGB
-    float3 c(ColorSpace::DCIP3().rgbToXYZ(float3{0, 1, 0}));
+    float3 c(ColorSpace::BT2020().rgbToXYZ(float3{0, 1, 0}));
 
     // The color will be clamped
     float3 sRGB(ColorSpace::sRGB().xyzToRGB(c));