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

Commit 80b5ba23 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents f7f1eeda 77f79a2e
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)));