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

Commit 23f27428 authored by Robert Carr's avatar Robert Carr Committed by android-build-merger
Browse files

Account for scaling of surfaceInset area in magnification. am: 298f9278

am: b2074283

Change-Id: I466ec1c5a155640561d1559258421bffacea06ba
parents 84717d41 b2074283
Loading
Loading
Loading
Loading
+18 −8
Original line number Diff line number Diff line
@@ -926,6 +926,22 @@ class WindowStateAnimator {
        mPendingDestroySurface = null;
    }

    void applyMagnificationSpec(MagnificationSpec spec, Matrix transform) {
        final int surfaceInsetLeft = mWin.mAttrs.surfaceInsets.left;
        final int surfaceInsetTop = mWin.mAttrs.surfaceInsets.top;

        if (spec != null && !spec.isNop()) {
            float scale = spec.scale;
            transform.postScale(scale, scale);
            transform.postTranslate(spec.offsetX, spec.offsetY);

            // As we are scaling the whole surface, to keep the content
            // in the same position we will also have to scale the surfaceInsets.
            transform.postTranslate(-(surfaceInsetLeft*scale - surfaceInsetLeft),
                    -(surfaceInsetTop*scale - surfaceInsetTop));
        }
    }

    void computeShownFrameLocked() {
        final boolean selfTransformation = mHasLocalTransformation;
        Transformation attachedTransformation =
@@ -1016,10 +1032,7 @@ class WindowStateAnimator {
            if (mService.mAccessibilityController != null && displayId == DEFAULT_DISPLAY) {
                MagnificationSpec spec = mService.mAccessibilityController
                        .getMagnificationSpecForWindowLocked(mWin);
                if (spec != null && !spec.isNop()) {
                    tmpMatrix.postScale(spec.scale, spec.scale);
                    tmpMatrix.postTranslate(spec.offsetX, spec.offsetY);
                }
                applyMagnificationSpec(spec, tmpMatrix);
            }

            // "convert" it into SurfaceFlinger's format
@@ -1118,10 +1131,7 @@ class WindowStateAnimator {
            tmpMatrix.setScale(mWin.mGlobalScale, mWin.mGlobalScale);
            tmpMatrix.postTranslate(frame.left + mWin.mXOffset, frame.top + mWin.mYOffset);

            if (spec != null && !spec.isNop()) {
                tmpMatrix.postScale(spec.scale, spec.scale);
                tmpMatrix.postTranslate(spec.offsetX, spec.offsetY);
            }
            applyMagnificationSpec(spec, tmpMatrix);

            tmpMatrix.getValues(tmpFloats);