don't use cached bitmap if board's been resized

This commit is contained in:
Eric House 2012-07-19 06:54:56 -07:00
parent 95b68ffae2
commit 2a25bae706

View file

@ -422,9 +422,18 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
BoardDims dims = figureBoardDims( width, height );
// If board size has changed we need a new bitmap
int bmHeight = 1 + dims.height;
int bmWidth = 1 + dims.width;
if ( null != s_bitmap ) {
if ( s_bitmap.getHeight() != bmHeight
|| s_bitmap.getWidth() != bmWidth ) {
s_bitmap = null;
}
}
if ( null == s_bitmap ) {
s_bitmap = Bitmap.createBitmap( 1 + dims.width,
1 + dims.height,
s_bitmap = Bitmap.createBitmap( bmWidth, bmHeight,
Bitmap.Config.ARGB_8888 );
}
m_canvas = new Canvas( s_bitmap );