mirror of
https://github.com/status-im/react-native.git
synced 2025-02-10 16:36:25 +00:00
clean out the last used bitmap
Reviewed By: achen1 Differential Revision: D4828134 fbshipit-source-id: bf54f7c9f61016cc0735338f99de7b0378c1234b
This commit is contained in:
parent
40eb353487
commit
f8e583b2d0
@ -100,6 +100,8 @@ public class ReactAppTestActivity extends FragmentActivity implements
|
|||||||
if (mReactInstanceManager != null) {
|
if (mReactInstanceManager != null) {
|
||||||
mReactInstanceManager.destroy();
|
mReactInstanceManager.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mScreenshotingFrameLayout.clean();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void waitForDestroy(long timeoutMs) throws InterruptedException {
|
public void waitForDestroy(long timeoutMs) throws InterruptedException {
|
||||||
@ -129,6 +131,7 @@ public class ReactAppTestActivity extends FragmentActivity implements
|
|||||||
}
|
}
|
||||||
mReactRootView = new ReactRootView(this);
|
mReactRootView = new ReactRootView(this);
|
||||||
mScreenshotingFrameLayout.removeAllViews();
|
mScreenshotingFrameLayout.removeAllViews();
|
||||||
|
mScreenshotingFrameLayout.clean();
|
||||||
mScreenshotingFrameLayout.addView(mReactRootView);
|
mScreenshotingFrameLayout.addView(mReactRootView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -47,6 +47,14 @@ public class ScreenshotingFrameLayout extends FrameLayout {
|
|||||||
canvas.drawBitmap(mBitmap, 0, 0, null);
|
canvas.drawBitmap(mBitmap, 0, 0, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clean() {
|
||||||
|
if (mBitmap != null) {
|
||||||
|
mBitmap.recycle();
|
||||||
|
mBitmap = null;
|
||||||
|
}
|
||||||
|
mCanvas.setBitmap(null);
|
||||||
|
}
|
||||||
|
|
||||||
private static Bitmap createNewBitmap(Canvas canvas) {
|
private static Bitmap createNewBitmap(Canvas canvas) {
|
||||||
return Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
|
return Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user