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

Commit 0631b55c authored by Nicolas Capens's avatar Nicolas Capens Committed by Automerger Merge Worker
Browse files

DO NOT MERGE Disable filtering for BufferLayers which are not scaled am: 97a5d955

Original change: https://android-review.googlesource.com/c/platform/frameworks/native/+/1652828

Change-Id: Ib370020a11b6b6cc3ca2c344309751f1c2c7c67a
parents 1215460c 97a5d955
Loading
Loading
Loading
Loading
+27 −1
Original line number Diff line number Diff line
@@ -848,7 +848,33 @@ void BufferLayer::setTransformHint(ui::Transform::RotationFlags displayTransform
}

bool BufferLayer::bufferNeedsFiltering() const {
    return isFixedSize();
    // Layers that don't resize along with their buffer, don't need filtering.
    if (!isFixedSize()) {
        return false;
    }

    if (!mBufferInfo.mBuffer) {
        return false;
    }

    uint32_t bufferWidth = mBufferInfo.mBuffer->width;
    uint32_t bufferHeight = mBufferInfo.mBuffer->height;

    // Undo any transformations on the buffer and return the result.
    const State& s(getDrawingState());
    if (s.transform & ui::Transform::ROT_90) {
        std::swap(bufferWidth, bufferHeight);
    }

    if (s.transformToDisplayInverse) {
        uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags();
        if (invTransform & ui::Transform::ROT_90) {
            std::swap(bufferWidth, bufferHeight);
        }
    }

    const Rect layerSize{getBounds()};
    return layerSize.width() != bufferWidth || layerSize.height() != bufferHeight;
}

} // namespace android
+1 −1
Original line number Diff line number Diff line
@@ -120,7 +120,7 @@ public:

    // Returns true if the transformed buffer size does not match the layer size and we need
    // to apply filtering.
    virtual bool bufferNeedsFiltering() const;
    bool bufferNeedsFiltering() const;

    // -----------------------------------------------------------------------
    // Functions that must be implemented by derived classes
+0 −24
Original line number Diff line number Diff line
@@ -761,30 +761,6 @@ Layer::RoundedCornerState BufferStateLayer::getRoundedCornerState() const {
                              radius);
}

bool BufferStateLayer::bufferNeedsFiltering() const {
    const State& s(getDrawingState());
    if (!s.buffer) {
        return false;
    }

    uint32_t bufferWidth = s.buffer->width;
    uint32_t bufferHeight = s.buffer->height;

    // Undo any transformations on the buffer and return the result.
    if (s.transform & ui::Transform::ROT_90) {
        std::swap(bufferWidth, bufferHeight);
    }

    if (s.transformToDisplayInverse) {
        uint32_t invTransform = DisplayDevice::getPrimaryDisplayRotationFlags();
        if (invTransform & ui::Transform::ROT_90) {
            std::swap(bufferWidth, bufferHeight);
        }
    }

    const Rect layerSize{getBounds()};
    return layerSize.width() != bufferWidth || layerSize.height() != bufferHeight;
}
} // namespace android

// TODO(b/129481165): remove the #pragma below and fix conversion issues
+0 −2
Original line number Diff line number Diff line
@@ -145,8 +145,6 @@ private:
    friend class SlotGenerationTest;
    bool willPresentCurrentTransaction() const;

    bool bufferNeedsFiltering() const override;

    static const std::array<float, 16> IDENTITY_MATRIX;

    std::unique_ptr<renderengine::Image> mTextureImage;