Merge "Ensure root render node clip cannot expand beyond dirty area"

This commit is contained in:
TreeHugger Robot
2016-12-16 21:25:03 +00:00
committed by Android (Google) Code Review
2 changed files with 5 additions and 9 deletions

View File

@@ -100,7 +100,7 @@ void SkiaPipeline::renderLayersImpl(const LayerUpdateQueue& layers, bool opaque)
int saveCount = layerCanvas->save();
SkASSERT(saveCount == 1);
layerCanvas->clipRect(layerDamage.toSkRect(), SkClipOp::kReplace);
layerCanvas->androidFramework_setDeviceClipRestriction(layerDamage.toSkIRect());
auto savedLightCenter = mLightCenter;
// map current light center into RenderNode's coordinate space
@@ -233,8 +233,8 @@ static Rect nodeBounds(RenderNode& node) {
void SkiaPipeline::renderFrameImpl(const LayerUpdateQueue& layers, const SkRect& clip,
const std::vector<sp<RenderNode>>& nodes, bool opaque, const Rect &contentDrawBounds,
SkCanvas* canvas) {
canvas->clipRect(clip, SkClipOp::kReplace);
SkAutoCanvasRestore saver(canvas, true);
canvas->androidFramework_setDeviceClipRestriction(clip.roundOut());
if (!opaque) {
canvas->clear(SK_ColorTRANSPARENT);
@@ -242,7 +242,6 @@ void SkiaPipeline::renderFrameImpl(const LayerUpdateQueue& layers, const SkRect&
if (1 == nodes.size()) {
if (!nodes[0]->nothingToDraw()) {
SkAutoCanvasRestore acr(canvas, true);
RenderNodeDrawable root(nodes[0].get(), canvas);
root.draw(canvas);
}

View File

@@ -324,11 +324,8 @@ RENDERTHREAD_TEST(SkiaPipeline, clip_replace) {
}
void onDrawPaint(const SkPaint&) {
EXPECT_EQ(0, mDrawCounter++);
//TODO: this unit test is failing on the commented check below, because of a missing
//feature. In Snapshot::applyClip HWUI is intersecting the clip with the clip root,
//even for kReplace_Op clips. We need to implement the same for Skia pipelines.
//EXPECT_EQ(SkRect::MakeLTRB(20, 10, 30, 40), TestUtils::getClipBounds(this)) //got instead 20 0 30 50
// << "Expect resolved clip to be intersection of viewport clip and clip op";
EXPECT_EQ(SkRect::MakeLTRB(20, 10, 30, 40), TestUtils::getClipBounds(this))
<< "Expect resolved clip to be intersection of viewport clip and clip op";
}
int mDrawCounter = 0;
};