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

Commit 4f9959fc authored by Derek Sollenberger's avatar Derek Sollenberger
Browse files

Avoid clipping for common SysUI interactions with roundedCorners.

Test: atest librenderengine_test
Bug: 186773838
Change-Id: I9176b34556e3ff0609fe593c4e07d80fc5163715
parent b672987c
Loading
Loading
Loading
Loading
+23 −10
Original line number Original line Diff line number Diff line
@@ -1101,8 +1101,8 @@ inline std::pair<SkRRect, SkRRect> SkiaGLRenderEngine::getBoundsAndClip(


    SkRRect clip;
    SkRRect clip;
    if (cornerRadius > 0) {
    if (cornerRadius > 0) {
        // it the crop and the bounds are equivalent then we don't need a clip
        // it the crop and the bounds are equivalent or there is no crop then we don't need a clip
        if (bounds == crop) {
        if (bounds == crop || crop.isEmpty()) {
            return {SkRRect::MakeRectXY(bounds, cornerRadius, cornerRadius), clip};
            return {SkRRect::MakeRectXY(bounds, cornerRadius, cornerRadius), clip};
        }
        }


@@ -1116,34 +1116,47 @@ inline std::pair<SkRRect, SkRRect> SkiaGLRenderEngine::getBoundsAndClip(


            const auto insetCrop = crop.makeInset(cornerRadius, cornerRadius);
            const auto insetCrop = crop.makeInset(cornerRadius, cornerRadius);


            const bool leftEqual = bounds.fLeft == crop.fLeft;
            const bool topEqual = bounds.fTop == crop.fTop;
            const bool rightEqual = bounds.fRight == crop.fRight;
            const bool bottomEqual = bounds.fBottom == crop.fBottom;

            // compute the UpperLeft corner radius
            // compute the UpperLeft corner radius
            if (bounds.fLeft == crop.fLeft && bounds.fTop == crop.fTop) {
            if (leftEqual && topEqual) {
                radii[0].set(cornerRadius, cornerRadius);
                radii[0].set(cornerRadius, cornerRadius);
            } else if (bounds.fLeft > insetCrop.fLeft && bounds.fTop > insetCrop.fTop) {
            } else if ((leftEqual && bounds.fTop >= insetCrop.fTop) ||
                       (topEqual && bounds.fLeft >= insetCrop.fLeft) ||
                       insetCrop.contains(bounds.fLeft, bounds.fTop)) {
                radii[0].set(0, 0);
                radii[0].set(0, 0);
            } else {
            } else {
                intersectionIsRoundRect = false;
                intersectionIsRoundRect = false;
            }
            }
            // compute the UpperRight corner radius
            // compute the UpperRight corner radius
            if (bounds.fRight == crop.fRight && bounds.fTop == crop.fTop) {
            if (rightEqual && topEqual) {
                radii[1].set(cornerRadius, cornerRadius);
                radii[1].set(cornerRadius, cornerRadius);
            } else if (bounds.fRight < insetCrop.fRight && bounds.fTop > insetCrop.fTop) {
            } else if ((rightEqual && bounds.fTop >= insetCrop.fTop) ||
                       (topEqual && bounds.fRight <= insetCrop.fRight) ||
                       insetCrop.contains(bounds.fRight, bounds.fTop)) {
                radii[1].set(0, 0);
                radii[1].set(0, 0);
            } else {
            } else {
                intersectionIsRoundRect = false;
                intersectionIsRoundRect = false;
            }
            }
            // compute the BottomRight corner radius
            // compute the BottomRight corner radius
            if (bounds.fRight == crop.fRight && bounds.fBottom == crop.fBottom) {
            if (rightEqual && bottomEqual) {
                radii[2].set(cornerRadius, cornerRadius);
                radii[2].set(cornerRadius, cornerRadius);
            } else if (bounds.fRight < insetCrop.fRight && bounds.fBottom < insetCrop.fBottom) {
            } else if ((rightEqual && bounds.fBottom <= insetCrop.fBottom) ||
                       (bottomEqual && bounds.fRight <= insetCrop.fRight) ||
                       insetCrop.contains(bounds.fRight, bounds.fBottom)) {
                radii[2].set(0, 0);
                radii[2].set(0, 0);
            } else {
            } else {
                intersectionIsRoundRect = false;
                intersectionIsRoundRect = false;
            }
            }
            // compute the BottomLeft corner radius
            // compute the BottomLeft corner radius
            if (bounds.fLeft == crop.fLeft && bounds.fBottom == crop.fBottom) {
            if (leftEqual && bottomEqual) {
                radii[3].set(cornerRadius, cornerRadius);
                radii[3].set(cornerRadius, cornerRadius);
            } else if (bounds.fLeft > insetCrop.fLeft && bounds.fBottom < insetCrop.fBottom) {
            } else if ((leftEqual && bounds.fBottom <= insetCrop.fBottom) ||
                       (bottomEqual && bounds.fLeft >= insetCrop.fLeft) ||
                       insetCrop.contains(bounds.fLeft, bounds.fBottom)) {
                radii[3].set(0, 0);
                radii[3].set(0, 0);
            } else {
            } else {
                intersectionIsRoundRect = false;
                intersectionIsRoundRect = false;