use new board_drawSnapshot() from android

BoardCanvas wouldn't render anything without an associated dict via
dictChanged()
This commit is contained in:
Eric House 2016-08-05 11:34:20 -07:00
parent 7f513313b0
commit 8b142e4a56
5 changed files with 23 additions and 17 deletions

View file

@ -976,6 +976,18 @@ Java_org_eehouse_android_xw4_jni_XwJNI_board_1draw
return result;
}
JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1drawSnapshot
( JNIEnv *env, jclass C, GamePtrType gamePtr, jobject jdraw, jint width,
jint height )
{
XWJNI_START();
DrawCtx* newDraw = makeDraw( MPPARM(mpool) &state->globalJNI->ti, jdraw );
board_drawSnapshot( state->game.board, newDraw, width, height );
destroyDraw( &newDraw );
XWJNI_END();
}
#ifdef COMMON_LAYOUT
JNIEXPORT void JNICALL
Java_org_eehouse_android_xw4_jni_XwJNI_board_1figureLayout

View file

@ -116,20 +116,19 @@
android:defaultValue="@string/game_summary_field_opponents"
/>
<CheckBoxPreference android:key="@string/key_enable_dualpane"
android:title="@string/enable_dualpane_title"
android:summary="@string/enable_dualpane_summary"
<CheckBoxPreference android:key="@string/key_hide_newgames"
android:title="@string/hide_newgames_title"
android:summary="@string/hide_newgames_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_hide_title"
android:title="@string/hide_title"
android:summary="@string/hide_title_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_hide_newgames"
android:title="@string/hide_newgames_title"
android:summary="@string/hide_newgames_summary"
<CheckBoxPreference android:key="@string/key_enable_dualpane"
android:title="@string/enable_dualpane_title"
android:summary="@string/enable_dualpane_summary"
android:defaultValue="false"
/>
<CheckBoxPreference android:key="@string/key_show_arrow"

View file

@ -391,15 +391,8 @@ public class GameUtils {
thumb = Bitmap.createBitmap( size, size,
Bitmap.Config.ARGB_8888 );
XwJNI.board_figureLayout( gamePtr, gi, 0, 0, size, size,
0, 0, 0, 20, 20, false, null );
ThumbCanvas canvas = new ThumbCanvas( context, thumb );
XwJNI.board_setDraw( gamePtr, canvas );
XwJNI.board_invalAll( gamePtr );
Assert.assertNotNull( gamePtr );
XwJNI.board_draw( gamePtr );
XwJNI.board_drawSnapshot( gamePtr, canvas, size, size );
}
}
return thumb;

View file

@ -268,6 +268,8 @@ public class XwJNI {
public static native void board_setDraw( GamePtr gamePtr, DrawCtx draw );
public static native void board_invalAll( GamePtr gamePtr );
public static native boolean board_draw( GamePtr gamePtr );
public static native void board_drawSnapshot( GamePtr gamePtr, DrawCtx draw,
int width, int height );
// Only if COMMON_LAYOUT defined
public static native void board_figureLayout( GamePtr gamePtr, CurGameInfo gi,

View file

@ -404,10 +404,10 @@ board_drawSnapshot( const BoardCtxt* curBoard, DrawCtx* dctx,
BoardCtxt* newBoard = board_make( MPPARM(curBoard->mpool)
curBoard->model,
curBoard->server, dctx, curBoard->util );
board_setDraw( newBoard, dctx ); /* so draw_dictChanged() will get called */
XP_U16 fontWidth = width / curBoard->gi->boardSize;
board_figureLayout( newBoard, curBoard->gi, 0, 0, width, height,
0, 0, 0, fontWidth, width, XP_TRUE, NULL );
0, 0, 0, fontWidth, width, XP_FALSE, NULL );
board_draw( newBoard );
board_destroy( newBoard );
}