# HG changeset patch # User Thinker K.F. Li # Date 1259679327 -28800 # Node ID 0d9f1f4d315474ba909f5bf50571fcbc58f0344c # Parent ccc6bdc7e5a0a10e3108c5eb63cdf528a90bf1af set stroke width for a shape. It also modify procedure of creating a redraw_man. diff -r ccc6bdc7e5a0 -r 0d9f1f4d3154 Android/jni/Android.mk --- a/Android/jni/Android.mk Tue Dec 01 22:55:27 2009 +0800 +++ b/Android/jni/Android.mk Tue Dec 01 22:55:27 2009 +0800 @@ -4,7 +4,7 @@ LOCAL_MODULE := libmbfly-jni LOCAL_SRC_FILES := mbfly.cpp -LOCAL_SHARED_LIBRARIES := libcorecg libsgl libnativehelper +LOCAL_SHARED_LIBRARIES := libcorecg libsgl libnativehelper libcutils LOCAL_STATIC_LIBRARIES := libmbfly LOCAL_C_INCLUDES += $(TARGET_OUT_HEADERS)/libmbfly \ $(call include-path-for,corecg) \ diff -r ccc6bdc7e5a0 -r 0d9f1f4d3154 Android/jni/mbfly.cpp --- a/Android/jni/mbfly.cpp Tue Dec 01 22:55:27 2009 +0800 +++ b/Android/jni/mbfly.cpp Tue Dec 01 22:55:27 2009 +0800 @@ -9,6 +9,10 @@ #include #include +#define ASSERT(x) + + +extern mbe_t *skia_mbe_create_by_canvas(SkCanvas *canvas); jint Java_org_madbutterfly__1jni_redraw_1man_1new(JNIEnv *env, jobject cls, @@ -18,6 +22,7 @@ jfieldID fid; SkCanvas *_cr, *_backend; redraw_man_t *rdman; + mbe_t *mbe1, *mbe2; canvas_cls = env->GetObjectClass(cr); fid = env->GetFieldID(canvas_cls, "mNativeCanvas", "I"); @@ -25,9 +30,15 @@ canvas_cls = env->GetObjectClass(backend); fid = env->GetFieldID(canvas_cls, "mNativeCanvas", "I"); _backend = (SkCanvas *)env->GetIntField(backend, fid); + + mbe1 = skia_mbe_create_by_canvas(_cr); + mbe2 = skia_mbe_create_by_canvas(_backend); + ASSERT(mbe1 != NULL && mbe2 != NULL); + rdman = (redraw_man_t *)malloc(sizeof(redraw_man_t)); - redraw_man_init(rdman, (mbe_t *)_cr, (mbe_t *)_backend); - + ASSERT(rdman != NULL); + redraw_man_init(rdman, mbe1, mbe2); + return (jint)rdman; } @@ -154,6 +165,13 @@ return shape; } +void Java_org_madbutterfly__1jni_sh_1set_1stroke_1width(JNIEnv *env, + jobject cls, + jint shape, + jfloat w) { + sh_set_stroke_width((shape_t *)shape, w); +} + jint Java_org_madbutterfly__1jni_rdman_1paint_1color_1new(JNIEnv *env, jobject cls, jint rdman,