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

Commit 2d31375d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Remove all calls to SkCanvas::getClipStack from HWUI unit tests"

parents 2505b722 c1db0e0f
Loading
Loading
Loading
Loading
+3 −4
Original line number Diff line number Diff line
@@ -193,10 +193,9 @@ SkColor TestUtils::getColor(const sk_sp<SkSurface>& surface, int x, int y) {
}

SkRect TestUtils::getClipBounds(const SkCanvas* canvas) {
    SkClipStack::BoundsType boundType;
    SkRect clipBounds;
    canvas->getClipStack()->getBounds(&clipBounds, &boundType);
    return clipBounds;
    SkIRect bounds;
    (void)canvas->getClipDeviceBounds(&bounds);
    return SkRect::Make(bounds);
}

SkRect TestUtils::getLocalClipBounds(const SkCanvas* canvas) {
+2 −4
Original line number Diff line number Diff line
@@ -865,10 +865,8 @@ RENDERTHREAD_TEST(RenderNodeDrawable, colorOp_unbounded) {
        void onDrawPaint(const SkPaint&) {
            switch (mDrawCounter++) {
            case 0:
                // While this mirrors FrameBuilder::colorOp_unbounded, this value is different
                // because there is no root (root is clipped in SkiaPipeline::renderFrame).
                // SkiaPipeline.clipped and clip_replace verify the root clip.
                EXPECT_TRUE(TestUtils::getClipBounds(this).isEmpty());
                EXPECT_EQ(SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT),
                        TestUtils::getClipBounds(this));
                break;
            case 1:
                EXPECT_EQ(SkRect::MakeWH(10, 10), TestUtils::getClipBounds(this));
+2 −16
Original line number Diff line number Diff line
@@ -87,14 +87,7 @@ TEST(RenderNodeDrawable, renderPropRevealClip) {
    testProperty([](RenderProperties& properties) {
        properties.mutableRevealClip().set(true, 50, 50, 25);
    }, [](const SkCanvas& canvas) {
        SkClipStack::Iter it(*canvas.getClipStack(), SkClipStack::Iter::kBottom_IterStart);
        const SkClipStack::Element *top = it.next();
        ASSERT_NE(nullptr, top);
        SkPath clip;
        top->asPath(&clip);
        SkRect rect;
        EXPECT_TRUE(clip.isOval(&rect));
        EXPECT_EQ(SkRect::MakeLTRB(25, 25, 75, 75), rect);
        EXPECT_EQ(SkRect::MakeLTRB(25, 25, 75, 75), TestUtils::getClipBounds(&canvas));
    });
}

@@ -103,14 +96,7 @@ TEST(RenderNodeDrawable, renderPropOutlineClip) {
        properties.mutableOutline().setShouldClip(true);
        properties.mutableOutline().setRoundRect(10, 20, 30, 40, 5.0f, 0.5f);
    }, [](const SkCanvas& canvas) {
        SkClipStack::Iter it(*canvas.getClipStack(), SkClipStack::Iter::kBottom_IterStart);
        const SkClipStack::Element *top = it.next();
        ASSERT_NE(nullptr, top);
        SkPath clip;
        top->asPath(&clip);
        SkRRect rrect;
        EXPECT_TRUE(clip.isRRect(&rrect));
        EXPECT_EQ(SkRRect::MakeRectXY(SkRect::MakeLTRB(10, 20, 30, 40), 5.0f, 5.0f), rrect);
        EXPECT_EQ(SkRect::MakeLTRB(10, 20, 30, 40), TestUtils::getClipBounds(&canvas));
    });
}