diff options
| author | Romain Guy <romainguy@google.com> | 2011-10-10 13:57:47 -0700 |
|---|---|---|
| committer | Romain Guy <romainguy@google.com> | 2011-10-10 13:57:47 -0700 |
| commit | 589b0bb6ab81657ba201cbc441a49f85305170bc (patch) | |
| tree | 17f825cfeb26e710794e87b3c7d37dfbefba7a79 /core/java/android/view/TextureView.java | |
| parent | 9dcd5afabe37872eab1b0bf2d4cab7f36b9f30a1 (diff) | |
Make sure we have the correct GL context when grabbing a bitmap
Bug #5427391
Change-Id: I4687a6a3e8968fc3ca8ef171833b2bb7afc16f89
Diffstat (limited to 'core/java/android/view/TextureView.java')
| -rw-r--r-- | core/java/android/view/TextureView.java | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/java/android/view/TextureView.java b/core/java/android/view/TextureView.java index d57132aef84d..169738257b3b 100644 --- a/core/java/android/view/TextureView.java +++ b/core/java/android/view/TextureView.java @@ -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; |
