Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1d7440ca authored by John Reck's avatar John Reck Committed by Automerger Merge Worker
Browse files

Merge "Prevent hdrSdrRatio from being <1.f" into udc-dev am: 0a66b057

parents 9f0472cb 0a66b057
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -3896,10 +3896,12 @@ public final class SurfaceControl implements Parcelable {
                float currentBufferRatio, float desiredRatio) {
            checkPreconditions(sc);
            if (!Float.isFinite(currentBufferRatio) || currentBufferRatio < 1.0f) {
                throw new IllegalArgumentException("currentBufferRatio must be finite && >= 1.0f");
                throw new IllegalArgumentException(
                        "currentBufferRatio must be finite && >= 1.0f; got " + currentBufferRatio);
            }
            if (!Float.isFinite(desiredRatio) || desiredRatio < 1.0f) {
                throw new IllegalArgumentException("desiredRatio must be finite && >= 1.0f");
                throw new IllegalArgumentException(
                        "desiredRatio must be finite && >= 1.0f; got " + desiredRatio);
            }
            nativeSetExtendedRangeBrightness(mNativeObject, sc.mNativeObject, currentBufferRatio,
                    desiredRatio);
+2 −1
Original line number Diff line number Diff line
@@ -911,7 +911,8 @@ final class LocalDisplayAdapter extends DisplayAdapter {
                        final float newHdrSdrRatio;
                        if (displayNits != DisplayDeviceConfig.NITS_INVALID
                                && sdrNits != DisplayDeviceConfig.NITS_INVALID) {
                            newHdrSdrRatio = displayNits / sdrNits;
                            // Ensure the ratio stays >= 1.0f as values below that are nonsensical
                            newHdrSdrRatio = Math.max(1.f, displayNits / sdrNits);
                        } else {
                            newHdrSdrRatio = Float.NaN;
                        }