implement vertical scrolling on platform by copying one part of bitmap

over itself.  It's not noticably faster than letting the common code
simply inval everything, probably because I have to make a copy of the
bitmap to serve as the source.  But I want to check it in to have a
record.
This commit is contained in:
eehouse 2010-04-25 03:38:42 +00:00
parent 9ced0bb154
commit 23747f54ec

View file

@ -490,10 +490,38 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
arrow.draw( m_canvas );
}
public boolean vertScrollBoard( Rect /*out*/ rect, int dist, int dfs )
public boolean vertScrollBoard( Rect /*in/out*/ rect, int dist, int dfs )
{
Utils.logf( "vertScrollBoard" );
return false;
boolean doScroll = true; // set to false to disable and let
// common code scroll by redrawing.
if ( doScroll ) {
// negative dist means scrolling up
boolean down = dist < 0;
if ( down ) {
dist = -dist;
}
Rect src = new Rect( rect );
src.bottom -= dist;
Rect dest = new Rect( src );
if ( down ) {
dest.offset( 0, dist );
} else {
src.offset( 0, dist);
}
// drawBitmap doesn't work if src and dest *bitmaps* are the
// same and rects overlap. So create (immutable) bitmap to
// serve as source.
m_canvas.drawBitmap( Bitmap.createBitmap( m_bitmap ),
src, dest, m_drawPaint );
if ( !down ) {
rect.top = rect.bottom - dist;
}
rect.bottom = rect.top + dist;
}
return doScroll;
}
public boolean trayBegin ( Rect rect, int owner, int dfs )