summaryrefslogtreecommitdiff
path: root/core/java/android
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2019-09-11 20:47:28 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2019-09-11 20:47:28 +0000
commit50afc5eb415c537e1cba86fb8f78ec5f53dd6979 (patch)
tree396968b1337079a923c178da4974263f9b09530d /core/java/android
parent68655ec636b52e44b5f1e8145420a2370b108274 (diff)
parent64660bedad0dad36fa9ca9c1544701383c1f5f32 (diff)
Merge "Avoid global transaction in magnifier"
Diffstat (limited to 'core/java/android')
-rw-r--r--core/java/android/widget/Magnifier.java13
1 files changed, 7 insertions, 6 deletions
diff --git a/core/java/android/widget/Magnifier.java b/core/java/android/widget/Magnifier.java
index d3c69725b45b..f58b6d192fde 100644
--- a/core/java/android/widget/Magnifier.java
+++ b/core/java/android/widget/Magnifier.java
@@ -800,6 +800,7 @@ public final class Magnifier {
// The surface we allocate for the magnifier content + shadow.
private final SurfaceSession mSurfaceSession;
private final SurfaceControl mSurfaceControl;
+ private final SurfaceControl.Transaction mTransaction = new SurfaceControl.Transaction();
private final Surface mSurface;
// The renderer used for the allocated surface.
private final ThreadedRenderer.SimpleRenderer mRenderer;
@@ -1081,16 +1082,16 @@ public final class Magnifier {
return;
}
// Show or move the window at the content draw frame.
- SurfaceControl.openTransaction();
- mSurfaceControl.deferTransactionUntil(mSurface, frame);
+ mTransaction.deferTransactionUntilSurface(mSurfaceControl, mSurface, frame);
if (updateWindowPosition) {
- mSurfaceControl.setPosition(pendingX, pendingY);
+ mTransaction.setPosition(mSurfaceControl, pendingX, pendingY);
}
if (firstDraw) {
- mSurfaceControl.setLayer(SURFACE_Z);
- mSurfaceControl.show();
+ mTransaction.setLayer(mSurfaceControl, SURFACE_Z)
+ .show(mSurfaceControl);
+
}
- SurfaceControl.closeTransaction();
+ mTransaction.apply();
};
mRenderer.setLightCenter(mDisplay, pendingX, pendingY);
} else {