Fixed issue where canvas transforms were applied multiple times
in overscroll scenarios on Android Go devices.
Added save/restore around TransformCanvas that is used to replay
filtered drawing instructions to ensure hole punches are carried
through even when a RenderNode is drawn into a layer.
Previously this would end up with transforms being applied twice
during overscroll stretch situations. This caused contents to be
shifted during an overscroll at the end of a HorizontalScrollView
or ScrollView where a SurfaceView was in the scene.
Fixes: 241582783
Test: Added CTS tests to Horizontal and ScrollView tests
Change-Id: Iac1717602fd5f251d3d6fa26109a4c532a9598b5
diff --git a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
index 1a47db5..da4f66d 100644
--- a/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
+++ b/libs/hwui/pipeline/skia/RenderNodeDrawable.cpp
@@ -293,8 +293,10 @@
// with the same canvas transformation + clip into the target
// canvas then draw the layer on top
if (renderNode->hasHolePunches()) {
+ canvas->save();
TransformCanvas transformCanvas(canvas, SkBlendMode::kDstOut);
displayList->draw(&transformCanvas);
+ canvas->restore();
}
canvas->drawImageRect(snapshotImage, SkRect::Make(srcBounds),
SkRect::Make(dstBounds), sampling, &paint,