mirror of
https://github.com/jamessanford/kegs.git
synced 2025-01-24 14:29:46 +00:00
Shuffle more into BitmapThread.
This commit is contained in:
parent
406dc13ff3
commit
ab5f7bd39a
@ -11,15 +11,15 @@ import android.view.SurfaceHolder;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
|
||||
class BitmapThread extends Thread {
|
||||
public Handler mHandler = new Handler() {
|
||||
private Handler mHandler = new Handler() {
|
||||
public void handleMessage(Message msg) {
|
||||
updateScreen();
|
||||
}
|
||||
};
|
||||
|
||||
private SurfaceHolder mSurfaceHolder;
|
||||
private final ReentrantLock mSurfaceLock = new ReentrantLock();
|
||||
private Bitmap mBitmap;
|
||||
private ReentrantLock mSurfaceLock;
|
||||
private Canvas mCanvas;
|
||||
private boolean mHaveSurface = false;
|
||||
private boolean mScaled = false;
|
||||
@ -30,10 +30,9 @@ class BitmapThread extends Thread {
|
||||
|
||||
private FpsCounter fpsCount = new FpsCounter("kegs", "thread");
|
||||
|
||||
public void setBitmap(SurfaceHolder surfaceHolder, Bitmap bitmap, ReentrantLock surfaceLock) {
|
||||
public void setBitmap(SurfaceHolder surfaceHolder, Bitmap bitmap) {
|
||||
mSurfaceHolder = surfaceHolder;
|
||||
mBitmap = bitmap;
|
||||
mSurfaceLock = surfaceLock;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
|
@ -29,7 +29,7 @@ class KegsView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
|
||||
protected ConcurrentLinkedQueue<Event.KegsEvent> mEventQueue = new ConcurrentLinkedQueue<Event.KegsEvent>();
|
||||
|
||||
private BitmapThread mBitmapThread;
|
||||
private final BitmapThread mBitmapThread = new BitmapThread();
|
||||
|
||||
class KegsThread extends Thread {
|
||||
private Handler mHandler;
|
||||
@ -37,7 +37,6 @@ class KegsView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
private Canvas mCanvas;
|
||||
private SurfaceHolder mSurfaceHolder;
|
||||
private Context mContext;
|
||||
private final ReentrantLock mSurfaceLock = new ReentrantLock();
|
||||
private final ReentrantLock mPauseLock = new ReentrantLock();
|
||||
|
||||
public KegsThread(SurfaceHolder surfaceHolder, Context context) {
|
||||
@ -49,10 +48,8 @@ class KegsView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
Bitmap.Config.ARGB_8888);
|
||||
mBitmap.setHasAlpha(false);
|
||||
|
||||
mBitmapThread = new BitmapThread();
|
||||
mBitmapThread.setBitmap(surfaceHolder, mBitmap);
|
||||
mHandler = mBitmapThread.getHandler();
|
||||
|
||||
mBitmapThread.setBitmap(surfaceHolder, mBitmap, mSurfaceLock);
|
||||
}
|
||||
|
||||
private FpsCounter fpsCount = new FpsCounter("kegs", "native");
|
||||
|
Loading…
x
Reference in New Issue
Block a user