am 99ba7203: Merge "Avoid leaking Surface native object." into jb-mr2-dev

* commit '99ba72039d9d97ea3ed7d01b327b98c87051e989':
  Avoid leaking Surface native object.
This commit is contained in:
Jeff Sharkey
2013-04-25 16:57:54 -07:00
committed by Android Git Automerger

View File

@@ -389,10 +389,14 @@ final class ElectronBeam {
mTexNamesGenerated = true;
}
SurfaceTexture st = new SurfaceTexture(mTexNames[0]);
SurfaceControl.screenshot(SurfaceControl.getBuiltInDisplay(
SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN),
new Surface(st));
final SurfaceTexture st = new SurfaceTexture(mTexNames[0]);
final Surface s = new Surface(st);
try {
SurfaceControl.screenshot(SurfaceControl.getBuiltInDisplay(
SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN), s);
} finally {
s.release();
}
st.updateTexImage();
st.getTransformMatrix(mTexMatrix);