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

Commit 7d60f456 authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Fix region clipping bugs See external bug #58344"

parents 265da47a b7b93e00
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -594,7 +594,6 @@ public:

private:
    SkRegion* mRegion;
    SkRegion::Op mOp;
};

class ResetShaderOp : public StateOp {
+9 −5
Original line number Diff line number Diff line
@@ -1668,7 +1668,7 @@ bool OpenGLRenderer::clipRect(float left, float top, float right, float bottom,
    SkPath path;
    path.addRect(left, top, right, bottom);

    return clipPath(&path, op);
    return OpenGLRenderer::clipPath(&path, op);
}

bool OpenGLRenderer::clipPath(SkPath* path, SkRegion::Op op) {
@@ -1679,12 +1679,16 @@ bool OpenGLRenderer::clipPath(SkPath* path, SkRegion::Op op) {
    path->transform(transform, &transformed);

    SkRegion clip;
    if (!mSnapshot->clipRegion->isEmpty()) {
        clip.setRegion(*mSnapshot->clipRegion);
    if (!mSnapshot->previous->clipRegion->isEmpty()) {
        clip.setRegion(*mSnapshot->previous->clipRegion);
    } else {
        if (mSnapshot->previous == mFirstSnapshot) {
            clip.setRect(0, 0, mWidth, mHeight);
        } else {
        Rect* bounds = mSnapshot->clipRect;
            Rect* bounds = mSnapshot->previous->clipRect;
            clip.setRect(bounds->left, bounds->top, bounds->right, bounds->bottom);
        }
    }

    SkRegion region;
    region.setPath(transformed, clip);
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
 * limitations under the License.
 */

#include "Debug.h"
#include "Extensions.h"
#include "Properties.h"
#include "Stencil.h"
+2 −4
Original line number Diff line number Diff line
@@ -48,7 +48,7 @@ public class ClipRegion2Activity extends Activity {
    }

    public static class RegionView extends FrameLayout {
        private final Region mRegion = new Region();
        private Region mRegion = new Region();
        private float mClipPosition = 0.0f;

        public RegionView(Context c) {
@@ -69,9 +69,7 @@ public class ClipRegion2Activity extends Activity {

            canvas.save();

            mRegion.setEmpty();
            mRegion.op(0, 0, getWidth(), getHeight(),
                    Region.Op.REPLACE);
            mRegion.set(0, 0, getWidth(), getHeight());
            mRegion.op(getWidth() / 4, getHeight() / 4, 3 * getWidth() / 4, 3 * getHeight() / 4,
                    Region.Op.DIFFERENCE);