Avoid redundant setMatrix calls from setMatrixInTransaction This matches the behavior of setPositionInTransaction and setSizeInTransaction. am: 8dd88f649b
am: 36d5474ef8
Change-Id: Iaca05f400b080d80a5fb1b9b2882d303a836b638
This commit is contained in:
@@ -57,6 +57,12 @@ class WindowSurfaceController {
|
|||||||
private float mSurfaceW = 0;
|
private float mSurfaceW = 0;
|
||||||
private float mSurfaceH = 0;
|
private float mSurfaceH = 0;
|
||||||
|
|
||||||
|
// Initialize to the identity matrix.
|
||||||
|
private float mLastDsdx = 1;
|
||||||
|
private float mLastDtdx = 0;
|
||||||
|
private float mLastDsdy = 0;
|
||||||
|
private float mLastDtdy = 1;
|
||||||
|
|
||||||
private float mSurfaceAlpha = 0;
|
private float mSurfaceAlpha = 0;
|
||||||
|
|
||||||
private int mSurfaceLayer = 0;
|
private int mSurfaceLayer = 0;
|
||||||
@@ -266,6 +272,17 @@ class WindowSurfaceController {
|
|||||||
|
|
||||||
void setMatrixInTransaction(float dsdx, float dtdx, float dsdy, float dtdy,
|
void setMatrixInTransaction(float dsdx, float dtdx, float dsdy, float dtdy,
|
||||||
boolean recoveringMemory) {
|
boolean recoveringMemory) {
|
||||||
|
final boolean matrixChanged = mLastDsdx != dsdx || mLastDtdx != dtdx ||
|
||||||
|
mLastDsdy != dsdy || mLastDtdy != dtdy;
|
||||||
|
if (!matrixChanged) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mLastDsdx = dsdx;
|
||||||
|
mLastDtdx = dtdx;
|
||||||
|
mLastDsdy = dsdy;
|
||||||
|
mLastDtdy = dtdy;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (SHOW_TRANSACTIONS) logSurface(
|
if (SHOW_TRANSACTIONS) logSurface(
|
||||||
"MATRIX [" + dsdx + "," + dtdx + "," + dsdy + "," + dtdy + "]", null);
|
"MATRIX [" + dsdx + "," + dtdx + "," + dsdy + "," + dtdy + "]", null);
|
||||||
@@ -281,7 +298,6 @@ class WindowSurfaceController {
|
|||||||
mAnimator.reclaimSomeSurfaceMemory("matrix", true);
|
mAnimator.reclaimSomeSurfaceMemory("matrix", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean setSizeInTransaction(int width, int height, boolean recoveringMemory) {
|
boolean setSizeInTransaction(int width, int height, boolean recoveringMemory) {
|
||||||
@@ -318,6 +334,10 @@ class WindowSurfaceController {
|
|||||||
mSurfaceControl.setAlpha(alpha);
|
mSurfaceControl.setAlpha(alpha);
|
||||||
mSurfaceLayer = layer;
|
mSurfaceLayer = layer;
|
||||||
mSurfaceControl.setLayer(layer);
|
mSurfaceControl.setLayer(layer);
|
||||||
|
mLastDsdx = dsdx;
|
||||||
|
mLastDtdx = dtdx;
|
||||||
|
mLastDsdy = dsdy;
|
||||||
|
mLastDtdy = dtdy;
|
||||||
mSurfaceControl.setMatrix(
|
mSurfaceControl.setMatrix(
|
||||||
dsdx, dtdx, dsdy, dtdy);
|
dsdx, dtdx, dsdy, dtdy);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user