remove vertScrollBoard from java and stub it out in jni since

preformance is just as good without it.
This commit is contained in:
eehouse 2010-04-25 18:13:29 +00:00
parent fa5d80e85f
commit 9d94f557e1
3 changed files with 5 additions and 55 deletions

View file

@ -67,15 +67,6 @@ makeJRect( AndDraw* draw, int indx, const XP_Rect* rect )
return robj;
} /* makeJRect */
static void
copyJRect( JNIEnv* env, XP_Rect* dest, jobject jrect )
{
dest->left = getInt( env, jrect, "left" );
dest->top = getInt( env, jrect, "top" );
dest->width = getInt( env, jrect, "right" ) - dest->left;
dest->height = getInt( env, jrect, "bottom" ) - dest->top;
}
static jobject
makeDSI( AndDraw* draw, int indx, const DrawScoreInfo* dsi )
{
@ -265,17 +256,12 @@ and_draw_drawBoardArrow(DrawCtx* dctx, const XP_Rect* rect, XWBonusType bonus,
}
static XP_Bool
and_draw_vertScrollBoard( DrawCtx* dctx, XP_Rect* rect, XP_S16 dist,
DrawFocusState dfs )
and_draw_vertScrollBoard( DrawCtx* XP_UNUSED(dctx), XP_Rect* XP_UNUSED(rect),
XP_S16 XP_UNUSED(dist), DrawFocusState XP_UNUSED(dfs) )
{
DRAW_CBK_HEADER( "vertScrollBoard", "(Landroid/graphics/Rect;II)Z" );
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
jboolean result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
jrect, dist, dfs );
copyJRect( env, rect, jrect );
return result;
/* Scrolling a bitmap in-place isn't any faster than drawing every cell
anew so no point in calling into java. */
return XP_FALSE;
}
static XP_Bool

View file

@ -490,40 +490,6 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
arrow.draw( m_canvas );
}
public boolean vertScrollBoard( Rect /*in/out*/ rect, int dist, int dfs )
{
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 )
{
m_trayOwner = owner;

View file

@ -52,8 +52,6 @@ public interface DrawCtx {
int owner, int bonus, int hintAtts, int flags );
void drawBoardArrow ( Rect rect, int bonus, boolean vert, int hintAtts,
int flags );
boolean vertScrollBoard( Rect /*out*/ rect, int dist, int dfs );
boolean trayBegin ( Rect rect, int owner, int dfs );
void drawTile( Rect rect, String text, int val, int flags );
void drawTileMidDrag ( Rect rect, String text, int val, int owner,