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

Commit 1544ba9c authored by Michael Ludwig's avatar Michael Ludwig
Browse files

Update tests and canvas subclasses to expect drawImageRect calls

As part of the the linked staging flag CL,
removing SK_RESOLVE_FILTERS_BEFORE_RESTORE has
SkCanvas::drawImage call into onDrawImageRect with a src rect
matching the image dimensions. onDrawImage() is no longer called
and will be removed from the SkCanvas API at a later point.
This removes all of the overrides that I could find in HWUI.


Bug: b/40042615
Change-Id: I4feea19d7622b217e0cf2c6fcc06f64e6427caa7
parent be1761a0
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -90,11 +90,6 @@ protected:
        mOutput << mIdent << "drawTextBlob" << std::endl;
    }

    void onDrawImage2(const SkImage*, SkScalar dx, SkScalar dy, const SkSamplingOptions&,
                      const SkPaint*) override {
        mOutput << mIdent << "drawImage" << std::endl;
    }

    void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&,
                          const SkPaint*, SrcRectConstraint) override {
        mOutput << mIdent << "drawImageRect" << std::endl;
+0 −6
Original line number Diff line number Diff line
@@ -109,12 +109,6 @@ public:
        drawPoints++;
    }

    int drawImageCount = 0;
    void onDrawImage2(const SkImage* image, SkScalar dx, SkScalar dy, const SkSamplingOptions&,
                     const SkPaint* paint) override {
        drawImageCount++;
    }

    int drawImageRectCount = 0;
    void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&,
                          const SkPaint*, SkCanvas::SrcRectConstraint) override {
+1 −1
Original line number Diff line number Diff line
@@ -492,7 +492,7 @@ TEST(CanvasOp, simpleDrawImage) {
    CallCountingCanvas canvas;
    EXPECT_EQ(0, canvas.sumTotalDrawCalls());
    rasterizeCanvasBuffer(buffer, &canvas);
    EXPECT_EQ(1, canvas.drawImageCount);
    EXPECT_EQ(1, canvas.drawImageRectCount);
    EXPECT_EQ(1, canvas.sumTotalDrawCalls());
}

+0 −4
Original line number Diff line number Diff line
@@ -69,10 +69,6 @@ public:
    void onDrawPath(const SkPath&, const SkPaint&) {
        ADD_FAILURE() << "onDrawPath not expected in this test";
    }
    void onDrawImage2(const SkImage*, SkScalar dx, SkScalar dy, const SkSamplingOptions&,
                      const SkPaint*) {
        ADD_FAILURE() << "onDrawImage not expected in this test";
    }
    void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&,
                          const SkPaint*, SrcRectConstraint) {
        ADD_FAILURE() << "onDrawImageRect not expected in this test";
+3 −2
Original line number Diff line number Diff line
@@ -941,8 +941,9 @@ RENDERTHREAD_TEST(RenderNodeDrawable, simple) {
        void onDrawRect(const SkRect& rect, const SkPaint& paint) override {
            EXPECT_EQ(0, mDrawCounter++);
        }
        void onDrawImage2(const SkImage*, SkScalar dx, SkScalar dy, const SkSamplingOptions&,
                          const SkPaint*) override {
        void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&,
                              const SkSamplingOptions&, const SkPaint*,
                              SrcRectConstraint) override {
            EXPECT_EQ(1, mDrawCounter++);
        }
    };
Loading