From 0ffc5c326ff9b01b8813868e3e2e20891af5492c Mon Sep 17 00:00:00 2001 From: eehouse Date: Fri, 23 Apr 2010 08:37:27 +0000 Subject: [PATCH] don't pass bitmaps into java draw code since they're no longer used. --- xwords4/android/XWords4/jni/drawwrapper.c | 29 +++++-------------- .../org/eehouse/android/xw4/BoardView.java | 27 +++++++---------- .../org/eehouse/android/xw4/jni/DrawCtx.java | 9 +++--- 3 files changed, 23 insertions(+), 42 deletions(-) diff --git a/xwords4/android/XWords4/jni/drawwrapper.c b/xwords4/android/XWords4/jni/drawwrapper.c index 816158ea2..ae791cac7 100644 --- a/xwords4/android/XWords4/jni/drawwrapper.c +++ b/xwords4/android/XWords4/jni/drawwrapper.c @@ -231,8 +231,8 @@ and_draw_drawCell( DrawCtx* dctx, const XP_Rect* rect, const XP_UCHAR* text, const XP_Bitmaps* bitmaps, Tile tile, XP_S16 owner, XWBonusType bonus, HintAtts hintAtts, CellFlags flags ) { - DRAW_CBK_HEADER("drawCell", "(Landroid/graphics/Rect;Ljava/lang/String;" - "[Landroid/graphics/drawable/BitmapDrawable;IIIII)Z" ); + DRAW_CBK_HEADER("drawCell", + "(Landroid/graphics/Rect;Ljava/lang/String;IIIII)Z" ); jobject jrect = makeJRect( draw, JCACHE_RECT0, rect ); jstring jtext = NULL; if ( !!text ) { @@ -242,17 +242,13 @@ and_draw_drawCell( DrawCtx* dctx, const XP_Rect* rect, const XP_UCHAR* text, jtext = (*env)->NewStringUTF( env, text ); } - jobjectArray jbitmaps = !!bitmaps ? makeBitmapsArray( env, bitmaps ) : NULL; jboolean result = (*env)->CallBooleanMethod( env, draw->jdraw, mid, - jrect, jtext, jbitmaps, tile, + jrect, jtext, tile, owner, bonus, hintAtts, flags ); if ( !!jtext ) { (*env)->DeleteLocalRef( env, jtext ); } - if ( !!jbitmaps ) { - (*env)->DeleteLocalRef( env, jbitmaps ); - } return result; } @@ -300,24 +296,20 @@ static void and_draw_drawTile( DrawCtx* dctx, const XP_Rect* rect, const XP_UCHAR* text, const XP_Bitmaps* bitmaps, XP_U16 val, CellFlags flags ) { - DRAW_CBK_HEADER( "drawTile", "(Landroid/graphics/Rect;Ljava/lang/String;" - "[Landroid/graphics/drawable/BitmapDrawable;II)V" ); + DRAW_CBK_HEADER( "drawTile", + "(Landroid/graphics/Rect;Ljava/lang/String;II)V" ); jobject jrect = makeJRect( draw, JCACHE_RECT0, rect ); jstring jtext = NULL; if ( !!text ) { jtext = (*env)->NewStringUTF( env, text ); } - jobjectArray jbitmaps = makeBitmapsArray( env, bitmaps ); (*env)->CallVoidMethod( env, draw->jdraw, mid, - jrect, jtext, jbitmaps, val, flags ); + jrect, jtext, val, flags ); if ( !!jtext ) { (*env)->DeleteLocalRef( env, jtext ); } - if ( !!jbitmaps ) { - (*env)->DeleteLocalRef( env, jbitmaps ); - } } static void @@ -326,8 +318,7 @@ and_draw_drawTileMidDrag( DrawCtx* dctx, const XP_Rect* rect, XP_U16 val, XP_U16 owner, CellFlags flags ) { DRAW_CBK_HEADER( "drawTileMidDrag", - "(Landroid/graphics/Rect;Ljava/lang/String;" - "[Landroid/graphics/drawable/BitmapDrawable;III)V" ); + "(Landroid/graphics/Rect;Ljava/lang/String;III)V" ); jobject jrect = makeJRect( draw, JCACHE_RECT0, rect ); jstring jtext = NULL; @@ -335,16 +326,12 @@ and_draw_drawTileMidDrag( DrawCtx* dctx, const XP_Rect* rect, jtext = (*env)->NewStringUTF( env, text ); } - jobjectArray jbitmaps = makeBitmapsArray( env, bitmaps ); (*env)->CallVoidMethod( env, draw->jdraw, mid, - jrect, jtext, jbitmaps, val, owner, flags ); + jrect, jtext, val, owner, flags ); if ( !!jtext ) { (*env)->DeleteLocalRef( env, jtext ); } - if ( !!jbitmaps ) { - (*env)->DeleteLocalRef( env, jbitmaps ); - } } static void diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java index 4bc958b11..7528b7907 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/BoardView.java @@ -30,7 +30,6 @@ import android.util.AttributeSet; import org.eehouse.android.xw4.jni.*; import android.view.MotionEvent; import android.graphics.drawable.Drawable; -import android.graphics.drawable.BitmapDrawable; import android.content.res.Resources; import android.graphics.Paint.FontMetricsInt; import android.widget.ZoomButtonsController; @@ -433,9 +432,8 @@ public class BoardView extends View implements DrawCtx, BoardHandler, } } - public boolean drawCell( Rect rect, String text, BitmapDrawable[] bitmaps, - int tile, int owner, int bonus, int hintAtts, - int flags ) + public boolean drawCell( Rect rect, String text, int tile, int owner, + int bonus, int hintAtts, int flags ) { int backColor; boolean empty = 0 != (flags & (CELL_DRAGSRC|CELL_ISEMPTY)); @@ -504,21 +502,20 @@ public class BoardView extends View implements DrawCtx, BoardHandler, return true; } - public void drawTile( Rect rect, String text, BitmapDrawable[] bitmaps, - int val, int flags ) + public void drawTile( Rect rect, String text, int val, int flags ) { - drawTileImpl( rect, text, bitmaps, val, flags, true ); + drawTileImpl( rect, text, val, flags, true ); } - public void drawTileMidDrag( Rect rect, String text, BitmapDrawable[] bitmaps, - int val, int owner, int flags ) + public void drawTileMidDrag( Rect rect, String text, int val, int owner, + int flags ) { - drawTileImpl( rect, text, bitmaps, val, flags, false ); + drawTileImpl( rect, text, val, flags, false ); } public void drawTileBack( Rect rect, int flags ) { - drawTileImpl( rect, "?", null, -1, flags, true ); + drawTileImpl( rect, "?", -1, flags, true ); } public void drawTrayDivider( Rect rect, int flags ) @@ -636,8 +633,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, } } - private void drawTileImpl( Rect rect, String text, - BitmapDrawable[] bitmaps, int val, + private void drawTileImpl( Rect rect, String text, int val, int flags, boolean clearBack ) { // boolean valHidden = (flags & CELL_VALHIDDEN) != 0; @@ -663,7 +659,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, m_fillPaint.setColor( m_playerColors[m_trayOwner] ); if ( notEmpty ) { - positionDrawTile( rect, text, bitmaps, val ); + positionDrawTile( rect, text, val ); m_canvas.drawRect( rect, m_tileStrokePaint); // frame if ( 0 != (flags & CELL_HIGHLIGHT) ) { @@ -722,8 +718,7 @@ public class BoardView extends View implements DrawCtx, BoardHandler, m_canvas.drawBitmap( bitmap, local, rect, m_drawPaint ); } - private void positionDrawTile( final Rect rect, String text, - BitmapDrawable bitmaps[], int val ) + private void positionDrawTile( final Rect rect, String text, int val ) { figureFontDims(); diff --git a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/DrawCtx.java b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/DrawCtx.java index db5843125..ecde5fb7d 100644 --- a/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/DrawCtx.java +++ b/xwords4/android/XWords4/src/org/eehouse/android/xw4/jni/DrawCtx.java @@ -20,7 +20,6 @@ package org.eehouse.android.xw4.jni; import android.graphics.Rect; -import android.graphics.drawable.BitmapDrawable; public interface DrawCtx { static final int CELL_NONE = 0x00; @@ -49,16 +48,16 @@ public interface DrawCtx { void score_drawPlayer( Rect rInner, Rect rOuter, DrawScoreInfo dsi ); void drawTimer( Rect rect, int player, int secondsLeft ); - boolean drawCell( Rect rect, String text, BitmapDrawable[] bitmaps, int tile, + boolean drawCell( Rect rect, String text, int tile, 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, BitmapDrawable[] bitmaps, int val, int flags ); - void drawTileMidDrag ( Rect rect, String text, BitmapDrawable[] bitmaps, - int val, int owner, int flags ); + void drawTile( Rect rect, String text, int val, int flags ); + void drawTileMidDrag ( Rect rect, String text, int val, int owner, + int flags ); void drawTileBack( Rect rect, int flags ); void drawTrayDivider( Rect rect, int flags ); void score_pendingScore( Rect rect, int score, int playerNum, int flags );