Merge "Ensure previous background color is reapplied when showing a SurfaceView" into rvc-dev am: 7da77f4141
Change-Id: I81f74fba1c9d28be05cea9ebe1577044e9640380
This commit is contained in:
@@ -176,6 +176,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
|
|||||||
boolean mUseAlpha = false;
|
boolean mUseAlpha = false;
|
||||||
float mSurfaceAlpha = 1f;
|
float mSurfaceAlpha = 1f;
|
||||||
boolean mClipSurfaceToBounds;
|
boolean mClipSurfaceToBounds;
|
||||||
|
int mBackgroundColor = Color.BLACK;
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
boolean mHaveFrame = false;
|
boolean mHaveFrame = false;
|
||||||
@@ -828,6 +829,12 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Transaction updateBackgroundColor(Transaction t) {
|
||||||
|
final float[] colorComponents = new float[] { Color.red(mBackgroundColor) / 255.f,
|
||||||
|
Color.green(mBackgroundColor) / 255.f, Color.blue(mBackgroundColor) / 255.f };
|
||||||
|
t.setColor(mBackgroundControl, colorComponents);
|
||||||
|
return t;
|
||||||
|
}
|
||||||
|
|
||||||
private void releaseSurfaces() {
|
private void releaseSurfaces() {
|
||||||
mSurfaceAlpha = 1f;
|
mSurfaceAlpha = 1f;
|
||||||
@@ -1000,6 +1007,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateBackgroundVisibility(mTmpTransaction);
|
updateBackgroundVisibility(mTmpTransaction);
|
||||||
|
updateBackgroundColor(mTmpTransaction);
|
||||||
if (mUseAlpha) {
|
if (mUseAlpha) {
|
||||||
mTmpTransaction.setAlpha(mSurfaceControl, alpha);
|
mTmpTransaction.setAlpha(mSurfaceControl, alpha);
|
||||||
mSurfaceAlpha = alpha;
|
mSurfaceAlpha = alpha;
|
||||||
@@ -1399,10 +1407,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final float[] colorComponents = new float[] { Color.red(bgColor) / 255.f,
|
mBackgroundColor = bgColor;
|
||||||
Color.green(bgColor) / 255.f, Color.blue(bgColor) / 255.f };
|
updateBackgroundColor(mTmpTransaction).apply();
|
||||||
|
|
||||||
mTmpTransaction.setColor(mBackgroundControl, colorComponents).apply();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@UnsupportedAppUsage
|
@UnsupportedAppUsage
|
||||||
|
|||||||
Reference in New Issue
Block a user