Home
last modified time | relevance | path

Searched refs:MathUtils (Results 1 – 25 of 101) sorted by relevance

12345

/frameworks/support/compat/src/androidTest/java/androidx/core/math/
DMathUtilsTest.java34 assertEquals(0, MathUtils.clamp(-4, 0, 7)); in testClamp()
35 assertEquals(3, MathUtils.clamp(3, -2, 7)); in testClamp()
36 assertEquals(0, MathUtils.clamp(0, 0, 7)); in testClamp()
37 assertEquals(7, MathUtils.clamp(7, 0, 7)); in testClamp()
38 assertEquals(7, MathUtils.clamp(8, -2, 7)); in testClamp()
41 assertEquals(0.0, MathUtils.clamp(-0.4, 0.0, 7.0), 0.0); in testClamp()
42 assertEquals(3.0, MathUtils.clamp(3.0, 0.0, 7.0), 0.0); in testClamp()
43 assertEquals(0.1, MathUtils.clamp(0.1, 0.0, 7.0), 0.0); in testClamp()
44 assertEquals(7.0, MathUtils.clamp(7.0, 0.0, 7.0), 0.0); in testClamp()
45 assertEquals(-0.6, MathUtils.clamp(-0.7, -0.6, 7.0), 0.0); in testClamp()
[all …]
/frameworks/base/packages/SettingsLib/src/com/android/settingslib/display/
DBrightnessUtils.java19 import android.util.MathUtils;
54 final float normalizedVal = MathUtils.norm(0, GAMMA_SPACE_MAX, val); in convertGammaToLinear()
57 ret = MathUtils.sq(normalizedVal / R); in convertGammaToLinear()
59 ret = MathUtils.exp((normalizedVal - C) / A) + B; in convertGammaToLinear()
64 return Math.round(MathUtils.lerp(min, max, ret / 12)); in convertGammaToLinear()
91 final float normalizedVal = MathUtils.norm(min, max, val) * 12; in convertLinearToGamma()
94 ret = MathUtils.sqrt(normalizedVal) * R; in convertLinearToGamma()
96 ret = A * MathUtils.log(normalizedVal - B) + C; in convertLinearToGamma()
99 return Math.round(MathUtils.lerp(0, GAMMA_SPACE_MAX, ret)); in convertLinearToGamma()
DDisplayDensityUtils.java29 import android.util.MathUtils;
111 final int numLarger = (int) MathUtils.constrain((maxScale - 1) / MIN_SCALE_INTERVAL, in DisplayDensityUtils()
113 final int numSmaller = (int) MathUtils.constrain((1 - minScale) / MIN_SCALE_INTERVAL, in DisplayDensityUtils()
/frameworks/base/libs/hwui/
DFloatColor.h54 return MathUtils::areEqual(r, other.r) && MathUtils::areEqual(g, other.g) &&
55 MathUtils::areEqual(b, other.b) && MathUtils::areEqual(a, other.a);
DTexture.cpp397 if (MathUtils::isZero(p.e) && MathUtils::isZero(p.f)) { in getTransferFunctionType()
398 if (MathUtils::areEqual(p.a, 1.0f) && MathUtils::isZero(p.b) && in getTransferFunctionType()
399 MathUtils::isZero(p.c) && MathUtils::isZero(p.d)) { in getTransferFunctionType()
400 if (MathUtils::areEqual(p.g, 1.0f)) { in getTransferFunctionType()
DOutline.h54 if (MathUtils::isPositive(radius)) { in setRoundRect()
99 return willClip() && MathUtils::isPositive(mRadius); in willRoundRectClip()
DRenderProperties.cpp130 if (mPrimitiveFields.mAlpha < 1 && !MathUtils::isZero(mPrimitiveFields.mAlpha)) { in debugOutputProperties()
191 if (MathUtils::isZero(getRotationX()) && MathUtils::isZero(getRotationY())) { in updateMatrix()
/frameworks/base/services/core/java/com/android/server/display/
DBrightnessMappingStrategy.java24 import android.util.MathUtils;
243 brightness = MathUtils.constrain(brightness, in normalizeAbsoluteBrightness()
301 float newBrightness = MathUtils.constrain( in smoothCurve()
317 float newBrightness = MathUtils.constrain( in smoothCurve()
332 return MathUtils.exp(MAX_GRAD in permissibleRatio()
333 * (MathUtils.log(currLux + LUX_GRAD_SMOOTHING) in permissibleRatio()
334 - MathUtils.log(prevLux + LUX_GRAD_SMOOTHING))); in permissibleRatio()
353 gamma = MathUtils.log(desiredBrightness) / MathUtils.log(currentBrightness); in inferAutoBrightnessAdjustment()
355 adjustment = -MathUtils.log(gamma) / MathUtils.log(maxGamma); in inferAutoBrightnessAdjustment()
357 adjustment = MathUtils.constrain(adjustment, -1, +1); in inferAutoBrightnessAdjustment()
[all …]
/frameworks/base/services/tests/servicestests/src/com/android/server/display/
DBrightnessMappingStrategyTest.java35 import android.util.MathUtils;
368 minBrightness = (float) MathUtils.pow(minBrightness, MAXIMUM_GAMMA); // Gamma correction. in assertStrategyAdaptsToUserDataPoints()
477 strategy.addUserDataPoint(x2, (float) MathUtils.pow(y2, gamma)); in testGammaCorrectionLowChangeAtCenter()
478 assertEquals(MathUtils.pow(y1, gamma), strategy.getBrightness(x1), 0.01f /* tolerance */); in testGammaCorrectionLowChangeAtCenter()
479 assertEquals(MathUtils.pow(y2, gamma), strategy.getBrightness(x2), 0.01f /* tolerance */); in testGammaCorrectionLowChangeAtCenter()
480 assertEquals(MathUtils.pow(y3, gamma), strategy.getBrightness(x3), 0.01f /* tolerance */); in testGammaCorrectionLowChangeAtCenter()
506 strategy.addUserDataPoint(x2, (float) MathUtils.pow(y2, gamma)); in testGammaCorrectionHighChangeAtCenter()
507 assertEquals(MathUtils.pow(y1, minGamma), strategy.getBrightness(x1), in testGammaCorrectionHighChangeAtCenter()
509 assertEquals(MathUtils.pow(y2, gamma), strategy.getBrightness(x2), in testGammaCorrectionHighChangeAtCenter()
511 assertEquals(MathUtils.pow(y3, minGamma), strategy.getBrightness(x3), in testGammaCorrectionHighChangeAtCenter()
[all …]
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/phone/
DKeyguardClockPositionAlgorithm.java22 import android.util.MathUtils;
206 final float clockY = MathUtils.lerp(clockYTarget, clockYRegular, shadeExpansion); in getClockY()
208 return (int) MathUtils.lerp(clockY, clockYDark, mDarkAmount); in getClockY()
227 return MathUtils.lerp(alphaKeyguard, 1f, mDarkAmount);
DScrimState.java21 import android.util.MathUtils;
62 return MathUtils.map(0 /* start */, 1 /* stop */, in getBehindAlpha()
/frameworks/support/compat/src/main/java/androidx/core/math/
DMathUtils.java22 public class MathUtils { class
24 private MathUtils() {} in MathUtils() method in MathUtils
/frameworks/base/packages/SystemUI/src/com/android/systemui/statusbar/notification/
DActivityLaunchAnimator.java26 import android.util.MathUtils;
174 int newWidth = (int) MathUtils.lerp(notificationWidth, in onAnimationStart()
178 mParams.top = (int) MathUtils.lerp(mParams.startPosition[1], in onAnimationStart()
180 mParams.bottom = (int) MathUtils.lerp(mParams.startPosition[1] in onAnimationStart()
293 clipTopAmountCompensation = (int) MathUtils.lerp(0, startClipTopAmount, in getTopChange()
304 return MathUtils.constrain((linearProgress * ANIMATION_DURATION - delay) in getProgress()
/frameworks/base/core/java/android/os/
DParcelableParcel.java19 import android.util.MathUtils;
43 src.setDataPosition(MathUtils.addOrThrow(pos, size)); in ParcelableParcel()
/frameworks/base/services/accessibility/java/com/android/server/accessibility/
DGestureUtils.java3 import android.util.MathUtils;
35 return MathUtils.dist(first.getX(), first.getY(), second.getX(), second.getY()); in distance()
DMagnificationController.java33 import android.util.MathUtils;
443 scale = MathUtils.constrain(scale, MIN_SCALE, MAX_SCALE); in setScale()
627 final float normScale = MathUtils.constrain(scale, MIN_SCALE, MAX_SCALE); in updateMagnificationSpecLocked()
653 final float offsetX = MathUtils.constrain(nonNormOffsetX, getMinOffsetXLocked(), 0); in updateCurrentSpecWithOffsetsLocked()
658 final float offsetY = MathUtils.constrain(nonNormOffsetY, getMinOffsetYLocked(), 0); in updateCurrentSpecWithOffsetsLocked()
/frameworks/base/libs/hwui/tests/common/
DTestUtils.h42 EXPECT_TRUE(MathUtils::areEqual((a).left, (b).left) && \
43 MathUtils::areEqual((a).top, (b).top) && \
44 MathUtils::areEqual((a).right, (b).right) && \
45 MathUtils::areEqual((a).bottom, (b).bottom));
165 if (!MathUtils::areEqual(a[i], b[i])) { in matricesAreApproxEqual()
/frameworks/base/core/java/android/widget/
DTextInputTimePickerView.java25 import android.util.MathUtils;
206 MathUtils.constrain(hour, minHour, maxHour))); in parseAndSetHourInternal()
221 mListener.onValueChanged(MINUTES, MathUtils.constrain(minutes, 0, 59)); in parseAndSetMinuteInternal()
/frameworks/base/packages/SystemUI/src/com/android/systemui/qs/
DTouchAnimator.java18 import android.util.MathUtils;
56 float t = MathUtils.constrain((fraction - mStartDelay) / mSpan, 0, 1); in setPosition()
212 int i = MathUtils.constrain((int) Math.ceil(fraction / mFrameWidth), 1, mSize - 1); in setValue()
/frameworks/layoutlib/bridge/src/com/android/internal/view/animation/
DNativeInterpolatorFactoryHelper_Delegate.java23 import android.util.MathUtils;
132 return MathUtils.lerp(mValues[i1], mValues[i2], weight); in getInterpolation()
/frameworks/base/core/java/com/android/internal/util/
DProgressReporter.java25 import android.util.MathUtils;
147 + MathUtils.constrain((n * mSegmentRange[1]) / m, 0, mSegmentRange[1]); in setProgress()
/frameworks/base/graphics/java/android/graphics/drawable/
DRippleForeground.java28 import android.util.MathUtils;
316 return MathUtils.lerp(mClampedStartingX - mBounds.exactCenterX(), mTargetX, mTweenX); in getCurrentX()
320 return MathUtils.lerp(mClampedStartingY - mBounds.exactCenterY(), mTargetY, mTweenY); in getCurrentY()
324 return MathUtils.lerp(mStartRadius, mTargetRadius, mTweenRadius); in getCurrentRadius()
/frameworks/base/core/java/android/util/
DMathUtils.java24 public final class MathUtils { class
28 private MathUtils() { in MathUtils() method in MathUtils
/frameworks/base/media/java/android/media/
DMetadata.java21 import android.util.MathUtils;
337 parcel.setDataPosition(MathUtils.addOrThrow(start, size)); in scanAllRecords()
/frameworks/base/libs/hwui/utils/
DMathUtils.h28 class MathUtils {

12345