diff options
author | Stan Iliev <stani@google.com> | 2018-06-14 18:00:10 -0400 |
---|---|---|
committer | Stan Iliev <stani@google.com> | 2018-06-19 13:41:15 +0000 |
commit | 54d7032b78e3b457aa618eb74ae644b95844ca54 (patch) | |
tree | 81a420aebb111115c373a01eede66d4631bf7c9c /libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp | |
parent | acda839b9e3fa12d0f0b40ffd8ec3708ad0a6038 (diff) |
Restore matrix transform for out-of-order render nodes
Restore matrix for render nodes, which are drawn out of order.
Test: DrawChildBug-debug.apk draws correctly, new test ag/4355529
Bug: 80173852
Change-Id: I3f789a7cf0ee5816da84255199b265643f95af1c
Diffstat (limited to 'libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp')
-rw-r--r-- | libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp b/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp index 6292a6c5c591..dba97fe5ef9f 100644 --- a/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp +++ b/libs/hwui/pipeline/skia/ReorderBarrierDrawables.cpp @@ -55,6 +55,11 @@ void StartReorderBarrierDrawable::onDraw(SkCanvas* canvas) { if (casterZ >= -NON_ZERO_EPSILON) { // draw only children with negative Z return; } + SkAutoCanvasRestore acr(canvas, true); + // Since we're drawing out of recording order, the child's matrix needs to be applied to the + // canvas. In in-order drawing, the canvas already has the child's matrix applied. + canvas->setMatrix(mDisplayList->mParentMatrix); + canvas->concat(childNode->getRecordedMatrix()); childNode->forceDraw(canvas); drawIndex++; } @@ -102,6 +107,11 @@ void EndReorderBarrierDrawable::onDraw(SkCanvas* canvas) { RenderNodeDrawable* childNode = zChildren[drawIndex]; SkASSERT(childNode); + SkAutoCanvasRestore acr(canvas, true); + // Since we're drawing out of recording order, the child's matrix needs to be applied to the + // canvas. In in-order drawing, the canvas already has the child's matrix applied. + canvas->setMatrix(mStartBarrier->mDisplayList->mParentMatrix); + canvas->concat(childNode->getRecordedMatrix()); childNode->forceDraw(canvas); drawIndex++; @@ -153,10 +163,15 @@ void EndReorderBarrierDrawable::drawShadow(SkCanvas* canvas, RenderNodeDrawable* } SkAutoCanvasRestore acr(canvas, true); + // Since we're drawing out of recording order, the child's matrix needs to be applied to the + // canvas. In in-order drawing, the canvas already has the child's matrix applied. + canvas->setMatrix(mStartBarrier->mDisplayList->mParentMatrix); SkMatrix shadowMatrix; - mat4 hwuiMatrix; + mat4 hwuiMatrix(caster->getRecordedMatrix()); // TODO we don't pass the optional boolean to treat it as a 4x4 matrix + // applyViewPropertyTransforms gets the same matrix, which render nodes apply with + // RenderNodeDrawable::setViewProperties as a part if their draw. caster->getRenderNode()->applyViewPropertyTransforms(hwuiMatrix); hwuiMatrix.copyTo(shadowMatrix); canvas->concat(shadowMatrix); |