File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed
Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -502,9 +502,23 @@ public Bitmap getBitmap(int width, int height) {
502502 * @see #isAvailable()
503503 * @see #getBitmap(int, int)
504504 * @see #getBitmap()
505+ *
506+ * @throws IllegalStateException if the hardware rendering context cannot be
507+ * acquired to capture the bitmap
505508 */
506509 public Bitmap getBitmap (Bitmap bitmap ) {
507510 if (bitmap != null && isAvailable ()) {
511+ AttachInfo info = mAttachInfo ;
512+ if (info != null && info .mHardwareRenderer != null &&
513+ info .mHardwareRenderer .isEnabled ()) {
514+ if (!info .mHardwareRenderer .validate ()) {
515+ throw new IllegalStateException ("Could not acquire hardware rendering context" );
516+ }
517+ }
518+
519+ applyUpdate ();
520+ applyTransformMatrix ();
521+
508522 mLayer .copyInto (bitmap );
509523 }
510524 return bitmap ;
Original file line number Diff line number Diff line change @@ -10125,6 +10125,14 @@ HardwareLayer getHardwareLayer() {
1012510125 return mHardwareLayer;
1012610126 }
1012710127
10128+ /**
10129+ * Destroys this View's hardware layer if possible.
10130+ *
10131+ * @return True if the layer was destroyed, false otherwise.
10132+ *
10133+ * @see #setLayerType(int, android.graphics.Paint)
10134+ * @see #LAYER_TYPE_HARDWARE
10135+ */
1012810136 boolean destroyLayer() {
1012910137 if (mHardwareLayer != null) {
1013010138 mHardwareLayer.destroy();
You can’t perform that action at this time.
0 commit comments