Loading libs/hwui/tests/unit/FatalTestCanvas.h +3 −3 Original line number Original line Diff line number Diff line Loading @@ -121,13 +121,13 @@ public: const SkPaint*) { const SkPaint*) { ADD_FAILURE() << "onDrawBitmapLattice not expected in this test"; ADD_FAILURE() << "onDrawBitmapLattice not expected in this test"; } } void onClipRRect(const SkRRect& rrect, ClipOp, ClipEdgeStyle) { void onClipRRect(const SkRRect& rrect, SkClipOp, ClipEdgeStyle) { ADD_FAILURE() << "onClipRRect not expected in this test"; ADD_FAILURE() << "onClipRRect not expected in this test"; } } void onClipPath(const SkPath& path, ClipOp, ClipEdgeStyle) { void onClipPath(const SkPath& path, SkClipOp, ClipEdgeStyle) { ADD_FAILURE() << "onClipPath not expected in this test"; ADD_FAILURE() << "onClipPath not expected in this test"; } } void onClipRegion(const SkRegion& deviceRgn, ClipOp) { void onClipRegion(const SkRegion& deviceRgn, SkClipOp) { ADD_FAILURE() << "onClipRegion not expected in this test"; ADD_FAILURE() << "onClipRegion not expected in this test"; } } void onDiscard() { void onDiscard() { Loading libs/hwui/tests/unit/SkiaPipelineTests.cpp +10 −11 Original line number Original line Diff line number Diff line Loading @@ -206,7 +206,6 @@ public: , mCanvas(canvas) { , mCanvas(canvas) { } } SkCanvas* onNewCanvas() override { SkCanvas* onNewCanvas() override { mCanvas->ref(); return mCanvas; return mCanvas; } } sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override { sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override { Loading @@ -216,7 +215,7 @@ public: return sk_sp<SkImage>(); return sk_sp<SkImage>(); } } void onCopyOnWrite(ContentChangeMode) override {} void onCopyOnWrite(ContentChangeMode) override {} T* mCanvas; T* mCanvas; // bare pointer, not owned/ref'd }; }; } } Loading Loading @@ -281,10 +280,10 @@ RENDERTHREAD_TEST(SkiaPipeline, deferRenderNodeScene) { LayerUpdateQueue layerUpdateQueue; LayerUpdateQueue layerUpdateQueue; SkRect dirty = SkRect::MakeWH(800, 600); SkRect dirty = SkRect::MakeWH(800, 600); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); sk_sp<DeferTestCanvas> canvas(new DeferTestCanvas()); DeferTestCanvas canvas; sk_sp<SkSurface> surface(new DeferLayer<DeferTestCanvas>(canvas.get())); sk_sp<SkSurface> surface(new DeferLayer<DeferTestCanvas>(&canvas)); pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, contentDrawBounds, surface); pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, contentDrawBounds, surface); EXPECT_EQ(4, canvas->mDrawCounter); EXPECT_EQ(4, canvas.mDrawCounter); } } RENDERTHREAD_TEST(SkiaPipeline, clipped) { RENDERTHREAD_TEST(SkiaPipeline, clipped) { Loading Loading @@ -312,11 +311,11 @@ RENDERTHREAD_TEST(SkiaPipeline, clipped) { LayerUpdateQueue layerUpdateQueue; LayerUpdateQueue layerUpdateQueue; SkRect dirty = SkRect::MakeLTRB(10, 20, 30, 40); SkRect dirty = SkRect::MakeLTRB(10, 20, 30, 40); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); sk_sp<ClippedTestCanvas> canvas(new ClippedTestCanvas()); ClippedTestCanvas canvas; sk_sp<SkSurface> surface(new DeferLayer<ClippedTestCanvas>(canvas.get())); sk_sp<SkSurface> surface(new DeferLayer<ClippedTestCanvas>(&canvas)); pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface); SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface); EXPECT_EQ(1, canvas->mDrawCounter); EXPECT_EQ(1, canvas.mDrawCounter); } } RENDERTHREAD_TEST(SkiaPipeline, clip_replace) { RENDERTHREAD_TEST(SkiaPipeline, clip_replace) { Loading Loading @@ -347,9 +346,9 @@ RENDERTHREAD_TEST(SkiaPipeline, clip_replace) { LayerUpdateQueue layerUpdateQueue; LayerUpdateQueue layerUpdateQueue; SkRect dirty = SkRect::MakeLTRB(10, 10, 40, 40); SkRect dirty = SkRect::MakeLTRB(10, 10, 40, 40); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); sk_sp<ClipReplaceTestCanvas> canvas(new ClipReplaceTestCanvas()); ClipReplaceTestCanvas canvas; sk_sp<SkSurface> surface(new DeferLayer<ClipReplaceTestCanvas>(canvas.get())); sk_sp<SkSurface> surface(new DeferLayer<ClipReplaceTestCanvas>(&canvas)); pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface); SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface); EXPECT_EQ(1, canvas->mDrawCounter); EXPECT_EQ(1, canvas.mDrawCounter); } } libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -51,7 +51,7 @@ static void testProperty(std::function<void(RenderProperties&)> propSetupCallbac EXPECT_EQ(mDrawCounter++, 0); EXPECT_EQ(mDrawCounter++, 0); mCallback(*this); mCallback(*this); } } void onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle style) { void onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle style) { SkCanvas::onClipRRect(rrect, op, style); SkCanvas::onClipRRect(rrect, op, style); } } std::function<void(const SkCanvas&)> mCallback; std::function<void(const SkCanvas&)> mCallback; Loading @@ -65,10 +65,10 @@ static void testProperty(std::function<void(RenderProperties&)> propSetupCallbac canvas.drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT, paint); canvas.drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT, paint); }); }); sk_sp<PropertyTestCanvas> canvas(new PropertyTestCanvas(opValidateCallback)); PropertyTestCanvas canvas(opValidateCallback); RenderNodeDrawable drawable(node.get(), canvas.get(), true); RenderNodeDrawable drawable(node.get(), &canvas, true); canvas->drawDrawable(&drawable); canvas.drawDrawable(&drawable); EXPECT_EQ(1, canvas->mDrawCounter); EXPECT_EQ(1, canvas.mDrawCounter); } } } } Loading Loading
libs/hwui/tests/unit/FatalTestCanvas.h +3 −3 Original line number Original line Diff line number Diff line Loading @@ -121,13 +121,13 @@ public: const SkPaint*) { const SkPaint*) { ADD_FAILURE() << "onDrawBitmapLattice not expected in this test"; ADD_FAILURE() << "onDrawBitmapLattice not expected in this test"; } } void onClipRRect(const SkRRect& rrect, ClipOp, ClipEdgeStyle) { void onClipRRect(const SkRRect& rrect, SkClipOp, ClipEdgeStyle) { ADD_FAILURE() << "onClipRRect not expected in this test"; ADD_FAILURE() << "onClipRRect not expected in this test"; } } void onClipPath(const SkPath& path, ClipOp, ClipEdgeStyle) { void onClipPath(const SkPath& path, SkClipOp, ClipEdgeStyle) { ADD_FAILURE() << "onClipPath not expected in this test"; ADD_FAILURE() << "onClipPath not expected in this test"; } } void onClipRegion(const SkRegion& deviceRgn, ClipOp) { void onClipRegion(const SkRegion& deviceRgn, SkClipOp) { ADD_FAILURE() << "onClipRegion not expected in this test"; ADD_FAILURE() << "onClipRegion not expected in this test"; } } void onDiscard() { void onDiscard() { Loading
libs/hwui/tests/unit/SkiaPipelineTests.cpp +10 −11 Original line number Original line Diff line number Diff line Loading @@ -206,7 +206,6 @@ public: , mCanvas(canvas) { , mCanvas(canvas) { } } SkCanvas* onNewCanvas() override { SkCanvas* onNewCanvas() override { mCanvas->ref(); return mCanvas; return mCanvas; } } sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override { sk_sp<SkSurface> onNewSurface(const SkImageInfo&) override { Loading @@ -216,7 +215,7 @@ public: return sk_sp<SkImage>(); return sk_sp<SkImage>(); } } void onCopyOnWrite(ContentChangeMode) override {} void onCopyOnWrite(ContentChangeMode) override {} T* mCanvas; T* mCanvas; // bare pointer, not owned/ref'd }; }; } } Loading Loading @@ -281,10 +280,10 @@ RENDERTHREAD_TEST(SkiaPipeline, deferRenderNodeScene) { LayerUpdateQueue layerUpdateQueue; LayerUpdateQueue layerUpdateQueue; SkRect dirty = SkRect::MakeWH(800, 600); SkRect dirty = SkRect::MakeWH(800, 600); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); sk_sp<DeferTestCanvas> canvas(new DeferTestCanvas()); DeferTestCanvas canvas; sk_sp<SkSurface> surface(new DeferLayer<DeferTestCanvas>(canvas.get())); sk_sp<SkSurface> surface(new DeferLayer<DeferTestCanvas>(&canvas)); pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, contentDrawBounds, surface); pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, contentDrawBounds, surface); EXPECT_EQ(4, canvas->mDrawCounter); EXPECT_EQ(4, canvas.mDrawCounter); } } RENDERTHREAD_TEST(SkiaPipeline, clipped) { RENDERTHREAD_TEST(SkiaPipeline, clipped) { Loading Loading @@ -312,11 +311,11 @@ RENDERTHREAD_TEST(SkiaPipeline, clipped) { LayerUpdateQueue layerUpdateQueue; LayerUpdateQueue layerUpdateQueue; SkRect dirty = SkRect::MakeLTRB(10, 20, 30, 40); SkRect dirty = SkRect::MakeLTRB(10, 20, 30, 40); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); sk_sp<ClippedTestCanvas> canvas(new ClippedTestCanvas()); ClippedTestCanvas canvas; sk_sp<SkSurface> surface(new DeferLayer<ClippedTestCanvas>(canvas.get())); sk_sp<SkSurface> surface(new DeferLayer<ClippedTestCanvas>(&canvas)); pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface); SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface); EXPECT_EQ(1, canvas->mDrawCounter); EXPECT_EQ(1, canvas.mDrawCounter); } } RENDERTHREAD_TEST(SkiaPipeline, clip_replace) { RENDERTHREAD_TEST(SkiaPipeline, clip_replace) { Loading Loading @@ -347,9 +346,9 @@ RENDERTHREAD_TEST(SkiaPipeline, clip_replace) { LayerUpdateQueue layerUpdateQueue; LayerUpdateQueue layerUpdateQueue; SkRect dirty = SkRect::MakeLTRB(10, 10, 40, 40); SkRect dirty = SkRect::MakeLTRB(10, 10, 40, 40); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); auto pipeline = std::make_unique<SkiaOpenGLPipeline>(renderThread); sk_sp<ClipReplaceTestCanvas> canvas(new ClipReplaceTestCanvas()); ClipReplaceTestCanvas canvas; sk_sp<SkSurface> surface(new DeferLayer<ClipReplaceTestCanvas>(canvas.get())); sk_sp<SkSurface> surface(new DeferLayer<ClipReplaceTestCanvas>(&canvas)); pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, pipeline->renderFrame(layerUpdateQueue, dirty, nodes, true, SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface); SkRect::MakeWH(CANVAS_WIDTH, CANVAS_HEIGHT), surface); EXPECT_EQ(1, canvas->mDrawCounter); EXPECT_EQ(1, canvas.mDrawCounter); } }
libs/hwui/tests/unit/SkiaRenderPropertiesTests.cpp +5 −5 Original line number Original line Diff line number Diff line Loading @@ -51,7 +51,7 @@ static void testProperty(std::function<void(RenderProperties&)> propSetupCallbac EXPECT_EQ(mDrawCounter++, 0); EXPECT_EQ(mDrawCounter++, 0); mCallback(*this); mCallback(*this); } } void onClipRRect(const SkRRect& rrect, ClipOp op, ClipEdgeStyle style) { void onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle style) { SkCanvas::onClipRRect(rrect, op, style); SkCanvas::onClipRRect(rrect, op, style); } } std::function<void(const SkCanvas&)> mCallback; std::function<void(const SkCanvas&)> mCallback; Loading @@ -65,10 +65,10 @@ static void testProperty(std::function<void(RenderProperties&)> propSetupCallbac canvas.drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT, paint); canvas.drawRect(0, 0, CANVAS_WIDTH, CANVAS_HEIGHT, paint); }); }); sk_sp<PropertyTestCanvas> canvas(new PropertyTestCanvas(opValidateCallback)); PropertyTestCanvas canvas(opValidateCallback); RenderNodeDrawable drawable(node.get(), canvas.get(), true); RenderNodeDrawable drawable(node.get(), &canvas, true); canvas->drawDrawable(&drawable); canvas.drawDrawable(&drawable); EXPECT_EQ(1, canvas->mDrawCounter); EXPECT_EQ(1, canvas.mDrawCounter); } } } } Loading