From 27772e97805ecc7b78cdea61ee492f19b047476c Mon Sep 17 00:00:00 2001 From: Adnan Begovic Date: Wed, 22 Jan 2025 18:55:57 -0800 Subject: [PATCH] launcher3: Only translate on positive values. Don't translate canvas on non positive values when utilizing delegate cell drawing. Bug: 391731169 Test: manual, existing Flag: com.android.launcher3.one_grid_specs Change-Id: I44f51d40e5a6352e6d4eed2b9e475b2a37b6ea9d --- src/com/android/launcher3/CellLayout.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java index 3d71ff178e..c38444c53f 100644 --- a/src/com/android/launcher3/CellLayout.java +++ b/src/com/android/launcher3/CellLayout.java @@ -529,9 +529,11 @@ public class CellLayout extends ViewGroup { for (int i = 0; i < mDelegatedCellDrawings.size(); i++) { DelegatedCellDrawing cellDrawing = mDelegatedCellDrawings.get(i); - cellToPoint(cellDrawing.mDelegateCellX, cellDrawing.mDelegateCellY, mTempLocation); canvas.save(); - canvas.translate(mTempLocation[0], mTempLocation[1]); + if (cellDrawing.mDelegateCellX >= 0 && cellDrawing.mDelegateCellY >= 0) { + cellToPoint(cellDrawing.mDelegateCellX, cellDrawing.mDelegateCellY, mTempLocation); + canvas.translate(mTempLocation[0], mTempLocation[1]); + } cellDrawing.drawUnderItem(canvas); canvas.restore(); } @@ -660,9 +662,11 @@ public class CellLayout extends ViewGroup { for (int i = 0; i < mDelegatedCellDrawings.size(); i++) { DelegatedCellDrawing bg = mDelegatedCellDrawings.get(i); - cellToPoint(bg.mDelegateCellX, bg.mDelegateCellY, mTempLocation); canvas.save(); - canvas.translate(mTempLocation[0], mTempLocation[1]); + if (bg.mDelegateCellX >= 0 && bg.mDelegateCellY >= 0) { + cellToPoint(bg.mDelegateCellX, bg.mDelegateCellY, mTempLocation); + canvas.translate(mTempLocation[0], mTempLocation[1]); + } bg.drawOverItem(canvas); canvas.restore(); }