mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-15 15:41:24 +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,
|
const XP_Bitmaps* bitmaps, Tile tile, XP_S16 owner,
|
||||||
XWBonusType bonus, HintAtts hintAtts, CellFlags flags )
|
XWBonusType bonus, HintAtts hintAtts, CellFlags flags )
|
||||||
{
|
{
|
||||||
DRAW_CBK_HEADER("drawCell", "(Landroid/graphics/Rect;Ljava/lang/String;"
|
DRAW_CBK_HEADER("drawCell",
|
||||||
"[Landroid/graphics/drawable/BitmapDrawable;IIIII)Z" );
|
"(Landroid/graphics/Rect;Ljava/lang/String;IIIII)Z" );
|
||||||
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
||||||
jstring jtext = NULL;
|
jstring jtext = NULL;
|
||||||
if ( !!text ) {
|
if ( !!text ) {
|
||||||
|
@ -242,17 +242,13 @@ and_draw_drawCell( DrawCtx* dctx, const XP_Rect* rect, const XP_UCHAR* text,
|
||||||
jtext = (*env)->NewStringUTF( env, text );
|
jtext = (*env)->NewStringUTF( env, text );
|
||||||
}
|
}
|
||||||
|
|
||||||
jobjectArray jbitmaps = !!bitmaps ? makeBitmapsArray( env, bitmaps ) : NULL;
|
|
||||||
jboolean result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
|
jboolean result = (*env)->CallBooleanMethod( env, draw->jdraw, mid,
|
||||||
jrect, jtext, jbitmaps, tile,
|
jrect, jtext, tile,
|
||||||
owner, bonus, hintAtts,
|
owner, bonus, hintAtts,
|
||||||
flags );
|
flags );
|
||||||
if ( !!jtext ) {
|
if ( !!jtext ) {
|
||||||
(*env)->DeleteLocalRef( env, jtext );
|
(*env)->DeleteLocalRef( env, jtext );
|
||||||
}
|
}
|
||||||
if ( !!jbitmaps ) {
|
|
||||||
(*env)->DeleteLocalRef( env, jbitmaps );
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -300,24 +296,20 @@ static void
|
||||||
and_draw_drawTile( DrawCtx* dctx, const XP_Rect* rect, const XP_UCHAR* text,
|
and_draw_drawTile( DrawCtx* dctx, const XP_Rect* rect, const XP_UCHAR* text,
|
||||||
const XP_Bitmaps* bitmaps, XP_U16 val, CellFlags flags )
|
const XP_Bitmaps* bitmaps, XP_U16 val, CellFlags flags )
|
||||||
{
|
{
|
||||||
DRAW_CBK_HEADER( "drawTile", "(Landroid/graphics/Rect;Ljava/lang/String;"
|
DRAW_CBK_HEADER( "drawTile",
|
||||||
"[Landroid/graphics/drawable/BitmapDrawable;II)V" );
|
"(Landroid/graphics/Rect;Ljava/lang/String;II)V" );
|
||||||
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
||||||
jstring jtext = NULL;
|
jstring jtext = NULL;
|
||||||
if ( !!text ) {
|
if ( !!text ) {
|
||||||
jtext = (*env)->NewStringUTF( env, text );
|
jtext = (*env)->NewStringUTF( env, text );
|
||||||
}
|
}
|
||||||
|
|
||||||
jobjectArray jbitmaps = makeBitmapsArray( env, bitmaps );
|
|
||||||
(*env)->CallVoidMethod( env, draw->jdraw, mid,
|
(*env)->CallVoidMethod( env, draw->jdraw, mid,
|
||||||
jrect, jtext, jbitmaps, val, flags );
|
jrect, jtext, val, flags );
|
||||||
|
|
||||||
if ( !!jtext ) {
|
if ( !!jtext ) {
|
||||||
(*env)->DeleteLocalRef( env, jtext );
|
(*env)->DeleteLocalRef( env, jtext );
|
||||||
}
|
}
|
||||||
if ( !!jbitmaps ) {
|
|
||||||
(*env)->DeleteLocalRef( env, jbitmaps );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -326,8 +318,7 @@ and_draw_drawTileMidDrag( DrawCtx* dctx, const XP_Rect* rect,
|
||||||
XP_U16 val, XP_U16 owner, CellFlags flags )
|
XP_U16 val, XP_U16 owner, CellFlags flags )
|
||||||
{
|
{
|
||||||
DRAW_CBK_HEADER( "drawTileMidDrag",
|
DRAW_CBK_HEADER( "drawTileMidDrag",
|
||||||
"(Landroid/graphics/Rect;Ljava/lang/String;"
|
"(Landroid/graphics/Rect;Ljava/lang/String;III)V" );
|
||||||
"[Landroid/graphics/drawable/BitmapDrawable;III)V" );
|
|
||||||
|
|
||||||
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
jobject jrect = makeJRect( draw, JCACHE_RECT0, rect );
|
||||||
jstring jtext = NULL;
|
jstring jtext = NULL;
|
||||||
|
@ -335,16 +326,12 @@ and_draw_drawTileMidDrag( DrawCtx* dctx, const XP_Rect* rect,
|
||||||
jtext = (*env)->NewStringUTF( env, text );
|
jtext = (*env)->NewStringUTF( env, text );
|
||||||
}
|
}
|
||||||
|
|
||||||
jobjectArray jbitmaps = makeBitmapsArray( env, bitmaps );
|
|
||||||
(*env)->CallVoidMethod( env, draw->jdraw, mid,
|
(*env)->CallVoidMethod( env, draw->jdraw, mid,
|
||||||
jrect, jtext, jbitmaps, val, owner, flags );
|
jrect, jtext, val, owner, flags );
|
||||||
|
|
||||||
if ( !!jtext ) {
|
if ( !!jtext ) {
|
||||||
(*env)->DeleteLocalRef( env, jtext );
|
(*env)->DeleteLocalRef( env, jtext );
|
||||||
}
|
}
|
||||||
if ( !!jbitmaps ) {
|
|
||||||
(*env)->DeleteLocalRef( env, jbitmaps );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -30,7 +30,6 @@ import android.util.AttributeSet;
|
||||||
import org.eehouse.android.xw4.jni.*;
|
import org.eehouse.android.xw4.jni.*;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
|
||||||
import android.content.res.Resources;
|
import android.content.res.Resources;
|
||||||
import android.graphics.Paint.FontMetricsInt;
|
import android.graphics.Paint.FontMetricsInt;
|
||||||
import android.widget.ZoomButtonsController;
|
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,
|
public boolean drawCell( Rect rect, String text, int tile, int owner,
|
||||||
int tile, int owner, int bonus, int hintAtts,
|
int bonus, int hintAtts, int flags )
|
||||||
int flags )
|
|
||||||
{
|
{
|
||||||
int backColor;
|
int backColor;
|
||||||
boolean empty = 0 != (flags & (CELL_DRAGSRC|CELL_ISEMPTY));
|
boolean empty = 0 != (flags & (CELL_DRAGSRC|CELL_ISEMPTY));
|
||||||
|
@ -504,21 +502,20 @@ public class BoardView extends View implements DrawCtx, BoardHandler,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTile( Rect rect, String text, BitmapDrawable[] bitmaps,
|
public void drawTile( Rect rect, String text, int val, int flags )
|
||||||
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,
|
public void drawTileMidDrag( Rect rect, String text, int val, int owner,
|
||||||
int val, int owner, int flags )
|
int flags )
|
||||||
{
|
{
|
||||||
drawTileImpl( rect, text, bitmaps, val, flags, false );
|
drawTileImpl( rect, text, val, flags, false );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void drawTileBack( Rect rect, int flags )
|
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 )
|
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,
|
private void drawTileImpl( Rect rect, String text, int val,
|
||||||
BitmapDrawable[] bitmaps, int val,
|
|
||||||
int flags, boolean clearBack )
|
int flags, boolean clearBack )
|
||||||
{
|
{
|
||||||
// boolean valHidden = (flags & CELL_VALHIDDEN) != 0;
|
// 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] );
|
m_fillPaint.setColor( m_playerColors[m_trayOwner] );
|
||||||
|
|
||||||
if ( notEmpty ) {
|
if ( notEmpty ) {
|
||||||
positionDrawTile( rect, text, bitmaps, val );
|
positionDrawTile( rect, text, val );
|
||||||
|
|
||||||
m_canvas.drawRect( rect, m_tileStrokePaint); // frame
|
m_canvas.drawRect( rect, m_tileStrokePaint); // frame
|
||||||
if ( 0 != (flags & CELL_HIGHLIGHT) ) {
|
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 );
|
m_canvas.drawBitmap( bitmap, local, rect, m_drawPaint );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void positionDrawTile( final Rect rect, String text,
|
private void positionDrawTile( final Rect rect, String text, int val )
|
||||||
BitmapDrawable bitmaps[], int val )
|
|
||||||
{
|
{
|
||||||
figureFontDims();
|
figureFontDims();
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
package org.eehouse.android.xw4.jni;
|
package org.eehouse.android.xw4.jni;
|
||||||
|
|
||||||
import android.graphics.Rect;
|
import android.graphics.Rect;
|
||||||
import android.graphics.drawable.BitmapDrawable;
|
|
||||||
|
|
||||||
public interface DrawCtx {
|
public interface DrawCtx {
|
||||||
static final int CELL_NONE = 0x00;
|
static final int CELL_NONE = 0x00;
|
||||||
|
@ -49,16 +48,16 @@ public interface DrawCtx {
|
||||||
void score_drawPlayer( Rect rInner, Rect rOuter, DrawScoreInfo dsi );
|
void score_drawPlayer( Rect rInner, Rect rOuter, DrawScoreInfo dsi );
|
||||||
void drawTimer( Rect rect, int player, int secondsLeft );
|
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 );
|
int owner, int bonus, int hintAtts, int flags );
|
||||||
void drawBoardArrow ( Rect rect, int bonus, boolean vert, int hintAtts,
|
void drawBoardArrow ( Rect rect, int bonus, boolean vert, int hintAtts,
|
||||||
int flags );
|
int flags );
|
||||||
boolean vertScrollBoard( Rect /*out*/ rect, int dist, int dfs );
|
boolean vertScrollBoard( Rect /*out*/ rect, int dist, int dfs );
|
||||||
|
|
||||||
boolean trayBegin ( Rect rect, int owner, int dfs );
|
boolean trayBegin ( Rect rect, int owner, int dfs );
|
||||||
void drawTile( Rect rect, String text, BitmapDrawable[] bitmaps, int val, int flags );
|
void drawTile( Rect rect, String text, int val, int flags );
|
||||||
void drawTileMidDrag ( Rect rect, String text, BitmapDrawable[] bitmaps,
|
void drawTileMidDrag ( Rect rect, String text, int val, int owner,
|
||||||
int val, int owner, int flags );
|
int flags );
|
||||||
void drawTileBack( Rect rect, int flags );
|
void drawTileBack( Rect rect, int flags );
|
||||||
void drawTrayDivider( Rect rect, int flags );
|
void drawTrayDivider( Rect rect, int flags );
|
||||||
void score_pendingScore( Rect rect, int score, int playerNum, int flags );
|
void score_pendingScore( Rect rect, int score, int playerNum, int flags );
|
||||||
|
|
Loading…
Reference in a new issue