Merge changes from topic "presubmit-am-feedd56083be48668fea14c29cf72287" into sc-v2-dev-plus-aosp
* changes:
[automerge] [RESTRICT AUTOMERGE]DisplayManager: Make sure RampAnimator sets property in linear space. 2p: 47461bb5ae
[RESTRICT AUTOMERGE]DisplayManager: Make sure RampAnimator sets property in linear space.
This commit is contained in:
@@ -70,7 +70,7 @@ class RampAnimator<T> {
|
|||||||
mRate = 0;
|
mRate = 0;
|
||||||
mTargetValue = target;
|
mTargetValue = target;
|
||||||
mCurrentValue = target;
|
mCurrentValue = target;
|
||||||
mProperty.setValue(mObject, target);
|
setPropertyValue(target);
|
||||||
if (mAnimating) {
|
if (mAnimating) {
|
||||||
mAnimating = false;
|
mAnimating = false;
|
||||||
cancelAnimationCallback();
|
cancelAnimationCallback();
|
||||||
@@ -125,6 +125,15 @@ class RampAnimator<T> {
|
|||||||
mListener = listener;
|
mListener = listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the brightness property by converting the given value from HLG space
|
||||||
|
* into linear space.
|
||||||
|
*/
|
||||||
|
private void setPropertyValue(float val) {
|
||||||
|
final float linearVal = BrightnessUtils.convertGammaToLinear(val);
|
||||||
|
mProperty.setValue(mObject, linearVal);
|
||||||
|
}
|
||||||
|
|
||||||
private void postAnimationCallback() {
|
private void postAnimationCallback() {
|
||||||
mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, mAnimationCallback, null);
|
mChoreographer.postCallback(Choreographer.CALLBACK_ANIMATION, mAnimationCallback, null);
|
||||||
}
|
}
|
||||||
@@ -160,9 +169,7 @@ class RampAnimator<T> {
|
|||||||
final float oldCurrentValue = mCurrentValue;
|
final float oldCurrentValue = mCurrentValue;
|
||||||
mCurrentValue = mAnimatedValue;
|
mCurrentValue = mAnimatedValue;
|
||||||
if (oldCurrentValue != mCurrentValue) {
|
if (oldCurrentValue != mCurrentValue) {
|
||||||
// Convert value from HLG into linear space for the property.
|
setPropertyValue(mCurrentValue);
|
||||||
final float linearCurrentVal = BrightnessUtils.convertGammaToLinear(mCurrentValue);
|
|
||||||
mProperty.setValue(mObject, linearCurrentVal);
|
|
||||||
}
|
}
|
||||||
if (mTargetValue != mCurrentValue) {
|
if (mTargetValue != mCurrentValue) {
|
||||||
postAnimationCallback();
|
postAnimationCallback();
|
||||||
|
|||||||
Reference in New Issue
Block a user