Loading libs/hwui/RecordingCanvas.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -564,6 +564,7 @@ void RecordingCanvas::drawRenderNode(RenderNode* renderNode) { getRecordedClip(), renderNode); int opIndex = addOp(op); if (CC_LIKELY(opIndex >= 0)) { int childIndex = mDisplayList->addChild(op); // update the chunk's child indices Loading @@ -575,6 +576,7 @@ void RecordingCanvas::drawRenderNode(RenderNode* renderNode) { mDisplayList->projectionReceiveIndex = opIndex; } } } void RecordingCanvas::drawLayer(DeferredLayerUpdater* layerHandle) { // We ref the DeferredLayerUpdater due to its thread-safe ref-counting semantics. Loading libs/hwui/tests/unit/RecordingCanvasTests.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,21 @@ TEST(RecordingCanvas, saveLayer_rotateClipped) { EXPECT_EQ(3, count); } TEST(RecordingCanvas, drawRenderNode_rejection) { auto child = TestUtils::createNode(50, 50, 150, 150, [](RenderProperties& props, RecordingCanvas& canvas) { SkPaint paint; paint.setColor(SK_ColorWHITE); canvas.drawRect(0, 0, 100, 100, paint); }); auto dl = TestUtils::createDisplayList<RecordingCanvas>(200, 200, [&child](RecordingCanvas& canvas) { canvas.clipRect(0, 0, 0, 0, SkRegion::kIntersect_Op); // empty clip, reject node canvas.drawRenderNode(child.get()); // shouldn't crash when rejecting node... }); ASSERT_TRUE(dl->isEmpty()); } TEST(RecordingCanvas, drawRenderNode_projection) { sp<RenderNode> background = TestUtils::createNode(50, 50, 150, 150, [](RenderProperties& props, RecordingCanvas& canvas) { Loading Loading
libs/hwui/RecordingCanvas.cpp +9 −7 Original line number Diff line number Diff line Loading @@ -564,6 +564,7 @@ void RecordingCanvas::drawRenderNode(RenderNode* renderNode) { getRecordedClip(), renderNode); int opIndex = addOp(op); if (CC_LIKELY(opIndex >= 0)) { int childIndex = mDisplayList->addChild(op); // update the chunk's child indices Loading @@ -575,6 +576,7 @@ void RecordingCanvas::drawRenderNode(RenderNode* renderNode) { mDisplayList->projectionReceiveIndex = opIndex; } } } void RecordingCanvas::drawLayer(DeferredLayerUpdater* layerHandle) { // We ref the DeferredLayerUpdater due to its thread-safe ref-counting semantics. Loading
libs/hwui/tests/unit/RecordingCanvasTests.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -451,6 +451,21 @@ TEST(RecordingCanvas, saveLayer_rotateClipped) { EXPECT_EQ(3, count); } TEST(RecordingCanvas, drawRenderNode_rejection) { auto child = TestUtils::createNode(50, 50, 150, 150, [](RenderProperties& props, RecordingCanvas& canvas) { SkPaint paint; paint.setColor(SK_ColorWHITE); canvas.drawRect(0, 0, 100, 100, paint); }); auto dl = TestUtils::createDisplayList<RecordingCanvas>(200, 200, [&child](RecordingCanvas& canvas) { canvas.clipRect(0, 0, 0, 0, SkRegion::kIntersect_Op); // empty clip, reject node canvas.drawRenderNode(child.get()); // shouldn't crash when rejecting node... }); ASSERT_TRUE(dl->isEmpty()); } TEST(RecordingCanvas, drawRenderNode_projection) { sp<RenderNode> background = TestUtils::createNode(50, 50, 150, 150, [](RenderProperties& props, RecordingCanvas& canvas) { Loading