Merge "Ensure crop rect is scaled appropriately."

This commit is contained in:
Rob Carr
2015-11-02 21:31:08 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 13 deletions

View File

@@ -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);
}
}
}

View File

@@ -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 {