mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
don't allocate new Runnable on every draw
This commit is contained in:
parent
673ab53a61
commit
5d32fce43e
1 changed files with 7 additions and 5 deletions
|
@ -51,6 +51,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
private Context m_context;
|
||||
private int m_defaultFontHt;
|
||||
private int m_mediumFontHt;
|
||||
private Runnable m_invalidator;
|
||||
private int m_jniGamePtr;
|
||||
private CurGameInfo m_gi;
|
||||
private int m_layoutWidth;
|
||||
|
@ -76,6 +77,11 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
final float scale = getResources().getDisplayMetrics().density;
|
||||
m_defaultFontHt = (int)(MIN_FONT_DIPS * scale + 0.5f);
|
||||
m_mediumFontHt = m_defaultFontHt * 3 / 2;
|
||||
m_invalidator = new Runnable() {
|
||||
public void run() {
|
||||
invalidate();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -293,11 +299,7 @@ public class BoardView extends View implements BoardHandler, SyncedDraw {
|
|||
}
|
||||
|
||||
// Force update now that we have bits to copy
|
||||
m_parent.runOnUiThread( new Runnable() {
|
||||
public void run() {
|
||||
invalidate();
|
||||
}
|
||||
});
|
||||
m_parent.runOnUiThread( m_invalidator );
|
||||
}
|
||||
|
||||
public void dimsChanged( BoardDims dims )
|
||||
|
|
Loading…
Reference in a new issue