Merge "Dedupe non-perceptable depth updates" into ub-launcher3-rvc-dev

This commit is contained in:
Winson Chung 2020-04-20 21:10:20 +00:00 committed by Android (Google) Code Review
commit f66e7c19bd
1 changed files with 8 additions and 1 deletions

View File

@ -177,7 +177,14 @@ public class DepthController implements LauncherStateManager.StateHandler {
}
private void setDepth(float depth) {
mDepth = depth;
// Round out the depth to dedupe frequent, non-perceptable updates
int depthI = (int) (depth * 256);
float depthF = depthI / 256f;
if (Float.compare(mDepth, depthF) == 0) {
return;
}
mDepth = depthF;
if (mSurface == null || !mSurface.isValid()) {
return;
}