Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3482820f authored by Lloyd Pique's avatar Lloyd Pique Committed by android-build-merger
Browse files

Merge "SurfaceFlinger: Fix check for ignoring a new color transform" into qt-dev

am: 80b5ba23

Change-Id: Ie0c9141c484b7456aa7250236de05720a10867ff
parents c602412d 80b5ba23
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -89,14 +89,14 @@ void Output::setLayerStackFilter(uint32_t layerStackId, bool isInternal) {
}

void Output::setColorTransform(const mat4& transform) {
    if (mState.colorTransformMat == transform) {
        return;
    }

    const bool isIdentity = (transform == mat4());
    const auto newColorTransform =
            isIdentity ? HAL_COLOR_TRANSFORM_IDENTITY : HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX;

    if (mState.colorTransform == newColorTransform) {
        return;
    }

    mState.colorTransform = newColorTransform;
    mState.colorTransformMat = transform;

+15 −2
Original line number Diff line number Diff line
@@ -172,16 +172,29 @@ TEST_F(OutputTest, setColorTransformSetsTransform) {
    mOutput.setColorTransform(identity);

    EXPECT_EQ(HAL_COLOR_TRANSFORM_IDENTITY, mOutput.getState().colorTransform);
    EXPECT_EQ(identity, mOutput.getState().colorTransformMat);

    // Since identity is the default, the dirty region should be unchanged (empty)
    EXPECT_THAT(mOutput.getState().dirtyRegion, RegionEq(Region()));

    // Non-identity matrix sets a non-identity state value
    const mat4 nonIdentity = mat4() * 2;
    const mat4 nonIdentityHalf = mat4() * 0.5;

    mOutput.setColorTransform(nonIdentity);
    mOutput.setColorTransform(nonIdentityHalf);

    EXPECT_EQ(HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX, mOutput.getState().colorTransform);
    EXPECT_EQ(nonIdentityHalf, mOutput.getState().colorTransformMat);

    // Since this is a state change, the entire output should now be dirty.
    EXPECT_THAT(mOutput.getState().dirtyRegion, RegionEq(Region(kDefaultDisplaySize)));

    // Non-identity matrix sets a non-identity state value
    const mat4 nonIdentityQuarter = mat4() * 0.25;

    mOutput.setColorTransform(nonIdentityQuarter);

    EXPECT_EQ(HAL_COLOR_TRANSFORM_ARBITRARY_MATRIX, mOutput.getState().colorTransform);
    EXPECT_EQ(nonIdentityQuarter, mOutput.getState().colorTransformMat);

    // Since this is a state change, the entire output should now be dirty.
    EXPECT_THAT(mOutput.getState().dirtyRegion, RegionEq(Region(kDefaultDisplaySize)));