Merge "Make sure we have the correct GL context when grabbing a bitmap Bug #5427391"
This commit is contained in:
@@ -502,9 +502,23 @@ public class TextureView extends View {
|
||||
* @see #isAvailable()
|
||||
* @see #getBitmap(int, int)
|
||||
* @see #getBitmap()
|
||||
*
|
||||
* @throws IllegalStateException if the hardware rendering context cannot be
|
||||
* acquired to capture the bitmap
|
||||
*/
|
||||
public Bitmap getBitmap(Bitmap bitmap) {
|
||||
if (bitmap != null && isAvailable()) {
|
||||
AttachInfo info = mAttachInfo;
|
||||
if (info != null && info.mHardwareRenderer != null &&
|
||||
info.mHardwareRenderer.isEnabled()) {
|
||||
if (!info.mHardwareRenderer.validate()) {
|
||||
throw new IllegalStateException("Could not acquire hardware rendering context");
|
||||
}
|
||||
}
|
||||
|
||||
applyUpdate();
|
||||
applyTransformMatrix();
|
||||
|
||||
mLayer.copyInto(bitmap);
|
||||
}
|
||||
return bitmap;
|
||||
|
||||
@@ -10125,6 +10125,14 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
|
||||
return mHardwareLayer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Destroys this View's hardware layer if possible.
|
||||
*
|
||||
* @return True if the layer was destroyed, false otherwise.
|
||||
*
|
||||
* @see #setLayerType(int, android.graphics.Paint)
|
||||
* @see #LAYER_TYPE_HARDWARE
|
||||
*/
|
||||
boolean destroyLayer() {
|
||||
if (mHardwareLayer != null) {
|
||||
mHardwareLayer.destroy();
|
||||
|
||||
Reference in New Issue
Block a user