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

Commit c356b2a5 authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "Ensure crop rect is scaled appropriately."

parents 31b09bdc 58f2913f
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -1999,4 +1999,13 @@ final class WindowState implements WindowManagerPolicy.WindowState {
        }
        return mStringNameCache;
    }

    void transformFromScreenToSurfaceSpace(Rect rect) {
         if (mHScale >= 0) {
            rect.right = rect.left + (int)((rect.right - rect.left) / mHScale);
        }
        if (mVScale >= 0) {
            rect.bottom = rect.top + (int)((rect.bottom - rect.top) / mVScale);
        }
    }
}
+5 −13
Original line number Diff line number Diff line
@@ -1223,14 +1223,6 @@ class WindowStateAnimator {
                    mShownAlpha *= appTransformation.getAlpha();
                    if (appTransformation.hasClipRect()) {
                        mClipRect.set(appTransformation.getClipRect());
                        if (mWin.mHScale > 0) {
                            mClipRect.left /= mWin.mHScale;
                            mClipRect.right /= mWin.mHScale;
                        }
                        if (mWin.mVScale > 0) {
                            mClipRect.top /= mWin.mVScale;
                            mClipRect.bottom /= mWin.mVScale;
                        }
                        mHasClipRect = true;
                    }
                }
@@ -1350,11 +1342,7 @@ class WindowStateAnimator {
        final DisplayInfo displayInfo = displayContent.getDisplayInfo();

        // Need to recompute a new system decor rect each time.
        if ((w.mAttrs.flags & LayoutParams.FLAG_SCALED) != 0) {
            // Currently can't do this cropping for scaled windows.  We'll
            // just keep the crop rect the same as the source surface.
            w.mSystemDecorRect.set(0, 0, w.mRequestedWidth, w.mRequestedHeight);
        } else if (!w.isDefaultDisplay()) {
        if (!w.isDefaultDisplay()) {
            // On a different display there is no system decor.  Crop the window
            // by the screen boundaries.
            w.mSystemDecorRect.set(0, 0, w.mCompatFrame.width(), w.mCompatFrame.height());
@@ -1407,9 +1395,13 @@ class WindowStateAnimator {
        clipRect.offset(attrs.surfaceInsets.left, attrs.surfaceInsets.top);
        // We don't want to clip to stack bounds windows that are currently doing entrance
        // animation for docked window, otherwise the animating window will be suddenly cut off.

        if (!(mAnimator.mAnimating && w.inDockedWorkspace())) {
            adjustCropToStackBounds(w, clipRect);
        }

        w.transformFromScreenToSurfaceSpace(clipRect);

        if (!clipRect.equals(mLastClipRect)) {
            mLastClipRect.set(clipRect);
            try {