eliminate flicker on opening board: don't start drawing tile if can't

finish
This commit is contained in:
Eric House 2013-11-12 06:34:56 -08:00
parent 282b32396f
commit f14be36bbc

View file

@ -549,7 +549,8 @@ public class BoardCanvas extends Canvas implements DrawCtx {
private boolean drawTileImpl( Rect rect, String text, int val, private boolean drawTileImpl( Rect rect, String text, int val,
int flags, boolean clearBack ) int flags, boolean clearBack )
{ {
boolean drew = true; boolean canDraw = figureFontDims();
if ( canDraw ) {
// boolean valHidden = (flags & CELL_VALHIDDEN) != 0; // boolean valHidden = (flags & CELL_VALHIDDEN) != 0;
boolean notEmpty = (flags & CELL_ISEMPTY) == 0; boolean notEmpty = (flags & CELL_ISEMPTY) == 0;
boolean isCursor = (flags & CELL_ISCURSOR) != 0; boolean isCursor = (flags & CELL_ISCURSOR) != 0;
@ -573,7 +574,7 @@ public class BoardCanvas extends Canvas implements DrawCtx {
m_fillPaint.setColor( m_playerColors[m_trayOwner] ); m_fillPaint.setColor( m_playerColors[m_trayOwner] );
if ( notEmpty ) { if ( notEmpty ) {
drew = positionDrawTile( rect, text, val ); positionDrawTile( rect, text, val );
Paint paint = getTileStrokePaint( rect ); Paint paint = getTileStrokePaint( rect );
drawRect( rect, paint ); // frame drawRect( rect, paint ); // frame
@ -585,7 +586,8 @@ public class BoardCanvas extends Canvas implements DrawCtx {
} }
} }
restoreToCount(1); // in case new canvas.... restoreToCount(1); // in case new canvas....
return drew; }
return canDraw;
} // drawTileImpl } // drawTileImpl
private void drawCrosshairs( final Rect rect, final int flags ) private void drawCrosshairs( final Rect rect, final int flags )
@ -662,10 +664,8 @@ public class BoardCanvas extends Canvas implements DrawCtx {
drawBitmap( bitmap, null, rect, m_drawPaint ); drawBitmap( bitmap, null, rect, m_drawPaint );
} }
private boolean positionDrawTile( final Rect rect, String text, int val ) private void positionDrawTile( final Rect rect, String text, int val )
{ {
boolean canDraw = figureFontDims();
if ( canDraw ) {
final int offset = 2; final int offset = 2;
if ( null != text ) { if ( null != text ) {
if ( null == m_letterRect ) { if ( null == m_letterRect ) {
@ -698,8 +698,6 @@ public class BoardCanvas extends Canvas implements DrawCtx {
} }
} }
} }
return canDraw;
}
private void fillRectOther( Rect rect, int index ) private void fillRectOther( Rect rect, int index )
{ {