mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2024-12-28 09:58:30 +01:00
don't pass bitmaps into java draw code since they're no longer used.
This commit is contained in:
parent
5d31c18658
commit
0ffc5c326f
3 changed files with 23 additions and 42 deletions
|
@ -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
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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 );
|
||||
|
|
Loading…
Reference in a new issue