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

Commit a6733b3c authored by Vishnu Nair's avatar Vishnu Nair
Browse files

SF: Fix Region log spam

When calulating geometry if the layer has no buffer (i.e. it is a color
layer), it will not have a size. In this case skip operations to mark
regions outside of crop area as transparent.

Test: adb logcat search for spam log + go/wm-smoke + unit tests

Change-Id: I3ba7b770d0746a663dcdfc464db17ccaa7ca4241
parent 5ea45100
Loading
Loading
Loading
Loading
+7 −7
Original line number Diff line number Diff line
@@ -504,8 +504,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {

    // this gives us only the "orientation" component of the transform
    const State& s(getDrawingState());
    const int bufferWidth = getBufferSize(s).getWidth();
    const int bufferHeight = getBufferSize(s).getHeight();
    const Rect bufferSize = getBufferSize(s);
    auto blendMode = HWC2::BlendMode::None;
    if (!isOpaque(s) || getAlpha() != 1.0f) {
        blendMode =
@@ -524,7 +523,7 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
    Region activeTransparentRegion(getActiveTransparentRegion(s));
    ui::Transform t = getTransform();
    Rect activeCrop = getCrop(s);
    if (!activeCrop.isEmpty()) {
    if (!activeCrop.isEmpty() && bufferSize.isValid()) {
        activeCrop = t.transform(activeCrop);
        if (!activeCrop.intersect(display->getViewport(), &activeCrop)) {
            activeCrop.clear();
@@ -536,15 +535,16 @@ void Layer::setGeometry(const sp<const DisplayDevice>& display, uint32_t z) {
        // transform.inverse().transform(transform.transform(Rect)) != Rect
        // in which case we need to make sure the final rect is clipped to the
        // display bounds.
        if (!activeCrop.intersect(Rect(bufferWidth, bufferHeight), &activeCrop)) {
        if (!activeCrop.intersect(bufferSize, &activeCrop)) {
            activeCrop.clear();
        }
        // mark regions outside the crop as transparent
        activeTransparentRegion.orSelf(Rect(0, 0, bufferWidth, activeCrop.top));
        activeTransparentRegion.orSelf(Rect(0, activeCrop.bottom, bufferWidth, bufferHeight));
        activeTransparentRegion.orSelf(Rect(0, 0, bufferSize.getWidth(), activeCrop.top));
        activeTransparentRegion.orSelf(
                Rect(0, activeCrop.bottom, bufferSize.getWidth(), bufferSize.getHeight()));
        activeTransparentRegion.orSelf(Rect(0, activeCrop.top, activeCrop.left, activeCrop.bottom));
        activeTransparentRegion.orSelf(
                Rect(activeCrop.right, activeCrop.top, bufferWidth, activeCrop.bottom));
                Rect(activeCrop.right, activeCrop.top, bufferSize.getWidth(), activeCrop.bottom));
    }

    // computeBounds returns a FloatRect to provide more accuracy during the