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

Commit f369d9ac authored by Nicolas Capens's avatar Nicolas Capens Committed by Gerrit Code Review
Browse files

Merge changes I3e765b8a,I8a64ad96

* changes:
  DO NOT MERGE Disable filtering for BufferLayers which are not scaled
  Check if the buffer is actually being scaled instead of only checking scaling mode
parents c374340c 97a5d955
Loading
Loading
Loading
Loading
+32 −2
Original line number Diff line number Diff line
@@ -211,8 +211,8 @@ std::optional<compositionengine::LayerFE::LayerSettings> BufferLayer::prepareCli
    layer.frameNumber = mCurrentFrameNumber;
    layer.bufferId = mBufferInfo.mBuffer ? mBufferInfo.mBuffer->getId() : 0;

    // TODO: we could be more subtle with isFixedSize()
    const bool useFiltering = targetSettings.needsFiltering || mNeedsFiltering || isFixedSize();
    const bool useFiltering =
            targetSettings.needsFiltering || mNeedsFiltering || bufferNeedsFiltering();

    // Query the texture matrix given our current filtering mode.
    float textureMatrix[16];
@@ -847,6 +847,36 @@ void BufferLayer::setTransformHint(ui::Transform::RotationFlags displayTransform
    }
}

bool BufferLayer::bufferNeedsFiltering() const {
    // 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

#if defined(__gl_h_)
+4 −0
Original line number Diff line number Diff line
@@ -118,6 +118,10 @@ public:

    ui::Transform::RotationFlags getTransformHint() const override { return mTransformHint; }

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

    // -----------------------------------------------------------------------
    // Functions that must be implemented by derived classes
    // -----------------------------------------------------------------------
+1 −0
Original line number Diff line number Diff line
@@ -760,6 +760,7 @@ Layer::RoundedCornerState BufferStateLayer::getRoundedCornerState() const {
                                        static_cast<float>(s.active.transform.ty() + s.active.h)),
                              radius);
}

} // namespace android

// TODO(b/129481165): remove the #pragma below and fix conversion issues