diff options
Diffstat (limited to 'navit/graphics/android/graphics_android.c')
-rw-r--r-- | navit/graphics/android/graphics_android.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c index 912fc30fe..0f1040356 100644 --- a/navit/graphics/android/graphics_android.c +++ b/navit/graphics/android/graphics_android.c @@ -89,7 +89,7 @@ find_class_global(char *name, jclass *ret) { *ret=(*jnienv)->FindClass(jnienv, name); if (! *ret) { - dbg(0,"Failed to get Class %s\n",name); + dbg(lvl_error,"Failed to get Class %s\n",name); return 0; } *ret = (*jnienv)->NewGlobalRef(jnienv, *ret); @@ -101,7 +101,7 @@ find_method(jclass class, char *name, char *args, jmethodID *ret) { *ret = (*jnienv)->GetMethodID(jnienv, class, name, args); if (*ret == NULL) { - dbg(0,"Failed to get Method %s with signature %s\n",name,args); + dbg(lvl_error,"Failed to get Method %s with signature %s\n",name,args); return 0; } return 1; @@ -112,7 +112,7 @@ find_static_method(jclass class, char *name, char *args, jmethodID *ret) { *ret = (*jnienv)->GetStaticMethodID(jnienv, class, name, args); if (*ret == NULL) { - dbg(0,"Failed to get static Method %s with signature %s\n",name,args); + dbg(lvl_error,"Failed to get static Method %s with signature %s\n",name,args); return 0; } return 1; @@ -222,18 +222,18 @@ image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char * jclass localBitmap = NULL; int id; - dbg(1,"enter %s\n",path); + dbg(lvl_warning,"enter %s\n",path); if (!strncmp(path,"res/drawable/",13)) { jstring a=(*jnienv)->NewStringUTF(jnienv, "drawable"); char *path_noext=g_strdup(path+13); char *pos=strrchr(path_noext, '.'); if (pos) *pos='\0'; - dbg(1,"path_noext=%s\n",path_noext); + dbg(lvl_warning,"path_noext=%s\n",path_noext); string = (*jnienv)->NewStringUTF(jnienv, path_noext); g_free(path_noext); id=(*jnienv)->CallIntMethod(jnienv, gra->Resources, gra->Resources_getIdentifier, string, a, gra->packageName); - dbg(1,"id=%d\n",id); + dbg(lvl_warning,"id=%d\n",id); if (id) localBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapFactoryClass, gra->BitmapFactory_decodeResource, gra->Resources, id); (*jnienv)->DeleteLocalRef(jnienv, a); @@ -241,19 +241,19 @@ image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char * string = (*jnienv)->NewStringUTF(jnienv, path); localBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapFactoryClass, gra->BitmapFactory_decodeFile, string); } - dbg(1,"result=%p\n",localBitmap); + dbg(lvl_warning,"result=%p\n",localBitmap); if (localBitmap) { ret->Bitmap = (*jnienv)->NewGlobalRef(jnienv, localBitmap); (*jnienv)->DeleteLocalRef(jnienv, localBitmap); ret->width=(*jnienv)->CallIntMethod(jnienv, ret->Bitmap, gra->Bitmap_getWidth); ret->height=(*jnienv)->CallIntMethod(jnienv, ret->Bitmap, gra->Bitmap_getHeight); - dbg(1,"w=%d h=%d for %s\n",ret->width,ret->height,path); + dbg(lvl_warning,"w=%d h=%d for %s\n",ret->width,ret->height,path); ret->hot.x=ret->width/2; ret->hot.y=ret->height/2; } else { g_free(ret); ret=NULL; - dbg(1,"Failed to open %s\n",path); + dbg(lvl_warning,"Failed to open %s\n",path); } (*jnienv)->DeleteLocalRef(jnienv, string); g_hash_table_insert(image_cache_hash, g_strdup( path ), (gpointer)ret ); @@ -346,7 +346,7 @@ static void draw_text(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { int bgcolor=0; - dbg(1,"enter %s\n", text); + dbg(lvl_warning,"enter %s\n", text); initPaint(gra, fg); if(bg) bgcolor=(bg->a<<24)| (bg->r<<16) | (bg->g<<8) | bg->b; @@ -358,7 +358,7 @@ draw_text(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct graphic static void draw_image(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { - dbg(1,"enter %p\n",img); + dbg(lvl_warning,"enter %p\n",img); initPaint(gra, fg); (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_image, fg->gra->Paint, p->x, p->y, img->Bitmap); @@ -467,7 +467,7 @@ static struct graphics_methods graphics_methods = { static void resize_callback(struct graphics_priv *gra, int w, int h) { - dbg(0,"w=%d h=%d ok\n",w,h); + dbg(lvl_error,"w=%d h=%d ok\n",w,h); callback_list_call_attr_2(gra->cbl, attr_resize, (void *)w, (void *)h); } @@ -483,7 +483,7 @@ motion_callback(struct graphics_priv *gra, int x, int y) static void keypress_callback(struct graphics_priv *gra, char *s) { - dbg(0,"enter %s\n",s); + dbg(lvl_error,"enter %s\n",s); callback_list_call_attr_1(gra->cbl, attr_keypress, s); } @@ -504,20 +504,20 @@ set_activity(jobject graphics) jmethodID cid; ActivityClass = (*jnienv)->GetObjectClass(jnienv, android_activity); - dbg(0,"at 5\n"); + dbg(lvl_error,"at 5\n"); if (ActivityClass == NULL) { - dbg(0,"no activity class found\n"); + dbg(lvl_error,"no activity class found\n"); return 0; } - dbg(0,"at 6\n"); + dbg(lvl_error,"at 6\n"); cid = (*jnienv)->GetMethodID(jnienv, ActivityClass, "setContentView", "(Landroid/view/View;)V"); if (cid == NULL) { - dbg(0,"no setContentView method found\n"); + dbg(lvl_error,"no setContentView method found\n"); return 0; } - dbg(0,"at 7\n"); + dbg(lvl_error,"at 7\n"); (*jnienv)->CallVoidMethod(jnienv, android_activity, cid, graphics); - dbg(0,"at 8\n"); + dbg(lvl_error,"at 8\n"); return 1; } @@ -527,7 +527,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s struct callback *cb; jmethodID cid, Context_getPackageName; - dbg(0,"at 2 jnienv=%p\n",jnienv); + dbg(lvl_error,"at 2 jnienv=%p\n",jnienv); if (!find_class_global("android/graphics/Paint", &ret->PaintClass)) return 0; if (!find_method(ret->PaintClass, "<init>", "(I)V", &ret->Paint_init)) @@ -572,15 +572,15 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s if (!find_class_global("org/navitproject/navit/NavitGraphics", &ret->NavitGraphicsClass)) return 0; - dbg(0,"at 3\n"); + dbg(lvl_error,"at 3\n"); cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "<init>", "(Landroid/app/Activity;Lorg/navitproject/navit/NavitGraphics;IIIIIII)V"); if (cid == NULL) { - dbg(0,"no method found\n"); + dbg(lvl_error,"no method found\n"); return 0; /* exception thrown */ } - dbg(0,"at 4 android_activity=%p\n",android_activity); + dbg(lvl_error,"at 4 android_activity=%p\n",android_activity); ret->NavitGraphics=(*jnienv)->NewObject(jnienv, ret->NavitGraphicsClass, cid, android_activity, parent ? parent->NavitGraphics : NULL, pnt ? pnt->x:0 , pnt ? pnt->y:0, w, h, alpha, wraparound, use_camera); - dbg(0,"result=%p\n",ret->NavitGraphics); + dbg(lvl_error,"result=%p\n",ret->NavitGraphics); if (ret->NavitGraphics) ret->NavitGraphics = (*jnienv)->NewGlobalRef(jnienv, ret->NavitGraphics); @@ -589,13 +589,13 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s /* 0x101 = text kerning (default), antialiasing */ ret->Paint=(*jnienv)->NewObject(jnienv, ret->PaintClass, ret->Paint_init, 0x101); - dbg(0,"result=%p\n",ret->Paint); + dbg(lvl_error,"result=%p\n",ret->Paint); if (ret->Paint) ret->Paint = (*jnienv)->NewGlobalRef(jnienv, ret->Paint); cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setSizeChangedCallback", "(I)V"); if (cid == NULL) { - dbg(0,"no SetResizeCallback method found\n"); + dbg(lvl_error,"no SetResizeCallback method found\n"); return 0; /* exception thrown */ } cb=callback_new_1(callback_cast(resize_callback), ret); @@ -603,7 +603,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setButtonCallback", "(I)V"); if (cid == NULL) { - dbg(0,"no SetButtonCallback method found\n"); + dbg(lvl_error,"no SetButtonCallback method found\n"); return 0; /* exception thrown */ } cb=callback_new_1(callback_cast(button_callback), ret); @@ -611,7 +611,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setMotionCallback", "(I)V"); if (cid == NULL) { - dbg(0,"no SetMotionCallback method found\n"); + dbg(lvl_error,"no SetMotionCallback method found\n"); return 0; /* exception thrown */ } cb=callback_new_1(callback_cast(motion_callback), ret); @@ -619,7 +619,7 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s cid = (*jnienv)->GetMethodID(jnienv, ret->NavitGraphicsClass, "setKeypressCallback", "(I)V"); if (cid == NULL) { - dbg(0,"no SetKeypressCallback method found\n"); + dbg(lvl_error,"no SetKeypressCallback method found\n"); return 0; /* exception thrown */ } cb=callback_new_1(callback_cast(keypress_callback), ret); @@ -666,7 +666,7 @@ graphics_android_fullscreen(struct window *win, int on) static void graphics_android_disable_suspend(struct window *win) { - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_disableSuspend); } @@ -691,7 +691,7 @@ graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct at } image_cache_hash = g_hash_table_new(g_str_hash, g_str_equal); if (graphics_android_init(ret, NULL, NULL, 0, 0, 0, 0, use_camera)) { - dbg(0,"returning %p\n",ret); + dbg(lvl_error,"returning %p\n",ret); return ret; } else { g_free(ret); @@ -705,7 +705,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin struct graphics_priv *ret=g_new0(struct graphics_priv, 1); *meth=graphics_methods; if (graphics_android_init(ret, gr, p, w, h, alpha, wraparound, 0)) { - dbg(0,"returning %p\n",ret); + dbg(lvl_error,"returning %p\n",ret); return ret; } else { g_free(ret); @@ -717,12 +717,12 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin static void event_android_main_loop_run(void) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); } static void event_android_main_loop_quit(void) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_exit); } @@ -744,7 +744,7 @@ static void do_poll(JNIEnv *env, int fd, int cond) { struct pollfd pfd; pfd.fd=fd; - dbg(1,"%p poll called for %d %d\n", fd, cond); + dbg(lvl_warning,"%p poll called for %d %d\n", fd, cond); switch ((enum event_watch_cond)cond) { case event_watch_cond_read: pfd.events=POLLIN; @@ -767,7 +767,7 @@ event_android_add_watch(int h, enum event_watch_cond cond, struct callback *cb) { jobject ret; ret=(*jnienv)->NewObject(jnienv, NavitWatchClass, NavitWatch_init, (int)do_poll, h, (int) cond, (int)cb); - dbg(0,"result for %d,%d,%p=%p\n",h,cond,cb,ret); + dbg(lvl_error,"result for %d,%d,%p=%p\n",h,cond,cb,ret); if (ret) ret = (*jnienv)->NewGlobalRef(jnienv, ret); return (struct event_watch *)ret; @@ -776,7 +776,7 @@ event_android_add_watch(int h, enum event_watch_cond cond, struct callback *cb) static void event_android_remove_watch(struct event_watch *ev) { - dbg(0,"enter %p\n",ev); + dbg(lvl_error,"enter %p\n",ev); if (ev) { jobject obj=(jobject )ev; (*jnienv)->CallVoidMethod(jnienv, obj, NavitWatch_remove); @@ -828,9 +828,9 @@ event_android_add_idle(int priority, struct callback *cb) { #if 0 jobject ret; - dbg(1,"enter\n"); + dbg(lvl_warning,"enter\n"); ret=(*jnienv)->NewObject(jnienv, NavitIdleClass, NavitIdle_init, (int)cb); - dbg(1,"result for %p=%p\n",cb,ret); + dbg(lvl_warning,"result for %p=%p\n",cb,ret); if (ret) ret = (*jnienv)->NewGlobalRef(jnienv, ret); return (struct event_idle *)ret; @@ -842,7 +842,7 @@ static void event_android_remove_idle(struct event_idle *ev) { #if 0 - dbg(1,"enter %p\n",ev); + dbg(lvl_warning,"enter %p\n",ev); if (ev) { jobject obj=(jobject )ev; (*jnienv)->CallVoidMethod(jnienv, obj, NavitIdle_remove); @@ -855,7 +855,7 @@ event_android_remove_idle(struct event_idle *ev) static void event_android_call_callback(struct callback_list *cb) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); } static struct event_methods event_android_methods = { @@ -873,7 +873,7 @@ static struct event_methods event_android_methods = { static struct event_priv * event_android_new(struct event_methods *meth) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); if (!find_class_global("org/navitproject/navit/NavitTimeout", &NavitTimeoutClass)) return NULL; NavitTimeout_init = (*jnienv)->GetMethodID(jnienv, NavitTimeoutClass, "<init>", "(IZI)V"); @@ -913,7 +913,7 @@ event_android_new(struct event_methods *meth) Navit_fullscreen = (*jnienv)->GetMethodID(jnienv, NavitClass, "fullscreen", "(I)V"); if (Navit_fullscreen == NULL) return NULL; - dbg(0,"ok\n"); + dbg(lvl_error,"ok\n"); *meth=event_android_methods; return NULL; } @@ -922,7 +922,7 @@ event_android_new(struct event_methods *meth) void plugin_init(void) { - dbg(0,"enter\n"); + dbg(lvl_error,"enter\n"); plugin_register_graphics_type("android", graphics_android_new); plugin_register_event_type("android", event_android_new); } |