Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1e43657c authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Make sure we have the correct GL context when grabbing a bitmap Bug #5427391"

parents 184b44e7 589b0bb6
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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;
+8 −0
Original line number Diff line number Diff line
@@ -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();