提交 16c41120 编写于 作者: J Jason Simmons 提交者: GitHub

Render software rasterizer bitmaps through the SurfaceHolder (#3736)

上级 fe827576
......@@ -86,8 +86,6 @@ public class FlutterView extends SurfaceView
private long mNativePlatformView;
private boolean mIsSoftwareRenderingEnabled = false; // using the software renderer or not
private volatile Bitmap mSoftwareRenderingBitmap;
public FlutterView(Context context) {
this(context, null);
}
......@@ -206,19 +204,16 @@ public class FlutterView extends SurfaceView
return super.onKeyDown(keyCode, event);
}
@Override
protected void onDraw(Canvas canvas) {
if (mSoftwareRenderingBitmap != null) {
canvas.drawBitmap(mSoftwareRenderingBitmap, new Matrix(), new Paint());
}
}
// This method will be called on the GPU Thread.
public void updateSoftwareBuffer(ByteBuffer buffer, int width, int height) {
Bitmap newBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
newBitmap.copyPixelsFromBuffer(buffer);
mSoftwareRenderingBitmap = newBitmap;
postInvalidate();
Bitmap bitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
bitmap.copyPixelsFromBuffer(buffer);
Canvas canvas = getHolder().lockCanvas();
if (canvas != null) {
canvas.drawBitmap(bitmap, new Matrix(), null);
getHolder().unlockCanvasAndPost(canvas);
}
}
public void addActivityLifecycleListener(ActivityLifecycleListener listener) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册