Skip to content
Permalink
Browse files

Make ScaledFrameLayout only save matrix

Previous versions of ScaledFrameLayout saved the entire layer. This
isn't great for performance reasons, but it also had the side effect
on Android > 8.0 of messing with how WebView draws to the screen since
it is drawing to a back buffer. This change switches to only calling
save(), which saves the various transformations without creating a
secondary buffer. This seems to make the WebView happy again.

Change-Id: I9188e68d943fdc56bca7a57a24d0d17b2f9b49e7
  • Loading branch information...
ewpatton authored and jisqyv committed Aug 19, 2019
1 parent 4c3f54b commit e03ae81bc9f1b7a96e6d52a12d88b37d1f746f51
@@ -58,11 +58,7 @@ public ScaledFrameLayout(Context context, AttributeSet attrs, int defStyle) {

@Override
protected void dispatchDraw(Canvas canvas) {
if (VERSION.SDK_INT < VERSION_CODES.P) {
canvas.saveLayer(0, 0, canvas.getWidth(), canvas.getHeight(), null, MATRIX_SAVE_FLAG);
} else {
canvas.saveLayer(0, 0, canvas.getWidth(), canvas.getHeight(), null);
}
canvas.save();
canvas.scale(mScale, mScale);
super.dispatchDraw(canvas);
canvas.restore();

0 comments on commit e03ae81

Please sign in to comment.
You can’t perform that action at this time.