Fixes long screenshot landscape and split window bugs

Fixes incorrect view transform in ViewRenderer

The tranform was mapping to on-screen coordinates, where
in-window position is needed.

Bug: 183045126
Bug: 189289758
Bug: 189235588

Test: manual, long screenshot the bottom app in split window mode
Change-Id: Ibaa9987b229f9e8ec0a1002ee84d797ca6026fb9
This commit is contained in:
Mark Renouf
2021-06-22 10:15:40 -04:00
parent e1ae3b743e
commit 1c996ad287

View File

@@ -198,12 +198,9 @@ public class ScrollCaptureViewSupport<V extends View> implements ScrollCaptureCa
private static final float LIGHT_RADIUS_DP = 800;
private static final String TAG = "ViewRenderer";
private HardwareRenderer mRenderer;
private RenderNode mCaptureRenderNode;
private final RectF mTempRectF = new RectF();
private final Rect mSourceRect = new Rect();
private final HardwareRenderer mRenderer;
private final RenderNode mCaptureRenderNode;
private final Rect mTempRect = new Rect();
private final Matrix mTempMatrix = new Matrix();
private final int[] mTempLocation = new int[2];
private long mLastRenderedSourceDrawingId = -1;
private Surface mSurface;
@@ -313,11 +310,9 @@ public class ScrollCaptureViewSupport<V extends View> implements ScrollCaptureCa
}
private void transformToRoot(View local, Rect localRect, Rect outRect) {
mTempMatrix.reset();
local.transformMatrixToGlobal(mTempMatrix);
mTempRectF.set(localRect);
mTempMatrix.mapRect(mTempRectF);
mTempRectF.round(outRect);
local.getLocationInWindow(mTempLocation);
outRect.set(localRect);
outRect.offset(mTempLocation[0], mTempLocation[1]);
}
public void setColorMode(@ColorMode int colorMode) {