diff options
author | Joseph Herlant <aerostitch@users.noreply.github.com> | 2018-05-30 08:43:42 -0700 |
---|---|---|
committer | jkoan <jkoan@users.noreply.github.com> | 2018-05-30 17:43:42 +0200 |
commit | 567a02aa949dfa34f7b2c2246c6eb6f8818fdf01 (patch) | |
tree | 4bb102fa60f0d01db0184d1424a5fc822ba79bc9 /navit/graphics | |
parent | cd477eb0e05b74b8dd26aa2df2778505a3b3c37c (diff) | |
download | navit-567a02aa949dfa34f7b2c2246c6eb6f8818fdf01.tar.gz |
Cleanup:global:force the re-attach the return type to the function declaration (#605)
* Cleanup:global:force the re-attach the return type to the function declaration
* cleanup:global:some loose ends
Diffstat (limited to 'navit/graphics')
-rw-r--r-- | navit/graphics/android/graphics_android.c | 168 | ||||
-rw-r--r-- | navit/graphics/egl/graphics_egl.c | 185 | ||||
-rw-r--r-- | navit/graphics/gd/graphics_gd.c | 98 | ||||
-rw-r--r-- | navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c | 142 | ||||
-rw-r--r-- | navit/graphics/null/graphics_null.c | 107 | ||||
-rw-r--r-- | navit/graphics/opengl/graphics_opengl.c | 327 | ||||
-rw-r--r-- | navit/graphics/opengl/graphics_opengl_egl.c | 6 | ||||
-rw-r--r-- | navit/graphics/opengl/graphics_opengl_x11.c | 19 | ||||
-rw-r--r-- | navit/graphics/qt5/event_qt5.cpp | 27 | ||||
-rw-r--r-- | navit/graphics/qt5/graphics_qt5.cpp | 77 | ||||
-rw-r--r-- | navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp | 64 | ||||
-rw-r--r-- | navit/graphics/sdl/event.c | 12 | ||||
-rw-r--r-- | navit/graphics/sdl/event_sdl.c | 48 | ||||
-rw-r--r-- | navit/graphics/sdl/graphics_sdl.c | 130 | ||||
-rw-r--r-- | navit/graphics/win32/graphics_win32.c | 56 |
15 files changed, 461 insertions, 1005 deletions
diff --git a/navit/graphics/android/graphics_android.c b/navit/graphics/android/graphics_android.c index a6a6565f4..6b6d5c22d 100644 --- a/navit/graphics/android/graphics_android.c +++ b/navit/graphics/android/graphics_android.c @@ -91,8 +91,7 @@ struct graphics_image_priv { static GHashTable *image_cache_hash = NULL; -static int -find_class_global(char *name, jclass *ret) { +static int find_class_global(char *name, jclass *ret) { *ret=(*jnienv)->FindClass(jnienv, name); if (! *ret) { dbg(lvl_error,"Failed to get Class %s",name); @@ -102,8 +101,7 @@ find_class_global(char *name, jclass *ret) { return 1; } -static int -find_method(jclass class, char *name, char *args, jmethodID *ret) { +static int find_method(jclass class, char *name, char *args, jmethodID *ret) { *ret = (*jnienv)->GetMethodID(jnienv, class, name, args); if (*ret == NULL) { dbg(lvl_error,"Failed to get Method %s with signature %s",name,args); @@ -112,8 +110,7 @@ find_method(jclass class, char *name, char *args, jmethodID *ret) { return 1; } -static int -find_static_method(jclass class, char *name, char *args, jmethodID *ret) { +static int find_static_method(jclass class, char *name, char *args, jmethodID *ret) { *ret = (*jnienv)->GetStaticMethodID(jnienv, class, name, args); if (*ret == NULL) { dbg(lvl_error,"Failed to get static Method %s with signature %s",name,args); @@ -122,8 +119,7 @@ find_static_method(jclass class, char *name, char *args, jmethodID *ret) { return 1; } -static void -graphics_destroy(struct graphics_priv *gr) { +static void graphics_destroy(struct graphics_priv *gr) { } static void font_destroy(struct graphics_font_priv *font) { @@ -134,8 +130,7 @@ static struct graphics_font_methods font_methods = { font_destroy }; -static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, - int size, int flags) { +static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags) { struct graphics_font_priv *ret=g_new0(struct graphics_font_priv, 1); *meth=font_methods; @@ -143,19 +138,16 @@ static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct grap return ret; } -static void -gc_destroy(struct graphics_gc_priv *gc) { +static void gc_destroy(struct graphics_gc_priv *gc) { g_free(gc->dashes); g_free(gc); } -static void -gc_set_linewidth(struct graphics_gc_priv *gc, int w) { +static void gc_set_linewidth(struct graphics_gc_priv *gc, int w) { gc->linewidth = w; } -static void -gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { +static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { g_free(gc->dashes); gc->ndashes=n; if(n) { @@ -166,16 +158,14 @@ gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *das } } -static void -gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { gc->r = c->r >> 8; gc->g = c->g >> 8; gc->b = c->b >> 8; gc->a = c->a >> 8; } -static void -gc_set_background(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_background(struct graphics_gc_priv *gc, struct color *c) { } static struct graphics_gc_methods gc_methods = { @@ -205,9 +195,7 @@ static struct graphics_image_methods image_methods = { }; -static struct graphics_image_priv * -image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, - int rotation) { +static struct graphics_image_priv *image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation) { struct graphics_image_priv* ret = NULL; ret=g_new0(struct graphics_image_priv, 1); @@ -228,8 +216,7 @@ image_new(struct graphics_priv *gra, struct graphics_image_methods *meth, char * id=(*jnienv)->CallIntMethod(jnienv, gra->Resources, gra->Resources_getIdentifier, string, a, gra->packageName); dbg(lvl_debug,"id=%d",id); if (id) - localBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapFactoryClass, gra->BitmapFactory_decodeResource, - gra->Resources, id); + localBitmap=(*jnienv)->CallStaticObjectMethod(jnienv, gra->BitmapFactoryClass, gra->BitmapFactory_decodeResource, gra->Resources, id); (*jnienv)->DeleteLocalRef(jnienv, a); } else { string = (*jnienv)->NewStringUTF(jnienv, path); @@ -279,8 +266,7 @@ static void initPaint(struct graphics_priv *gra, struct graphics_gc_priv *gc) { (*jnienv)->CallVoidMethod(jnienv, gc->gra->Paint, gra->Paint_setARGB, gc->a, gc->r, gc->g, gc->b); } -static void -draw_lines(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_lines(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int count) { int arrsize=1+4+1+gc->ndashes+count*2; jint pc[arrsize]; int i; @@ -306,8 +292,7 @@ draw_lines(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point (*jnienv)->DeleteLocalRef(jnienv, points); } -static void -draw_polygon(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_polygon(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int count) { int arrsize=1+4+count*2; jint pc[arrsize]; int i; @@ -329,46 +314,36 @@ draw_polygon(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct poin (*jnienv)->DeleteLocalRef(jnienv, points); } -static void -draw_rectangle(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int w, int h) { +static void draw_rectangle(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int w, int h) { initPaint(gra, gc); - (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_rectangle, gc->gra->Paint, p->x, p->y, w, - h); + (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_rectangle, gc->gra->Paint, p->x, p->y, w, h); } -static void -draw_circle(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int r) { +static void draw_circle(struct graphics_priv *gra, struct graphics_gc_priv *gc, struct point *p, int r) { initPaint(gra, gc); (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_circle, gc->gra->Paint, p->x, p->y, r); } -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) { +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(lvl_debug,"enter %s", text); initPaint(gra, fg); if(bg) bgcolor=(bg->a<<24)| (bg->r<<16) | (bg->g<<8) | bg->b; jstring string = (*jnienv)->NewStringUTF(jnienv, text); - (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_text, fg->gra->Paint, p->x, p->y, string, - font->size, dx, dy, bgcolor); + (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_text, fg->gra->Paint, p->x, p->y, string, font->size, dx, dy, bgcolor); (*jnienv)->DeleteLocalRef(jnienv, string); } -static void -draw_image(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gra, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { dbg(lvl_debug,"enter %p",img); initPaint(gra, fg); - (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_image, fg->gra->Paint, p->x, p->y, - img->Bitmap); + (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_image, fg->gra->Paint, p->x, p->y, img->Bitmap); } -static void -draw_image_warp (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, - struct graphics_image_priv *img) { +static void draw_image_warp (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, struct graphics_image_priv *img) { /* * @@ -379,8 +354,7 @@ draw_image_warp (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct p if (count==3) { initPaint(gr, fg); - (*jnienv)->CallVoidMethod(jnienv, gr->NavitGraphics, gr->NavitGraphics_draw_image_warp, fg->gra->Paint, - count, p[0].x, p[0].y,p[1].x, p[1].y, p[2].x, p[2].y, img->Bitmap); + (*jnienv)->CallVoidMethod(jnienv, gr->NavitGraphics, gr->NavitGraphics_draw_image_warp, fg->gra->Paint, count, p[0].x, p[0].y,p[1].x, p[1].y, p[2].x, p[2].y, img->Bitmap); } else dbg(lvl_debug,"draw_image_warp is called with unsupported count parameter value %d", count); } @@ -391,20 +365,16 @@ static void draw_drag(struct graphics_priv *gra, struct point *p) { (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_drag, p ? p->x : 0, p ? p->y : 0); } -static void -background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { } -static void -draw_mode(struct graphics_priv *gra, enum draw_mode_num mode) { +static void draw_mode(struct graphics_priv *gra, enum draw_mode_num mode) { (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_draw_mode, (int)mode); } -static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, - int w, int h, int wraparound); +static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound); -static void * -get_data(struct graphics_priv *this, const char *type) { +static void *get_data(struct graphics_priv *this, const char *type) { if (!strcmp(type,"padding")) return this->padding; if (!strcmp(type,"window")) @@ -415,8 +385,7 @@ get_data(struct graphics_priv *this, const char *type) { static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { } -static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, - struct point *ret, int estimate) { +static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate) { int len = g_utf8_strlen(text, -1); int xMin = 0; int yMin = 0; @@ -438,12 +407,10 @@ static void overlay_disable(struct graphics_priv *gra, int disable) { } static void overlay_resize(struct graphics_priv *gra, struct point *pnt, int w, int h, int wraparound) { - (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_overlay_resize, pnt ? pnt->x:0, pnt ? pnt->y:0, - w, h, wraparound); + (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_overlay_resize, pnt ? pnt->x:0, pnt ? pnt->y:0, w, h, wraparound); } -static int -set_attr(struct graphics_priv *gra, struct attr *attr) { +static int set_attr(struct graphics_priv *gra, struct attr *attr) { switch (attr->type) { case attr_use_camera: (*jnienv)->CallVoidMethod(jnienv, gra->NavitGraphics, gra->NavitGraphics_SetCamera, attr->u.num); @@ -497,15 +464,13 @@ static struct graphics_methods graphics_methods = { hide_native_keyboard, }; -static void -resize_callback(struct graphics_priv *gra, int w, int h) { +static void resize_callback(struct graphics_priv *gra, int w, int h) { dbg(lvl_debug,"w=%d h=%d ok",w,h); dbg(lvl_debug,"gra=%p, %d callbacks in list", gra, g_list_length(gra->cbl)); callback_list_call_attr_2(gra->cbl, attr_resize, (void *)w, (void *)h); } -static void -padding_callback(struct graphics_priv *gra, int left, int top, int right, int bottom) { +static void padding_callback(struct graphics_priv *gra, int left, int top, int right, int bottom) { dbg(lvl_debug, "win.padding left=%d top=%d right=%d bottom=%d ok", left, top, right, bottom); gra->padding->left = left; gra->padding->top = top; @@ -513,22 +478,19 @@ padding_callback(struct graphics_priv *gra, int left, int top, int right, int bo gra->padding->bottom = bottom; } -static void -motion_callback(struct graphics_priv *gra, int x, int y) { +static void motion_callback(struct graphics_priv *gra, int x, int y) { struct point p; p.x=x; p.y=y; callback_list_call_attr_1(gra->cbl, attr_motion, (void *)&p); } -static void -keypress_callback(struct graphics_priv *gra, char *s) { +static void keypress_callback(struct graphics_priv *gra, char *s) { dbg(lvl_debug,"enter %s",s); callback_list_call_attr_1(gra->cbl, attr_keypress, s); } -static void -button_callback(struct graphics_priv *gra, int pressed, int button, int x, int y) { +static void button_callback(struct graphics_priv *gra, int pressed, int button, int x, int y) { struct point p; p.x=x; p.y=y; @@ -536,8 +498,7 @@ button_callback(struct graphics_priv *gra, int pressed, int button, int x, int y } -static int -set_activity(jobject graphics) { +static int set_activity(jobject graphics) { jclass ActivityClass; jmethodID cid; @@ -572,9 +533,7 @@ set_activity(jobject graphics) { * @param wraparound (0 for the main view) * @param use_camera Whether to use the camera (0 for overlays) */ -static int -graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, struct point *pnt, int w, int h, - int wraparound, int use_camera) { +static int graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, struct point *pnt, int w, int h, int wraparound, int use_camera) { struct callback *cb; jmethodID cid, Context_getPackageName; @@ -732,17 +691,14 @@ graphics_android_init(struct graphics_priv *ret, struct graphics_priv *parent, s } static jclass NavitClass; -static jmethodID Navit_disableSuspend, Navit_exit, Navit_fullscreen, Navit_runOptionsItem, Navit_showMenu, - Navit_showNativeKeyboard, Navit_hideNativeKeyboard; +static jmethodID Navit_disableSuspend, Navit_exit, Navit_fullscreen, Navit_runOptionsItem, Navit_showMenu, Navit_showNativeKeyboard, Navit_hideNativeKeyboard; -static int -graphics_android_fullscreen(struct window *win, int on) { +static int graphics_android_fullscreen(struct window *win, int on) { (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_fullscreen, on); return 1; } -static void -graphics_android_disable_suspend(struct window *win) { +static void graphics_android_disable_suspend(struct window *win) { dbg(lvl_debug,"enter"); (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_disableSuspend); } @@ -758,9 +714,7 @@ graphics_android_disable_suspend(struct window *win) { * @param out Points to a buffer which will receive a pointer to the output of the command * @param valid */ -static void -graphics_android_cmd_runMenuItem(struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, - int *valid) { +static void graphics_android_cmd_runMenuItem(struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) { int ncmd=0; dbg(0,"Running %s",function); if(!strcmp(function,"map_download_dialog")) { @@ -784,9 +738,7 @@ graphics_android_cmd_runMenuItem(struct graphics_priv *this, char *function, str * @param out Points to a buffer which will receive a pointer to the output of the command * @param valid */ -static void -graphics_android_cmd_menu(struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, - int *valid) { +static void graphics_android_cmd_menu(struct graphics_priv *this, char *function, struct attr **in, struct attr ***out, int *valid) { dbg(lvl_debug, "enter"); (*jnienv)->CallVoidMethod(jnienv, android_activity, Navit_showMenu); } @@ -815,8 +767,7 @@ static struct command_table commands[] = { * * @return The new graphics instance */ -static struct graphics_priv * -graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv *graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct graphics_priv *ret; struct attr *attr; int use_camera=0; @@ -902,8 +853,7 @@ graphics_android_new(struct navit *nav, struct graphics_methods *meth, struct at * * @return The graphics instance for the new overlay */ -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { struct graphics_priv *ret=g_new0(struct graphics_priv, 1); *meth=graphics_methods; if (graphics_android_init(ret, gr, p, w, h, wraparound, 0)) { @@ -916,8 +866,7 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin } -static void -event_android_main_loop_run(void) { +static void event_android_main_loop_run(void) { dbg(lvl_debug,"enter"); } @@ -961,8 +910,7 @@ static void do_poll(JNIEnv *env, int fd, int cond) { poll(&pfd, 1, -1); } -static struct event_watch * -event_android_add_watch(int h, enum event_watch_cond cond, struct callback *cb) { +static struct event_watch *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(lvl_debug,"result for %d,%d,%p=%p",h,cond,cb,ret); @@ -971,8 +919,7 @@ event_android_add_watch(int h, enum event_watch_cond cond, struct callback *cb) return (struct event_watch *)ret; } -static void -event_android_remove_watch(struct event_watch *ev) { +static void event_android_remove_watch(struct event_watch *ev) { dbg(lvl_debug,"enter %p",ev); if (ev) { jobject obj=(jobject )ev; @@ -988,8 +935,7 @@ struct event_timeout { struct callback *cb; }; -static void -event_android_remove_timeout(struct event_timeout *priv) { +static void event_android_remove_timeout(struct event_timeout *priv) { if (priv && priv->jni_timeout) { (*jnienv)->CallVoidMethod(jnienv, priv->jni_timeout, NavitTimeout_remove); (*jnienv)->DeleteGlobalRef(jnienv, priv->jni_timeout); @@ -1003,8 +949,7 @@ static void event_android_handle_timeout(struct event_timeout *priv) { event_android_remove_timeout(priv); } -static struct event_timeout * -event_android_add_timeout(int timeout, int multi, struct callback *cb) { +static struct event_timeout *event_android_add_timeout(int timeout, int multi, struct callback *cb) { struct event_timeout *ret = g_new0(struct event_timeout, 1); ret->cb = cb; ret->multi = multi; @@ -1016,8 +961,7 @@ event_android_add_timeout(int timeout, int multi, struct callback *cb) { } -static struct event_idle * -event_android_add_idle(int priority, struct callback *cb) { +static struct event_idle *event_android_add_idle(int priority, struct callback *cb) { #if 0 jobject ret; dbg(lvl_debug,"enter"); @@ -1030,8 +974,7 @@ event_android_add_idle(int priority, struct callback *cb) { return (struct event_idle *)event_android_add_timeout(1, 1, cb); } -static void -event_android_remove_idle(struct event_idle *ev) { +static void event_android_remove_idle(struct event_idle *ev) { #if 0 dbg(lvl_debug,"enter %p",ev); if (ev) { @@ -1043,8 +986,7 @@ event_android_remove_idle(struct event_idle *ev) { event_android_remove_timeout((struct event_timeout *)ev); } -static void -event_android_call_callback(struct callback_list *cb) { +static void event_android_call_callback(struct callback_list *cb) { dbg(lvl_debug,"enter"); } @@ -1060,8 +1002,7 @@ static struct event_methods event_android_methods = { event_android_call_callback, }; -static struct event_priv * -event_android_new(struct event_methods *meth) { +static struct event_priv *event_android_new(struct event_methods *meth) { dbg(lvl_debug,"enter"); if (!find_class_global("org/navitproject/navit/NavitTimeout", &NavitTimeoutClass)) return NULL; @@ -1166,8 +1107,7 @@ void hide_native_keyboard (struct graphics_keyboard *kbd) { } -void -plugin_init(void) { +void plugin_init(void) { dbg(lvl_debug,"enter"); plugin_register_category_graphics("android", graphics_android_new); plugin_register_category_event("android", event_android_new); diff --git a/navit/graphics/egl/graphics_egl.c b/navit/graphics/egl/graphics_egl.c index 758528a37..f9c33c775 100644 --- a/navit/graphics/egl/graphics_egl.c +++ b/navit/graphics/egl/graphics_egl.c @@ -88,8 +88,7 @@ struct graphics_priv { struct graphics_gc_priv *background_gc; enum draw_mode_num mode; GLuint program; - GLint mvp_location, position_location, color_location, texture_position_location, use_texture_location, - texture_location; + GLint mvp_location, position_location, color_location, texture_position_location, use_texture_location, texture_location; struct callback_list *cbl; struct font_freetype_methods freetype_methods; struct navit *nav; @@ -177,11 +176,10 @@ float area(const struct contour* contour) { return A * .5f; } -int -inside_triangle(float Ax, float Ay, - float Bx, float By, - float Cx, float Cy, - float Px, float Py) { +int inside_triangle(float Ax, float Ay, + float Bx, float By, + float Cx, float Cy, + float Px, float Py) { float ax, ay, bx, by, cx, cy, apx, apy, bpx, bpy, cpx, cpy; float cCROSSap, bCROSScp, aCROSSbp; @@ -205,8 +203,7 @@ inside_triangle(float Ax, float Ay, return ((aCROSSbp >= 0.0f) && (bCROSScp >= 0.0f) && (cCROSSap >= 0.0f)); } -int -snip(const struct point* pnt,int u,int v,int w,int n,int *V) { +int snip(const struct point* pnt,int u,int v,int w,int n,int *V) { int p; float Ax, Ay, Bx, By, Cx, Cy, Px, Py; @@ -234,8 +231,7 @@ snip(const struct point* pnt,int u,int v,int w,int n,int *V) { return 1; } -int -process_triangles(const struct contour* contour, struct contour* result) { +int process_triangles(const struct contour* contour, struct contour* result) { int v; int contour_size = contour->count - 1; int polygon_temp_size = contour_size * 80; @@ -309,8 +305,7 @@ process_triangles(const struct contour* contour, struct contour* result) { /* * Destroys SDL/EGL context */ -static void -sdl_egl_destroy(struct graphics_opengl_platform *egl) { +static void sdl_egl_destroy(struct graphics_opengl_platform *egl) { if (egl->eglwindow) { SDL_GL_DeleteContext(egl->eglcontext); SDL_DestroyWindow(egl->eglwindow); @@ -322,16 +317,14 @@ sdl_egl_destroy(struct graphics_opengl_platform *egl) { /* * Swap EGL buffer */ -static void -sdl_egl_swap_buffers(struct graphics_opengl_platform *egl) { +static void sdl_egl_swap_buffers(struct graphics_opengl_platform *egl) { SDL_GL_SwapWindow(egl->eglwindow); } /* * Main graphic destroy */ -static void -graphics_destroy(struct graphics_priv *gr) { +static void graphics_destroy(struct graphics_priv *gr) { /*FIXME graphics_destroy is never called */ gr->freetype_methods.destroy(); g_free(gr); @@ -340,20 +333,16 @@ graphics_destroy(struct graphics_priv *gr) { SDL_Quit(); } -static void -gc_destroy(struct graphics_gc_priv *gc) { +static void gc_destroy(struct graphics_gc_priv *gc) { g_free(gc); gc = NULL; } -static void -gc_set_linewidth(struct graphics_gc_priv *gc, int w) { +static void gc_set_linewidth(struct graphics_gc_priv *gc, int w) { gc->linewidth = w; } -static void -gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, - unsigned char *dash_list, int n) { +static void gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char *dash_list, int n) { int i; const int cOpenglMaskBits = 16; gc->dash_count = n; @@ -408,16 +397,14 @@ gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, } -static void -gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { gc->fr = c->r / 65535.0; gc->fg = c->g / 65535.0; gc->fb = c->b / 65535.0; gc->fa = c->a / 65535.0; } -static void -gc_set_background(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_background(struct graphics_gc_priv *gc, struct color *c) { gc->br = c->r / 65535.0; gc->bg = c->g / 65535.0; gc->bb = c->b / 65535.0; @@ -432,8 +419,7 @@ static struct graphics_gc_methods gc_methods = { gc_set_background }; -static struct graphics_gc_priv * -gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth) { +static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth) { struct graphics_gc_priv *gc = g_new0(struct graphics_gc_priv, 1); *meth = gc_methods; @@ -444,9 +430,7 @@ gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth) { static struct graphics_image_priv image_error; -static struct graphics_image_priv * -image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, - struct point *hot, int rotation) { +static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation) { struct graphics_image_priv *gi; /* FIXME: meth is not used yet.. so gi leaks. at least xpm is small */ @@ -467,8 +451,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n } if (strlen(name) < 4) { - g_hash_table_insert(hImageData, g_strdup(name), - &image_error); + g_hash_table_insert(hImageData, g_strdup(name), &image_error); return NULL; } @@ -484,9 +467,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n dbg(lvl_error,"image_new on '%s' failed: %s", name, IMG_GetError()); g_free(gi); gi = NULL; - g_hash_table_insert(hImageData, - g_strdup(name), - &image_error); + g_hash_table_insert(hImageData, g_strdup(name), &image_error); return gi; } @@ -494,14 +475,12 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n return gi; } -static void -image_free(struct graphics_priv *gr, struct graphics_image_priv * gi) { +static void image_free(struct graphics_priv *gr, struct graphics_image_priv * gi) { // SDL_FreeSurface(gi->img); // g_free(gi); } -static void -set_color(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void set_color(struct graphics_priv *gr, struct graphics_gc_priv *gc) { GLfloat col[4]; col[0]=gc->fr; col[1]=gc->fg; @@ -510,8 +489,7 @@ set_color(struct graphics_priv *gr, struct graphics_gc_priv *gc) { glUniform4fv(gr->color_location, 1, col); } -static void -draw_array(struct graphics_priv *gr, struct point *p, int count, GLenum mode) { +static void draw_array(struct graphics_priv *gr, struct point *p, int count, GLenum mode) { int i; GLf *x;//[count*2]; x = alloca(sizeof(GLf)*count*2); @@ -524,8 +502,7 @@ draw_array(struct graphics_priv *gr, struct point *p, int count, GLenum mode) { glDrawArrays(mode, 0, count); } -static void -draw_rectangle_do(struct graphics_priv *gr, struct point *p, int w, int h) { +static void draw_rectangle_do(struct graphics_priv *gr, struct point *p, int w, int h) { struct point pa[4]; pa[0]=pa[1]=pa[2]=pa[3]=*p; pa[0].x+=w; @@ -536,8 +513,7 @@ draw_rectangle_do(struct graphics_priv *gr, struct point *p, int w, int h) { } -static void -draw_image_es(struct graphics_priv *gr, struct point *p, int w, int h, unsigned char *data) { +static void draw_image_es(struct graphics_priv *gr, struct point *p, int w, int h, unsigned char *data) { GLf x[8]; GLuint texture; memset(x, 0, sizeof(x)); @@ -571,8 +547,7 @@ draw_image_es(struct graphics_priv *gr, struct point *p, int w, int h, unsigned glDeleteTextures(1, &texture); } -inline void -get_overlay_pos(struct graphics_priv *gr, struct point *point_out) { +inline void get_overlay_pos(struct graphics_priv *gr, struct point *point_out) { if (gr->parent == NULL) { point_out->x = 0; point_out->y = 0; @@ -589,8 +564,7 @@ get_overlay_pos(struct graphics_priv *gr, struct point *point_out) { } } -inline void -draw_overlay(struct graphics_priv *gr) { +inline void draw_overlay(struct graphics_priv *gr) { struct point p_eff; GLf x[8]; @@ -618,9 +592,7 @@ draw_overlay(struct graphics_priv *gr) { glDisable(GL_BLEND); } -static void -draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, - struct point *p, int count) { +static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { if ((gr->parent && !gr->parent->overlay_enabled) || (gr->parent && gr->parent->overlay_enabled && !gr->overlay_enabled)) { @@ -636,9 +608,7 @@ draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, } -static void -draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, - struct point *p, int count) { +static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { int ok; if ((gr->parent && !gr->parent->overlay_enabled) || (gr->parent && gr->parent->overlay_enabled @@ -659,9 +629,7 @@ draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, } } -static void -draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, - struct point *p, int w, int h) { +static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { if ((gr->parent && !gr->parent->overlay_enabled) || (gr->parent && gr->parent->overlay_enabled && !gr->overlay_enabled)) { @@ -672,10 +640,7 @@ draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, graphics_priv_root->dirty = 1; } -static void -display_text_draw(struct font_freetype_text *text, - struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct graphics_gc_priv *bg, int color, struct point *p) { +static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, int color, struct point *p) { int i, x, y, stride; struct font_freetype_glyph *g, **gp; unsigned char *shadow, *glyph; @@ -730,10 +695,7 @@ display_text_draw(struct font_freetype_text *text, stride = (g->w + 2) * 4; if (color) { shadow = g_malloc(stride * (g->h + 2)); - gr->freetype_methods.get_shadow(g, shadow, - stride, - &white, - &transparent); + gr->freetype_methods.get_shadow(g, shadow, stride, &white, &transparent); struct point p; p.x=((x + g->x) >> 6)-1; @@ -759,13 +721,7 @@ display_text_draw(struct font_freetype_text *text, if (bg) { glyph = g_malloc(stride * g->h * 4); - gr->freetype_methods.get_glyph(g, - glyph, - stride - * 4, - &black, - &white, - &transparent); + gr->freetype_methods.get_glyph(g, glyph, stride * 4, &black, &white, &transparent); struct point p; p.x=(x + g->x) >> 6; p.y=(y + g->y) >> 6; @@ -775,11 +731,7 @@ display_text_draw(struct font_freetype_text *text, } stride *= 4; glyph = g_malloc(stride * g->h); - gr->freetype_methods.get_glyph(g, glyph, - stride, - &black, - &white, - &transparent); + gr->freetype_methods.get_glyph(g, glyph, stride, &black, &white, &transparent); struct point p; p.x=(x + g->x) >> 6; p.y=(y + g->y) >> 6; @@ -793,10 +745,7 @@ display_text_draw(struct font_freetype_text *text, } } -static void -draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct graphics_gc_priv *bg, struct graphics_font_priv *font, - char *text, struct point *p, int dx, int dy) { +static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { if ((gr->parent && !gr->parent->overlay_enabled) || (gr->parent && gr->parent->overlay_enabled && !gr->overlay_enabled)) { @@ -812,9 +761,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, } graphics_priv_root->dirty = 1; - t = gr->freetype_methods.text_new(text, - (struct font_freetype_font *) - font, dx, dy); + t = gr->freetype_methods.text_new(text, (struct font_freetype_font *) font, dx, dy); struct point p_eff; p_eff.x = p->x; @@ -825,30 +772,25 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, } -static void -draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct point *p, struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { draw_image_es(gr, p, img->img->w, img->img->h, img->img->pixels); } -static void -draw_drag(struct graphics_priv *gr, struct point *p) { +static void draw_drag(struct graphics_priv *gr, struct point *p) { if (p) { gr->p.x = p->x; gr->p.y = p->y; } } -static void -background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { gr->background_gc = gc; } /* * Draws map in background */ -static void -draw_background(struct graphics_priv *gr) { +static void draw_background(struct graphics_priv *gr) { struct point p_eff; GLf x[8]; @@ -882,8 +824,7 @@ draw_background(struct graphics_priv *gr) { Map and overlays are rendered in an offscreen buffer (See render to texture) and are recomposed altogether at draw_mode_end request for root */ -static void -draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { +static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { GLfloat matrix[16]; struct graphics_priv *overlay = NULL; int i; @@ -932,19 +873,16 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { gr->mode = mode; } -static int -graphics_opengl_fullscreen(struct window *w, int on) { +static int graphics_opengl_fullscreen(struct window *w, int on) { return 1; } -static void -graphics_opengl_disable_suspend(struct window *w) { +static void graphics_opengl_disable_suspend(struct window *w) { // No op } -static GLuint -load_shader(const char *shader_source, GLenum type) { +static GLuint load_shader(const char *shader_source, GLenum type) { GLuint shader = glCreateShader(type); glShaderSource(shader, 1, &shader_source, NULL); @@ -953,16 +891,14 @@ load_shader(const char *shader_source, GLenum type) { return shader; } -static void * -get_data(struct graphics_priv *this, const char *type) { +static void *get_data(struct graphics_priv *this, const char *type) { GLuint vertexShader; GLuint fragmentShader; struct window* win; int i; if (!strcmp(type, "gtk_widget")) { - fprintf(stderr, - "Currently GTK gui is not yet supported with EGL graphics driver\n"); + fprintf(stderr, "Currently GTK gui is not yet supported with EGL graphics driver\n"); return NULL; } @@ -972,8 +908,7 @@ get_data(struct graphics_priv *this, const char *type) { glClearColor ( 0, 0, 0, 1); glClear ( GL_COLOR_BUFFER_BIT ); - callback_list_call_attr_2(graphics_priv_root->cbl, attr_resize, - GINT_TO_POINTER(this->width), GINT_TO_POINTER(this->height)); + callback_list_call_attr_2(graphics_priv_root->cbl, attr_resize, GINT_TO_POINTER(this->width), GINT_TO_POINTER(this->height)); this->program = glCreateProgram(); vertexShader = load_shader(vertex_src, GL_VERTEX_SHADER); @@ -1007,17 +942,14 @@ get_data(struct graphics_priv *this, const char *type) { } -static void -overlay_disable(struct graphics_priv *gr, int disable) { +static void overlay_disable(struct graphics_priv *gr, int disable) { gr->overlay_enabled = !disable; gr->force_redraw = 1; draw_mode(gr, draw_mode_end); } // Need more testing -static void -overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, - int wraparound) { +static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int wraparound) { int changed = 0; int w2, h2; @@ -1061,9 +993,7 @@ overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, gr->overlay_texture, 0); } - callback_list_call_attr_2(gr->cbl, attr_resize, - GINT_TO_POINTER(gr->width), - GINT_TO_POINTER(gr->height)); + callback_list_call_attr_2(gr->cbl, attr_resize, GINT_TO_POINTER(gr->width), GINT_TO_POINTER(gr->height)); } } @@ -1099,8 +1029,7 @@ static struct graphics_methods graphics_methods = { NULL, /* hide_native_keyboard */ }; -static struct graphics_priv * -graphics_opengl_new_helper(struct graphics_methods *meth) { +static struct graphics_priv *graphics_opengl_new_helper(struct graphics_methods *meth) { struct font_priv *(*font_freetype_new) (void *meth); font_freetype_new = plugin_get_category_font("freetype"); @@ -1123,8 +1052,7 @@ graphics_opengl_new_helper(struct graphics_methods *meth) { return this; } -static void -create_framebuffer_texture(struct graphics_priv *gr) { +static void create_framebuffer_texture(struct graphics_priv *gr) { GLenum status; // Prepare a new framebuffer object glGenFramebuffers(1, &gr->framebuffer_name); @@ -1145,9 +1073,7 @@ create_framebuffer_texture(struct graphics_priv *gr) { } } -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, - struct point *p, int w, int h, int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { struct graphics_priv *this = graphics_opengl_new_helper(meth); this->p.x = p->x; @@ -1302,9 +1228,7 @@ static gboolean graphics_sdl_idle(void *data) { } -static struct graphics_priv * -graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, - struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct attr *attr; if (!event_request_system("glib", "graphics_opengl_new")) return NULL; @@ -1392,8 +1316,7 @@ error: return NULL; } -void -plugin_init(void) { +void plugin_init(void) { plugin_register_category_graphics("egl", graphics_opengl_new); } diff --git a/navit/graphics/gd/graphics_gd.c b/navit/graphics/gd/graphics_gd.c index a4c59c823..7c8a45693 100644 --- a/navit/graphics/gd/graphics_gd.c +++ b/navit/graphics/gd/graphics_gd.c @@ -221,14 +221,12 @@ struct graphics_image_priv { }; -static void -graphics_destroy(struct graphics_priv *gr) { +static void graphics_destroy(struct graphics_priv *gr) { gr->freetype_methods.destroy(); g_free(gr); } -static void -gc_destroy(struct graphics_gc_priv *gc) { +static void gc_destroy(struct graphics_gc_priv *gc) { if (gc->color != -1) gdImageColorDeallocate(gc->gr->im, gc->color); if (gc->bgcolor != -1) @@ -237,13 +235,11 @@ gc_destroy(struct graphics_gc_priv *gc) { g_free(gc); } -static void -gc_set_linewidth(struct graphics_gc_priv *gc, int w) { +static void gc_set_linewidth(struct graphics_gc_priv *gc, int w) { gc->width=w; } -static void -gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { +static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { int i,count=0; g_free(gc->dash_list); gc->dash_list=g_new(unsigned char, n); @@ -255,14 +251,12 @@ gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *das gc->dash_count=count; } -static void -gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { gc->color2=*c; gc->color=gdImageColorAllocate(gc->gr->im, c->r>>8, c->g>>8, c->b>>8); } -static void -gc_set_background(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_background(struct graphics_gc_priv *gc, struct color *c) { gc->bgcolor=gdImageColorAllocate(gc->gr->im, c->r>>8, c->g>>8, c->b>>8); } @@ -285,9 +279,7 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics } -static struct graphics_image_priv * -image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, - int rotation) { +static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation) { FILE *file; struct graphics_image_priv *ret=NULL; gdImagePtr im=NULL; @@ -324,8 +316,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n return ret; } -static void -draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { int color[gc->dash_count],cc; int i,j,k=0; @@ -356,8 +347,7 @@ draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point * #endif } -static void -draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { int cc=gc->color; if (gr->flags & 8) { gdImageSetAntiAliased(gr->im, cc); @@ -366,8 +356,7 @@ draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point gdImageFilledPolygon(gr->im, (gdPointPtr) p, count, cc); } -static void -draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { +static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { int cc=gc->color; if (gr->flags & 8) { gdImageSetAntiAliased(gr->im, cc); @@ -376,8 +365,7 @@ draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct poi gdImageFilledRectangle(gr->im, p->x, p->y, p->x+w, p->y+h, cc); } -static void -draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r) { +static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r) { int cc=gc->color; if (gr->flags & 8) { gdImageSetAntiAliased(gr->im, cc); @@ -388,9 +376,7 @@ draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point } -static void -draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, - struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { +static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { struct font_freetype_text *t; struct font_freetype_glyph *g, **gp; gdImagePtr im; @@ -442,13 +428,11 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics gr->freetype_methods.text_destroy(t); } -static void -draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { gdImageCopy(gr->im, img->im, p->x, p->y, 0, 0, img->im->sx, img->im->sy); } -static void -draw_drag(struct graphics_priv *gr, struct point *p) { +static void draw_drag(struct graphics_priv *gr, struct point *p) { if (p) gr->p=*p; else { @@ -458,13 +442,11 @@ draw_drag(struct graphics_priv *gr, struct point *p) { } -static void -background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { gr->background=gc; } -static void -draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { +static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { FILE *pngout; #if 0 if (mode == draw_mode_begin && gr->background) { @@ -525,11 +507,9 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { } } -static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, - int w, int h, int wraparound); +static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound); -static void -add_overlays(struct graphics_priv *overlay, gdImagePtr im) { +static void add_overlays(struct graphics_priv *overlay, gdImagePtr im) { while (overlay) { if (overlay->background) { gdImagePtr res,src; @@ -558,8 +538,7 @@ add_overlays(struct graphics_priv *overlay, gdImagePtr im) { } } -static void * -get_data(struct graphics_priv *this, char *type) { +static void *get_data(struct graphics_priv *this, char *type) { int b; struct point p; gdImagePtr im = this->im; @@ -596,19 +575,16 @@ get_data(struct graphics_priv *this, char *type) { } -static void -image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { +static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { gdImageDestroy(priv->im); g_free(priv); } -static void -overlay_disable(struct graphics_priv *gr, int disable) { +static void overlay_disable(struct graphics_priv *gr, int disable) { dbg(lvl_debug,"enter"); } -static void -overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int wraparound) { +static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int wraparound) { dbg(lvl_debug,"enter"); } @@ -623,8 +599,7 @@ shm_next(struct graphics_priv *gr) { return (struct shmem_header *)next; } -static void -image_setup(struct graphics_priv *gr) { +static void image_setup(struct graphics_priv *gr) { int i,*shm=(int *)(gr->shm_header+1); if (!gr->shmkey) return; @@ -636,8 +611,7 @@ image_setup(struct graphics_priv *gr) { gr->shm_header->flag=0; } -static void -image_create(struct graphics_priv *gr) { +static void image_create(struct graphics_priv *gr) { dbg(lvl_debug,"shmkey %d",gr->shmkey); #ifdef HAVE_SHMEM if (gr->shmkey) { @@ -666,8 +640,7 @@ image_create(struct graphics_priv *gr) { gr->im=gdImageCreateTrueColor(gr->w,gr->h); } -static void -image_destroy(struct graphics_priv *gr) { +static void image_destroy(struct graphics_priv *gr) { #ifdef HAVE_SHMEM if (gr->shmkey) { shmdt(gr->shm); @@ -679,8 +652,7 @@ image_destroy(struct graphics_priv *gr) { gr->im=NULL; } -static int -set_attr_do(struct graphics_priv *gr, struct attr *attr, int init) { +static int set_attr_do(struct graphics_priv *gr, struct attr *attr, int init) { char *s,*c,*n,*p; switch (attr->type) { case attr_w: @@ -754,8 +726,7 @@ set_attr_do(struct graphics_priv *gr, struct attr *attr, int init) { } -static int -set_attr(struct graphics_priv *gr, struct attr *attr) { +static int set_attr(struct graphics_priv *gr, struct attr *attr) { return set_attr_do(gr, attr, 0); } @@ -785,8 +756,7 @@ static struct graphics_methods graphics_methods = { NULL, /* hide_native_keyboard */ }; -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { struct font_priv * (*font_freetype_new)(void *meth); struct graphics_priv *ret; @@ -809,14 +779,12 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin return ret; } -static void -emit_callback(struct graphics_priv *priv) { +static void emit_callback(struct graphics_priv *priv) { callback_list_call_attr_2(priv->cbl, attr_resize, (void *)priv->w, (void *)priv->h); } -static struct graphics_priv * -graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv *graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct font_priv * (*font_freetype_new)(void *meth); struct graphics_priv *ret; event_request_system("glib","graphics_gd_new"); @@ -826,8 +794,7 @@ graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr ** *meth=graphics_methods; ret=g_new0(struct graphics_priv, 1); font_freetype_new(&ret->freetype_methods); - meth->font_new=(struct graphics_font_priv *(*)(struct graphics_priv *, struct graphics_font_methods *, char *, int, - int))ret->freetype_methods.font_new; + meth->font_new=(struct graphics_font_priv *(*)(struct graphics_priv *, struct graphics_font_methods *, char *, int, int))ret->freetype_methods.font_new; meth->get_text_bbox=ret->freetype_methods.get_text_bbox; ret->cb=callback_new_attr_1(callback_cast(emit_callback), attr_navit, ret); navit_add_callback(nav, ret->cb); @@ -844,7 +811,6 @@ graphics_gd_new(struct navit *nav, struct graphics_methods *meth, struct attr ** return ret; } -void -plugin_init(void) { +void plugin_init(void) { plugin_register_category_graphics("gd", graphics_gd_new); } diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c index e840901ab..b61ac2403 100644 --- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c +++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c @@ -109,8 +109,7 @@ struct graphics_image_priv { #endif }; -static void -graphics_destroy(struct graphics_priv *gr) { +static void graphics_destroy(struct graphics_priv *gr) { dbg(lvl_debug,"enter parent %p",gr->parent); gr->freetype_methods.destroy(); if (!gr->parent) { @@ -125,18 +124,15 @@ graphics_destroy(struct graphics_priv *gr) { g_free(gr); } -static void -gc_destroy(struct graphics_gc_priv *gc) { +static void gc_destroy(struct graphics_gc_priv *gc) { g_free(gc); } -static void -gc_set_linewidth(struct graphics_gc_priv *gc, int w) { +static void gc_set_linewidth(struct graphics_gc_priv *gc, int w) { gc->linewidth = w; } -static void -gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { +static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { int i; g_free(gc->dashes); gc->ndashes=n; @@ -151,13 +147,11 @@ gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *das } } -static void -gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { gc->c=*c; } -static void -gc_set_background(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_background(struct graphics_gc_priv *gc, struct color *c) { } static struct graphics_gc_methods gc_methods = { @@ -187,9 +181,7 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics } -static struct graphics_image_priv * -image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, - int rotation) { +static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation) { GdkPixbuf *pixbuf; struct graphics_image_priv *ret; const char *option; @@ -263,27 +255,23 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n return ret; } -static void -image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { +static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { g_object_unref(priv->pixbuf); g_free(priv); } -static void -set_drawing_color(cairo_t *cairo, struct color c) { +static void set_drawing_color(cairo_t *cairo, struct color c) { double col_max = 1<<COLOR_BITDEPTH; cairo_set_source_rgba(cairo, c.r/col_max, c.g/col_max, c.b/col_max, c.a/col_max); } -static void -set_stroke_params_from_gc(cairo_t *cairo, struct graphics_gc_priv *gc) { +static void set_stroke_params_from_gc(cairo_t *cairo, struct graphics_gc_priv *gc) { set_drawing_color(cairo, gc->c); cairo_set_dash(cairo, gc->dashes, gc->ndashes, gc->offset); cairo_set_line_width(cairo, gc->linewidth); } -static void -draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { int i; if (!count) return; @@ -295,8 +283,7 @@ draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point * cairo_stroke(gr->cairo); } -static void -draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { int i; set_drawing_color(gr->cairo, gc->c); cairo_move_to(gr->cairo, p[0].x, p[0].y); @@ -306,8 +293,7 @@ draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point cairo_fill(gr->cairo); } -static void -draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { +static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { cairo_save(gr->cairo); // Use OPERATOR_SOURCE to overwrite old contents even when drawing with transparency. // Necessary for OSD drawing. @@ -318,16 +304,13 @@ draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct poi cairo_restore(gr->cairo); } -static void -draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r) { +static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r) { cairo_arc (gr->cairo, p->x, p->y, r/2, 0.0, 2*M_PI); set_stroke_params_from_gc(gr->cairo, gc); cairo_stroke(gr->cairo); } -static void -draw_rgb_image_buffer(cairo_t *cairo, int buffer_width, int buffer_height, int draw_pos_x, int draw_pos_y, int stride, - unsigned char *buffer) { +static void draw_rgb_image_buffer(cairo_t *cairo, int buffer_width, int buffer_height, int draw_pos_x, int draw_pos_y, int stride, unsigned char *buffer) { cairo_surface_t *buffer_surface = cairo_image_surface_create_for_data( buffer, CAIRO_FORMAT_ARGB32, buffer_width, buffer_height, stride); cairo_set_source_surface(cairo, buffer_surface, draw_pos_x, draw_pos_y); @@ -335,9 +318,7 @@ draw_rgb_image_buffer(cairo_t *cairo, int buffer_width, int buffer_height, int d cairo_surface_destroy(buffer_surface); } -static void -display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct graphics_gc_priv *bg, struct point *p) { +static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct point *p) { int i,x,y,stride; struct font_freetype_glyph *g, **gp; struct color transparent= {0x0,0x0,0x0,0x0}; @@ -378,9 +359,7 @@ display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, str } } -static void -draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, - struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { +static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { struct font_freetype_text *t; if (! font) { @@ -405,16 +384,13 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics gr->freetype_methods.text_destroy(t); } -static void -draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { gdk_cairo_set_source_pixbuf(gr->cairo, img->pixbuf, p->x, p->y); cairo_paint(gr->cairo); } #ifdef HAVE_IMLIB2 -static unsigned char* -create_buffer_with_stride_if_required(unsigned char *input_buffer, int w, int h, size_t bytes_per_pixel, - size_t output_stride) { +static unsigned char* create_buffer_with_stride_if_required(unsigned char *input_buffer, int w, int h, size_t bytes_per_pixel, size_t output_stride) { int line; size_t input_offset, output_offset; unsigned char *out_buf; @@ -432,9 +408,7 @@ create_buffer_with_stride_if_required(unsigned char *input_buffer, int w, int h, return out_buf; } -static void -draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, - struct graphics_image_priv *img) { +static void draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, int count, struct graphics_image_priv *img) { int w,h; DATA32 *intermediate_buffer; unsigned char* intermediate_buffer_aligned; @@ -512,8 +486,7 @@ draw_image_warp(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct po } #endif -static void -overlay_rect(struct graphics_priv *parent, struct graphics_priv *overlay, GdkRectangle *r) { +static void overlay_rect(struct graphics_priv *parent, struct graphics_priv *overlay, GdkRectangle *r) { r->x=overlay->p.x; r->y=overlay->p.y; r->width=overlay->width; @@ -530,8 +503,7 @@ overlay_rect(struct graphics_priv *parent, struct graphics_priv *overlay, GdkRec r->height += parent->height; } -static void -overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, GdkRectangle *re, cairo_t *cairo) { +static void overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, GdkRectangle *re, cairo_t *cairo) { GdkRectangle or, ir; if (parent->overlay_disabled || overlay->overlay_disabled || overlay->overlay_autodisabled) return; @@ -545,8 +517,7 @@ overlay_draw(struct graphics_priv *parent, struct graphics_priv *overlay, GdkRec cairo_paint(cairo); } -static void -draw_drag(struct graphics_priv *gr, struct point *p) { +static void draw_drag(struct graphics_priv *gr, struct point *p) { if (p) gr->p=*p; else { @@ -556,13 +527,11 @@ draw_drag(struct graphics_priv *gr, struct point *p) { } -static void -background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { gr->background_gc=gc; } -static void -draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { +static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { if (mode == draw_mode_end) { // Just invalidate the whole window. We could only the invalidate the area of // graphics_priv, but that is probably not significantly faster. @@ -572,8 +541,7 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { /* Events */ -static gint -configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data) { +static gint configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data) { struct graphics_priv *gra=user_data; if (! gra->visible) return TRUE; @@ -592,8 +560,7 @@ configure(GtkWidget * widget, GdkEventConfigure * event, gpointer user_data) { return TRUE; } -static gint -expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { +static gint expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { struct graphics_priv *gra=user_data; struct graphics_gc_priv *background_gc=gra->background_gc; struct graphics_priv *overlay; @@ -620,15 +587,13 @@ expose(GtkWidget * widget, GdkEventExpose * event, gpointer user_data) { return FALSE; } -static int -tv_delta(struct timeval *old, struct timeval *new) { +static int tv_delta(struct timeval *old, struct timeval *new) { if (new->tv_sec-old->tv_sec >= INT_MAX/1000) return INT_MAX; return (new->tv_sec-old->tv_sec)*1000+(new->tv_usec-old->tv_usec)/1000; } -static gint -button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data) { +static gint button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data) { struct graphics_priv *this=user_data; struct point p; struct timeval tv; @@ -649,8 +614,7 @@ button_press(GtkWidget * widget, GdkEventButton * event, gpointer user_data) { return FALSE; } -static gint -button_release(GtkWidget * widget, GdkEventButton * event, gpointer user_data) { +static gint button_release(GtkWidget * widget, GdkEventButton * event, gpointer user_data) { struct graphics_priv *this=user_data; struct point p; struct timeval tv; @@ -673,8 +637,7 @@ button_release(GtkWidget * widget, GdkEventButton * event, gpointer user_data) { -static gint -scroll(GtkWidget * widget, GdkEventScroll * event, gpointer user_data) { +static gint scroll(GtkWidget * widget, GdkEventScroll * event, gpointer user_data) { struct graphics_priv *this=user_data; struct point p; int button; @@ -699,8 +662,7 @@ scroll(GtkWidget * widget, GdkEventScroll * event, gpointer user_data) { return FALSE; } -static gint -motion_notify(GtkWidget * widget, GdkEventMotion * event, gpointer user_data) { +static gint motion_notify(GtkWidget * widget, GdkEventMotion * event, gpointer user_data) { struct graphics_priv *this=user_data; struct point p; @@ -717,8 +679,7 @@ motion_notify(GtkWidget * widget, GdkEventMotion * event, gpointer user_data) { * * @param user_data Pointer to private data structure * * @returns TRUE * */ -static gint -delete(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { +static gint delete(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { struct graphics_priv *this=user_data; dbg(lvl_debug,"enter this->win=%p",this->win); if (this->delay & 2) { @@ -730,8 +691,7 @@ delete(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { return TRUE; } -static gint -keypress(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { +static gint keypress(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { struct graphics_priv *this=user_data; int len,ucode; char key[8]; @@ -810,8 +770,7 @@ keypress(GtkWidget *widget, GdkEventKey *event, gpointer user_data) { static struct graphics_priv *graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth); -static void -overlay_disable(struct graphics_priv *gr, int disabled) { +static void overlay_disable(struct graphics_priv *gr, int disabled) { if (!gr->overlay_disabled != !disabled) { gr->overlay_disabled=disabled; if (gr->parent) { @@ -822,8 +781,7 @@ overlay_disable(struct graphics_priv *gr, int disabled) { } } -static void -overlay_resize(struct graphics_priv *this, struct point *p, int w, int h, int wraparound) { +static void overlay_resize(struct graphics_priv *this, struct point *p, int w, int h, int wraparound) { //do not dereference parent for non overlay osds if(!this->parent) { return; @@ -873,8 +831,7 @@ overlay_resize(struct graphics_priv *this, struct point *p, int w, int h, int wr } } -static void -get_data_window(struct graphics_priv *this, unsigned int xid) { +static void get_data_window(struct graphics_priv *this, unsigned int xid) { if (!xid) this->win = gtk_window_new(GTK_WINDOW_TOPLEVEL); else @@ -898,8 +855,7 @@ get_data_window(struct graphics_priv *this, unsigned int xid) { g_signal_connect(G_OBJECT(this->win), "delete_event", G_CALLBACK(delete), this); } -static int -set_attr(struct graphics_priv *gr, struct attr *attr) { +static int set_attr(struct graphics_priv *gr, struct attr *attr) { dbg(lvl_debug,"enter"); switch (attr->type) { case attr_windowid: @@ -910,8 +866,7 @@ set_attr(struct graphics_priv *gr, struct attr *attr) { } } -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { int w2,h2; struct graphics_priv *this=graphics_gtk_drawing_area_new_helper(meth); this->widget=gr->widget; @@ -954,8 +909,7 @@ static int gtk_argc; static char **gtk_argv= {NULL}; -static int -graphics_gtk_drawing_area_fullscreen(struct window *w, int on) { +static int graphics_gtk_drawing_area_fullscreen(struct window *w, int on) { struct graphics_priv *gr=w->priv; if (on) gtk_window_fullscreen(GTK_WINDOW(gr->win)); @@ -964,8 +918,7 @@ graphics_gtk_drawing_area_fullscreen(struct window *w, int on) { return 1; } -static void -graphics_gtk_drawing_area_disable_suspend(struct window *w) { +static void graphics_gtk_drawing_area_disable_suspend(struct window *w) { struct graphics_priv *gr=w->priv; #ifndef _WIN32 @@ -977,8 +930,7 @@ graphics_gtk_drawing_area_disable_suspend(struct window *w) { } -static void * -get_data(struct graphics_priv *this, char const *type) { +static void *get_data(struct graphics_priv *this, char const *type) { FILE *f; if (!strcmp(type,"gtk_widget")) return this->widget; @@ -1043,8 +995,7 @@ static struct graphics_methods graphics_methods = { NULL, /* hide_native_keyboard */ }; -static struct graphics_priv * -graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth) { +static struct graphics_priv *graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth) { struct font_priv * (*font_freetype_new)(void *meth); font_freetype_new=plugin_get_category_font("freetype"); if (!font_freetype_new) @@ -1059,9 +1010,7 @@ graphics_gtk_drawing_area_new_helper(struct graphics_methods *meth) { return this; } -static struct graphics_priv * -graphics_gtk_drawing_area_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, - struct callback_list *cbl) { +static struct graphics_priv *graphics_gtk_drawing_area_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { int i; GtkWidget *draw; struct attr *attr; @@ -1109,8 +1058,7 @@ graphics_gtk_drawing_area_new(struct navit *nav, struct graphics_methods *meth, return this; } -void -plugin_init(void) { +void plugin_init(void) { gtk_init(>k_argc, >k_argv); gtk_set_locale(); #ifdef HAVE_API_WIN32 diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c index edceb778e..c3a21185b 100644 --- a/navit/graphics/null/graphics_null.c +++ b/navit/graphics/null/graphics_null.c @@ -54,8 +54,7 @@ static struct graphics_image_priv { int dummy; } graphics_image_priv; -static void -graphics_destroy(struct graphics_priv *gr) { +static void graphics_destroy(struct graphics_priv *gr) { } static void font_destroy(struct graphics_font_priv *font) { @@ -66,30 +65,24 @@ static struct graphics_font_methods font_methods = { font_destroy }; -static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, - int size, int flags) { +static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags) { *meth=font_methods; return &graphics_font_priv; } -static void -gc_destroy(struct graphics_gc_priv *gc) { +static void gc_destroy(struct graphics_gc_priv *gc) { } -static void -gc_set_linewidth(struct graphics_gc_priv *gc, int w) { +static void gc_set_linewidth(struct graphics_gc_priv *gc, int w) { } -static void -gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { +static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { } -static void -gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { } -static void -gc_set_background(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_background(struct graphics_gc_priv *gc, struct color *c) { } static struct graphics_gc_methods gc_methods = { @@ -105,69 +98,52 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics return &graphics_gc_priv; } -static struct graphics_image_priv * -image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, - int rotation) { +static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation) { return &graphics_image_priv; } -static void -draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { } -static void -draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { } -static void -draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { +static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { } -static void -draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r) { +static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r) { } -static void -draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, - struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { +static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { } -static void -draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { } static void draw_drag(struct graphics_priv *gr, struct point *p) { } -static void -background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { } -static void -draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { +static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { } -static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, - int w, int h, int wraparound); +static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound); -static void -resize_callback(int w, int h) { - callback_list_call_attr_2(callbacks, attr_resize, - GINT_TO_POINTER(1), GINT_TO_POINTER(1)); +static void resize_callback(int w, int h) { + callback_list_call_attr_2(callbacks, attr_resize, GINT_TO_POINTER(1), GINT_TO_POINTER(1)); } -static int -graphics_null_fullscreen(struct window *w, int on) { +static int graphics_null_fullscreen(struct window *w, int on) { return 1; } -static void -graphics_null_disable_suspend(struct window *w) { +static void graphics_null_disable_suspend(struct window *w) { } -static void * -get_data(struct graphics_priv *this, char const *type) { +static void *get_data(struct graphics_priv *this, char const *type) { if (strcmp(type, "window") == 0) { struct window *win; win = g_new0(struct window, 1); @@ -183,8 +159,7 @@ get_data(struct graphics_priv *this, char const *type) { static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { } -static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, - struct point *ret, int estimate) { +static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate) { } static void overlay_disable(struct graphics_priv *gr, int disable) { @@ -218,15 +193,13 @@ static struct graphics_methods graphics_methods = { NULL, /* hide_native_keyboard */ }; -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { *meth=graphics_methods; return &graphics_priv; } -static struct graphics_priv * -graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv *graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct attr *event_loop_system = NULL; *meth=graphics_methods; @@ -245,8 +218,7 @@ graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr return &graphics_priv; } -static void -event_null_main_loop_run(void) { +static void event_null_main_loop_run(void) { dbg(lvl_debug,"enter"); for (;;) @@ -258,43 +230,36 @@ static void event_null_main_loop_quit(void) { dbg(lvl_debug,"enter"); } -static struct event_watch * -event_null_add_watch(int h, enum event_watch_cond cond, struct callback *cb) { +static struct event_watch *event_null_add_watch(int h, enum event_watch_cond cond, struct callback *cb) { dbg(lvl_debug,"enter"); return NULL; } -static void -event_null_remove_watch(struct event_watch *ev) { +static void event_null_remove_watch(struct event_watch *ev) { dbg(lvl_debug,"enter"); } -static struct event_timeout * -event_null_add_timeout(int timeout, int multi, struct callback *cb) { +static struct event_timeout *event_null_add_timeout(int timeout, int multi, struct callback *cb) { dbg(lvl_debug,"enter"); return NULL; } -static void -event_null_remove_timeout(struct event_timeout *to) { +static void event_null_remove_timeout(struct event_timeout *to) { dbg(lvl_debug,"enter"); } -static struct event_idle * -event_null_add_idle(int priority, struct callback *cb) { +static struct event_idle *event_null_add_idle(int priority, struct callback *cb) { dbg(lvl_debug,"enter"); return NULL; } -static void -event_null_remove_idle(struct event_idle *ev) { +static void event_null_remove_idle(struct event_idle *ev) { dbg(lvl_debug,"enter"); } -static void -event_null_call_callback(struct callback_list *cb) { +static void event_null_call_callback(struct callback_list *cb) { dbg(lvl_debug,"enter"); } @@ -310,15 +275,13 @@ static struct event_methods event_null_methods = { event_null_call_callback, }; -static struct event_priv * -event_null_new(struct event_methods *meth) { +static struct event_priv *event_null_new(struct event_methods *meth) { *meth=event_null_methods; return NULL; } -void -plugin_init(void) { +void plugin_init(void) { plugin_register_category_graphics("null", graphics_null_new); plugin_register_category_event("null", event_null_new); } diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c index b6b3c8782..2789061f1 100644 --- a/navit/graphics/opengl/graphics_opengl.c +++ b/navit/graphics/opengl/graphics_opengl.c @@ -142,8 +142,7 @@ struct graphics_priv { void *resize_callback_data; void (*motion_callback) (void *data, struct point * p); void *motion_callback_data; - void (*button_callback) (void *data, int press, int button, - struct point * p); + void (*button_callback) (void *data, int press, int button, struct point * p); void *button_callback_data; #ifdef USE_OPENGLES GLuint program; @@ -248,8 +247,7 @@ const char fragment_src [] = "; #endif -static void -graphics_destroy(struct graphics_priv *gr) { +static void graphics_destroy(struct graphics_priv *gr) { /*FIXME graphics_destroy is never called */ /*TODO add destroy code for image cache(delete entries in hImageData) */ gr->freetype_methods.destroy(); @@ -257,20 +255,16 @@ graphics_destroy(struct graphics_priv *gr) { gr = NULL; } -static void -gc_destroy(struct graphics_gc_priv *gc) { +static void gc_destroy(struct graphics_gc_priv *gc) { g_free(gc); gc = NULL; } -static void -gc_set_linewidth(struct graphics_gc_priv *gc, int w) { +static void gc_set_linewidth(struct graphics_gc_priv *gc, int w) { gc->linewidth = w; } -static void -gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, - unsigned char *dash_list, int n) { +static void gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char *dash_list, int n) { int i; const int cOpenglMaskBits = 16; gc->dash_count = n; @@ -325,16 +319,14 @@ gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, } -static void -gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { gc->fr = c->r / 65535.0; gc->fg = c->g / 65535.0; gc->fb = c->b / 65535.0; gc->fa = c->a / 65535.0; } -static void -gc_set_background(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_background(struct graphics_gc_priv *gc, struct color *c) { gc->br = c->r / 65535.0; gc->bg = c->g / 65535.0; gc->bb = c->b / 65535.0; @@ -349,8 +341,7 @@ static struct graphics_gc_methods gc_methods = { gc_set_background }; -static struct graphics_gc_priv * -gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth) { +static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth) { struct graphics_gc_priv *gc = g_new0(struct graphics_gc_priv, 1); *meth = gc_methods; @@ -361,9 +352,7 @@ gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth) { static struct graphics_image_priv image_error; -static struct graphics_image_priv * -image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, - char *path, int *w, int *h, struct point *hot, int rotation) { +static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation) { #ifdef HAVE_FREEIMAGE FIBITMAP *image; RGBQUAD aPixel; @@ -385,25 +374,20 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, return curr_elem; } else { if (strlen(path) < 4) { - g_hash_table_insert(hImageData, g_strdup(path), - &image_error); + g_hash_table_insert(hImageData, g_strdup(path), &image_error); return NULL; } char *ext_str = path + strlen(path) - 3; if (strstr(ext_str, "png") || strstr(path, "PNG")) { if ((image = FreeImage_Load(FIF_PNG, path, 0)) == NULL) { - g_hash_table_insert(hImageData, - g_strdup(path), - &image_error); + g_hash_table_insert(hImageData, g_strdup(path), &image_error); return NULL; } } else if (strstr(ext_str, "xpm") || strstr(path, "XPM")) { if ((image = FreeImage_Load(FIF_XPM, path, 0)) == NULL) { - g_hash_table_insert(hImageData, - g_strdup(path), - &image_error); + g_hash_table_insert(hImageData, g_strdup(path), &image_error); return NULL; } } else if (strstr(ext_str, "svg") || strstr(path, "SVG")) { @@ -411,17 +395,12 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, snprintf(path_new, strlen(path) - 3, "%s", path); strcat(path_new, "_48_48.png"); - if ((image = - FreeImage_Load(FIF_PNG, path_new, - 0)) == NULL) { - g_hash_table_insert(hImageData, - g_strdup(path), - &image_error); + if ((image = FreeImage_Load(FIF_PNG, path_new, 0)) == NULL) { + g_hash_table_insert(hImageData, g_strdup(path), &image_error); return NULL; } } else { - g_hash_table_insert(hImageData, g_strdup(path), - &image_error); + g_hash_table_insert(hImageData, g_strdup(path), &image_error); return NULL; } @@ -464,10 +443,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, for (j = 0; j < width; j++) { unsigned char idx; if (FreeImage_GetBPP(image) == 8) { - FreeImage_GetPixelIndex(image, j, - height - - i - 1, - &idx); + FreeImage_GetPixelIndex(image, j, height - i - 1, &idx); data[4 * width * i + 4 * j + 0] = palette[idx].rgbRed; data[4 * width * i + 4 * j + 1] = @@ -478,12 +454,8 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, 255; } else if (FreeImage_GetBPP(image) == 16 || FreeImage_GetBPP(image) == 24 - || FreeImage_GetBPP(image) == - 32) { - FreeImage_GetPixelColor(image, j, - height - - i - 1, - &aPixel); + || FreeImage_GetBPP(image) == 32) { + FreeImage_GetPixelColor(image, j, height - i - 1, &aPixel); int transparent = (aPixel.rgbRed == 0 && aPixel.rgbBlue == 0 @@ -526,8 +498,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, } -static void -set_color(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void set_color(struct graphics_priv *gr, struct graphics_gc_priv *gc) { #ifdef USE_OPENGLES2 GLfloat col[4]; col[0]=gc->fr; @@ -540,8 +511,7 @@ set_color(struct graphics_priv *gr, struct graphics_gc_priv *gc) { #endif } -static void -draw_array(struct graphics_priv *gr, struct point *p, int count, GLenum mode) { +static void draw_array(struct graphics_priv *gr, struct point *p, int count, GLenum mode) { int i; #ifdef USE_OPENGLES GLf x[count*2]; @@ -569,8 +539,7 @@ draw_array(struct graphics_priv *gr, struct point *p, int count, GLenum mode) { #endif } -static void -draw_rectangle_do(struct graphics_priv *gr, struct point *p, int w, int h) { +static void draw_rectangle_do(struct graphics_priv *gr, struct point *p, int w, int h) { struct point pa[4]; pa[0]=pa[1]=pa[2]=pa[3]=*p; pa[0].x+=w; @@ -589,8 +558,7 @@ static int next_power2(int x) { return r; } -static void -draw_image_es(struct graphics_priv *gr, struct point *p, int w, int h, unsigned char *data) { +static void draw_image_es(struct graphics_priv *gr, struct point *p, int w, int h, unsigned char *data) { GLf x[8]; memset(x, 0, sizeof(x)); @@ -640,8 +608,7 @@ draw_image_es(struct graphics_priv *gr, struct point *p, int w, int h, unsigned #endif -static void -get_overlay_pos(struct graphics_priv *gr, struct point *point_out) { +static void get_overlay_pos(struct graphics_priv *gr, struct point *point_out) { if (gr->parent == NULL) { point_out->x = 0; point_out->y = 0; @@ -658,9 +625,7 @@ get_overlay_pos(struct graphics_priv *gr, struct point *point_out) { } } -static void -draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, - struct point *p, int count) { +static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { if ((gr->parent && !gr->parent->overlay_enabled) || (gr->parent && gr->parent->overlay_enabled && !gr->overlay_enabled)) { @@ -691,8 +656,7 @@ static int tess_count; static struct point tess_array[512]; static GLenum tess_type; -const char * -getPrimitiveType(GLenum type) { +const char *getPrimitiveType(GLenum type) { char *ret = ""; switch (type) { @@ -730,8 +694,7 @@ getPrimitiveType(GLenum type) { return ret; } -void APIENTRY -tessBeginCB(GLenum which) { +void APIENTRY tessBeginCB(GLenum which) { dbg(lvl_debug, "glBegin( %s );", getPrimitiveType(which)); tess_type=which; tess_count=0; @@ -739,16 +702,14 @@ tessBeginCB(GLenum which) { -void APIENTRY -tessEndCB(void) { +void APIENTRY tessEndCB(void) { dbg(lvl_debug, "glEnd();"); draw_array(graphics_priv_root, tess_array, tess_count, tess_type); } -void APIENTRY -tessVertexCB(const GLvoid * data) { +void APIENTRY tessVertexCB(const GLvoid * data) { // cast back to double type const GLdouble *ptr = (const GLdouble *) data; dbg(lvl_debug, " glVertex3d();"); @@ -761,8 +722,7 @@ tessVertexCB(const GLvoid * data) { dbg(lvl_error,"overflow"); } -void APIENTRY -tessCombineCB(GLdouble c[3], void *d[4], GLfloat w[4], void **out) { +void APIENTRY tessCombineCB(GLdouble c[3], void *d[4], GLfloat w[4], void **out) { GLdouble *nv = (GLdouble *) malloc(sizeof(GLdouble) * 3); nv[0] = c[0]; nv[1] = c[1]; @@ -773,9 +733,7 @@ tessCombineCB(GLdouble c[3], void *d[4], GLfloat w[4], void **out) { #endif -static void -draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, - struct point *p, int count) { +static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { if ((gr->parent && !gr->parent->overlay_enabled) || (gr->parent && gr->parent->overlay_enabled && !gr->overlay_enabled)) { @@ -828,9 +786,7 @@ draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, #endif } -static void -draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, - struct point *p, int w, int h) { +static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { if ((gr->parent && !gr->parent->overlay_enabled) || (gr->parent && gr->parent->overlay_enabled && !gr->overlay_enabled)) { @@ -841,17 +797,13 @@ draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, graphics_priv_root->dirty = 1; } -static void -display_text_draw(struct font_freetype_text *text, - struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct graphics_gc_priv *bg, int color, struct point *p) { +static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, int color, struct point *p) { int i, x, y, stride; struct font_freetype_glyph *g, **gp; unsigned char *shadow, *glyph; struct color transparent = { 0x0000, 0x0000, 0x0000, 0x0000 }; struct color black = { - fg->fr * 65535, fg->fg * 65535, fg->fb * 65535, - fg->fa * 65535 + fg->fr * 65535, fg->fg * 65535, fg->fb * 65535, fg->fa * 65535 }; struct color white = { 0xffff, 0xffff, 0xffff, 0xffff }; @@ -899,10 +851,7 @@ display_text_draw(struct font_freetype_text *text, stride = (g->w + 2) * 4; if (color) { shadow = g_malloc(stride * (g->h + 2)); - gr->freetype_methods.get_shadow(g, shadow, - stride, - &white, - &transparent); + gr->freetype_methods.get_shadow(g, shadow, stride, &white, &transparent); #ifdef USE_OPENGLES struct point p; p.x=((x + g->x) >> 6)-1; @@ -914,10 +863,8 @@ display_text_draw(struct font_freetype_text *text, #else glPixelZoom(1.0, -1.0); #endif - glRasterPos2d((x + g->x) >> 6, - (y + g->y) >> 6); - glDrawPixels(g->w + 2, g->h + 2, PIXEL_FORMAT, - GL_UNSIGNED_BYTE, shadow); + glRasterPos2d((x + g->x) >> 6, (y + g->y) >> 6); + glDrawPixels(g->w + 2, g->h + 2, PIXEL_FORMAT, GL_UNSIGNED_BYTE, shadow); #endif g_free(shadow); } @@ -938,13 +885,7 @@ display_text_draw(struct font_freetype_text *text, if (bg) { glyph = g_malloc(stride * g->h * 4); - gr->freetype_methods.get_glyph(g, - glyph, - stride - * 4, - &black, - &white, - &transparent); + gr->freetype_methods.get_glyph(g, glyph, stride * 4, &black, &white, &transparent); #ifdef USE_OPENGLES struct point p; p.x=(x + g->x) >> 6; @@ -956,21 +897,14 @@ display_text_draw(struct font_freetype_text *text, #else glPixelZoom(1.0, -1.0); #endif - glRasterPos2d((x + g->x) >> 6, - (y + g->y) >> 6); - glDrawPixels(g->w, g->h, PIXEL_FORMAT, - GL_UNSIGNED_BYTE, - glyph); + glRasterPos2d((x + g->x) >> 6, (y + g->y) >> 6); + glDrawPixels(g->w, g->h, PIXEL_FORMAT, GL_UNSIGNED_BYTE, glyph); #endif g_free(glyph); } stride *= 4; glyph = g_malloc(stride * g->h); - gr->freetype_methods.get_glyph(g, glyph, - stride, - &black, - &white, - &transparent); + gr->freetype_methods.get_glyph(g, glyph, stride, &black, &white, &transparent); #ifdef USE_OPENGLES struct point p; p.x=(x + g->x) >> 6; @@ -982,10 +916,8 @@ display_text_draw(struct font_freetype_text *text, #else glPixelZoom(1.0, -1.0); #endif - glRasterPos2d((x + g->x) >> 6, - (y + g->y) >> 6); - glDrawPixels(g->w, g->h, PIXEL_FORMAT, - GL_UNSIGNED_BYTE, glyph); + glRasterPos2d((x + g->x) >> 6, (y + g->y) >> 6); + glDrawPixels(g->w, g->h, PIXEL_FORMAT, GL_UNSIGNED_BYTE, glyph); #endif g_free(glyph); } @@ -995,10 +927,7 @@ display_text_draw(struct font_freetype_text *text, } } -static void -draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct graphics_gc_priv *bg, struct graphics_font_priv *font, - char *text, struct point *p, int dx, int dy) { +static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { if ((gr->parent && !gr->parent->overlay_enabled) || (gr->parent && gr->parent->overlay_enabled && !gr->overlay_enabled)) { @@ -1015,9 +944,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, graphics_priv_root->dirty = 1; - t = gr->freetype_methods.text_new(text, - (struct font_freetype_font *) - font, dx, dy); + t = gr->freetype_methods.text_new(text, (struct font_freetype_font *) font, dx, dy); struct point p_eff; p_eff.x = p->x; @@ -1028,9 +955,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, } -static void -draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct point *p, struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { #ifdef USE_OPENGLES draw_image_es(gr, p, img->w, img->h, img->data); #else @@ -1059,8 +984,7 @@ draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, } -static void -draw_drag(struct graphics_priv *gr, struct point *p) { +static void draw_drag(struct graphics_priv *gr, struct point *p) { if (p) { gr->p.x = p->x; @@ -1068,13 +992,11 @@ draw_drag(struct graphics_priv *gr, struct point *p) { } } -static void -background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { gr->background_gc = gc; } -static void -handle_mouse_queue(void) { +static void handle_mouse_queue(void) { #ifdef USE_OPENGLES #else static int locked = 0; @@ -1097,9 +1019,7 @@ handle_mouse_queue(void) { mouse_queue[mouse_event_queue_begin_idx % mouse_event_queue_size].y; graphics_priv_root->force_redraw = 1; - callback_list_call_attr_3(graphics_priv_root->cbl, - attr_button, (void *) 0, - 1, (void *) &p); + callback_list_call_attr_3(graphics_priv_root->cbl, attr_button, (void *) 0, 1, (void *) &p); } else if (mouse_queue[mouse_event_queue_begin_idx]. button == GLUT_LEFT_BUTTON && mouse_queue[mouse_event_queue_begin_idx]. @@ -1112,9 +1032,7 @@ handle_mouse_queue(void) { mouse_queue[mouse_event_queue_begin_idx % mouse_event_queue_size].y; graphics_priv_root->force_redraw = 1; - callback_list_call_attr_3(graphics_priv_root->cbl, - attr_button, (void *) 1, - 1, (void *) &p); + callback_list_call_attr_3(graphics_priv_root->cbl, attr_button, (void *) 1, 1, (void *) &p); } ++mouse_event_queue_begin_idx; } @@ -1124,8 +1042,7 @@ handle_mouse_queue(void) { /*draws root graphics and its overlays*/ -static int -redraw_screen(struct graphics_priv *gr) { +static int redraw_screen(struct graphics_priv *gr) { #ifdef USE_OPENGLES #else graphics_priv_root->dirty = 0; @@ -1154,8 +1071,7 @@ redraw_screen(struct graphics_priv *gr) { #ifndef USE_OPENGLES /*filters call to redraw in overlay enabled(map) mode*/ -static gboolean -redraw_filter(gpointer data) { +static gboolean redraw_filter(gpointer data) { struct graphics_priv *gr = (struct graphics_priv*) data; if (gr->overlay_enabled && gr->dirty) { redraw_screen(gr); @@ -1166,8 +1082,7 @@ redraw_filter(gpointer data) { -static void -draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { +static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { if (gr->parent) { //overlay #ifdef USE_OPENGLES #else @@ -1207,18 +1122,15 @@ static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct point *p, int w, int h, int wraparound); -static int -graphics_opengl_fullscreen(struct window *w, int on) { +static int graphics_opengl_fullscreen(struct window *w, int on) { return 1; } -static void -graphics_opengl_disable_suspend(struct window *w) { +static void graphics_opengl_disable_suspend(struct window *w) { } #ifdef USE_OPENGLES2 -static GLuint -load_shader(const char *shader_source, GLenum type) { +static GLuint load_shader(const char *shader_source, GLenum type) { GLuint shader = glCreateShader(type); glShaderSource(shader, 1, &shader_source, NULL); @@ -1228,12 +1140,10 @@ load_shader(const char *shader_source, GLenum type) { } #endif -static void * -get_data(struct graphics_priv *this, const char *type) { +static void *get_data(struct graphics_priv *this, const char *type) { /*TODO initialize gtkglext context when type=="gtk_widget" */ if (!strcmp(type, "gtk_widget")) { - fprintf(stderr, - "Currently GTK gui is not yet supported with opengl graphics driver\n"); + fprintf(stderr, "Currently GTK gui is not yet supported with opengl graphics driver\n"); return NULL; } if (strcmp(type, "window") == 0) { @@ -1249,8 +1159,7 @@ get_data(struct graphics_priv *this, const char *type) { this->platform=graphics_opengl_egl_new(this->window_system_methods->get_display(this->window_system), this->window_system_methods->get_window(this->window_system), &this->platform_methods); - this->window_system_methods->set_callbacks(this->window_system, this, resize_callback_do, click_notify_do, - motion_notify_do, NULL); + this->window_system_methods->set_callbacks(this->window_system, this, resize_callback_do, click_notify_do, motion_notify_do, NULL); resize_callback(this->width,this->height); #if 0 glClearColor ( 0.4, 0.4, 0.4, 1); @@ -1313,8 +1222,7 @@ get_data(struct graphics_priv *this, const char *type) { } -static void -image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { +static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { //TODO free image data in hashtable when graphics is destroyed //currently graphics destroy is not called !!! /* @@ -1325,16 +1233,13 @@ image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { */ } -static void -overlay_disable(struct graphics_priv *gr, int disable) { +static void overlay_disable(struct graphics_priv *gr, int disable) { gr->overlay_enabled = !disable; gr->force_redraw = 1; draw_mode(gr, draw_mode_end); } -static void -overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, - int wraparound) { +static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int wraparound) { int changed = 0; int w2, h2; @@ -1370,9 +1275,7 @@ overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, gr->overlay_autodisabled = 0; } - callback_list_call_attr_2(gr->cbl, attr_resize, - GINT_TO_POINTER(gr->width), - GINT_TO_POINTER(gr->height)); + callback_list_call_attr_2(gr->cbl, attr_resize, GINT_TO_POINTER(gr->width), GINT_TO_POINTER(gr->height)); } } @@ -1401,8 +1304,7 @@ static struct graphics_methods graphics_methods = { NULL, /* hide_native_keyboard */ }; -static struct graphics_priv * -graphics_opengl_new_helper(struct graphics_methods *meth) { +static struct graphics_priv *graphics_opengl_new_helper(struct graphics_methods *meth) { struct font_priv *(*font_freetype_new) (void *meth); font_freetype_new = plugin_get_category_font("freetype"); @@ -1425,9 +1327,8 @@ graphics_opengl_new_helper(struct graphics_methods *meth) { return this; } -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, - struct point *p, int w, int h, int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, + struct point *p, int w, int h, int wraparound) { struct graphics_priv *this = graphics_opengl_new_helper(meth); this->p = *p; this->width = w; @@ -1453,16 +1354,14 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, #ifdef USE_OPENGLES -static void -click_notify_do(struct graphics_priv *priv, int button, int state, int x, int y) { +static void click_notify_do(struct graphics_priv *priv, int button, int state, int x, int y) { struct point p= {x,y}; dbg(lvl_debug,"enter state %d button %d",state,button); callback_list_call_attr_3(priv->cbl, attr_button, (void *) state, (void *)button, (void *) &p); } #endif -static void -click_notify(int button, int state, int x, int y) { +static void click_notify(int button, int state, int x, int y) { mouse_queue[mouse_event_queue_end_idx % mouse_event_queue_size].button = button; mouse_queue[mouse_event_queue_end_idx % @@ -1479,8 +1378,7 @@ click_notify(int button, int state, int x, int y) { ++mouse_event_queue_end_idx; } -static void -motion_notify_do(struct graphics_priv *priv, int x, int y) { +static void motion_notify_do(struct graphics_priv *priv, int x, int y) { struct point p; #ifdef MIRRORED_VIEW p.x = priv->width - x; @@ -1488,27 +1386,19 @@ motion_notify_do(struct graphics_priv *priv, int x, int y) { p.x = x; #endif p.y = y; - callback_list_call_attr_1(priv->cbl, attr_motion, - (void *) &p); + callback_list_call_attr_1(priv->cbl, attr_motion, (void *) &p); return; } -static void -motion_notify(int x, int y) { +static void motion_notify(int x, int y) { motion_notify_do(graphics_priv_root, x, y); } #ifndef USE_OPENGLES -static gboolean -graphics_opengl_idle(void *data) { +static gboolean graphics_opengl_idle(void *data) { static int opengl_init_ok = 0; if (!opengl_init_ok) { - callback_list_call_attr_2(graphics_priv_root->cbl, - attr_resize, - GINT_TO_POINTER - (graphics_priv_root->width), - GINT_TO_POINTER - (graphics_priv_root->height)); + callback_list_call_attr_2(graphics_priv_root->cbl, attr_resize, GINT_TO_POINTER (graphics_priv_root->width), GINT_TO_POINTER (graphics_priv_root->height)); opengl_init_ok = 1; } else { @@ -1521,8 +1411,7 @@ graphics_opengl_idle(void *data) { } #endif -static void -ProcessNormalKeys(unsigned char key_in, int x, int y) { +static void ProcessNormalKeys(unsigned char key_in, int x, int y) { int key = 0; char keybuf[2]; @@ -1537,12 +1426,10 @@ ProcessNormalKeys(unsigned char key_in, int x, int y) { keybuf[0] = key; keybuf[1] = '\0'; graphics_priv_root->force_redraw = 1; - callback_list_call_attr_1(graphics_priv_root->cbl, attr_keypress, - (void *) keybuf); + callback_list_call_attr_1(graphics_priv_root->cbl, attr_keypress, (void *) keybuf); } -static void -ProcessSpecialKeys(int key_in, int x, int y) { +static void ProcessSpecialKeys(int key_in, int x, int y) { int key = 0; char keybuf[2]; @@ -1572,12 +1459,10 @@ ProcessSpecialKeys(int key_in, int x, int y) { graphics_priv_root->force_redraw = 1; keybuf[0] = key; keybuf[1] = '\0'; - callback_list_call_attr_1(graphics_priv_root->cbl, attr_keypress, - (void *) keybuf); + callback_list_call_attr_1(graphics_priv_root->cbl, attr_keypress, (void *) keybuf); } -static void -resize_callback_do(struct graphics_priv *priv, int w, int h) { +static void resize_callback_do(struct graphics_priv *priv, int w, int h) { glViewport(0, 0, w, h); #ifndef USE_OPENGLES2 glMatrixMode(GL_PROJECTION); @@ -1591,33 +1476,25 @@ resize_callback_do(struct graphics_priv *priv, int w, int h) { priv->width = w; priv->height = h; - callback_list_call_attr_2(priv->cbl, attr_resize, - GINT_TO_POINTER(w), GINT_TO_POINTER(h)); + callback_list_call_attr_2(priv->cbl, attr_resize, GINT_TO_POINTER(w), GINT_TO_POINTER(h)); } -static void -resize_callback(int w, int h) { +static void resize_callback(int w, int h) { resize_callback_do(graphics_priv_root, w, h); } -static void -display(void) { +static void display(void) { graphics_priv_root->force_redraw = 1; redraw_screen(graphics_priv_root); - resize_callback(graphics_priv_root->width, - graphics_priv_root->height); + resize_callback(graphics_priv_root->width, graphics_priv_root->height); } -static void -glut_close(void) { - callback_list_call_attr_0(graphics_priv_root->cbl, - attr_window_closed); +static void glut_close(void) { + callback_list_call_attr_0(graphics_priv_root->cbl, attr_window_closed); } -static struct graphics_priv * -graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, - struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct attr *attr; if (!event_request_system("glib", "graphics_opengl_new")) @@ -1686,54 +1563,44 @@ graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, } -static void -event_opengl_main_loop_run(void) { +static void event_opengl_main_loop_run(void) { dbg(lvl_info, "enter"); } -static void -event_opengl_main_loop_quit(void) { +static void event_opengl_main_loop_quit(void) { dbg(lvl_debug, "enter"); } -static struct event_watch * -event_opengl_add_watch(int fd, enum event_watch_cond cond, - struct callback *cb) { +static struct event_watch *event_opengl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { dbg(lvl_debug, "enter"); return NULL; } -static void -event_opengl_remove_watch(struct event_watch *ev) { +static void event_opengl_remove_watch(struct event_watch *ev) { dbg(lvl_debug, "enter"); } -static struct event_timeout * -event_opengl_add_timeout(int timeout, int multi, struct callback *cb) { +static struct event_timeout *event_opengl_add_timeout(int timeout, int multi, struct callback *cb) { dbg(lvl_debug, "enter"); return NULL; } -static void -event_opengl_remove_timeout(struct event_timeout *to) { +static void event_opengl_remove_timeout(struct event_timeout *to) { dbg(lvl_debug, "enter"); } -static struct event_idle * -event_opengl_add_idle(int priority, struct callback *cb) { +static struct event_idle *event_opengl_add_idle(int priority, struct callback *cb) { dbg(lvl_debug, "enter"); return NULL; } -static void -event_opengl_remove_idle(struct event_idle *ev) { +static void event_opengl_remove_idle(struct event_idle *ev) { dbg(lvl_debug, "enter"); } -static void -event_opengl_call_callback(struct callback_list *cb) { +static void event_opengl_call_callback(struct callback_list *cb) { dbg(lvl_debug, "enter"); } @@ -1749,14 +1616,12 @@ static struct event_methods event_opengl_methods = { event_opengl_call_callback, }; -static struct event_priv * -event_opengl_new(struct event_methods *meth) { +static struct event_priv *event_opengl_new(struct event_methods *meth) { *meth = event_opengl_methods; return NULL; } -void -plugin_init(void) { +void plugin_init(void) { plugin_register_category_graphics("opengl", graphics_opengl_new); plugin_register_category_event("opengl", event_opengl_new); } diff --git a/navit/graphics/opengl/graphics_opengl_egl.c b/navit/graphics/opengl/graphics_opengl_egl.c index bb3ef5544..032169f7b 100644 --- a/navit/graphics/opengl/graphics_opengl_egl.c +++ b/navit/graphics/opengl/graphics_opengl_egl.c @@ -34,13 +34,11 @@ EGLint aEGLContextAttributes[] = { EGL_NONE }; -static void -graphics_opengl_egl_destroy(struct graphics_opengl_platform *egl) { +static void graphics_opengl_egl_destroy(struct graphics_opengl_platform *egl) { g_free(egl); } -static void -graphics_opengl_egl_swap_buffers(struct graphics_opengl_platform *egl) { +static void graphics_opengl_egl_swap_buffers(struct graphics_opengl_platform *egl) { eglSwapBuffers(egl->egldisplay, egl->eglwindow); } diff --git a/navit/graphics/opengl/graphics_opengl_x11.c b/navit/graphics/opengl/graphics_opengl_x11.c index fa9b44f0b..f56b2b9d5 100644 --- a/navit/graphics/opengl/graphics_opengl_x11.c +++ b/navit/graphics/opengl/graphics_opengl_x11.c @@ -23,8 +23,7 @@ struct graphics_opengl_window_system { }; -static void -graphics_opengl_x11_destroy(struct graphics_opengl_window_system *x11) { +static void graphics_opengl_x11_destroy(struct graphics_opengl_window_system *x11) { if (x11->watch) event_remove_watch(x11->watch); if (x11->cb) @@ -39,19 +38,15 @@ graphics_opengl_x11_destroy(struct graphics_opengl_window_system *x11) { g_free(x11); } -static void * -graphics_opengl_get_display(struct graphics_opengl_window_system *x11) { +static void *graphics_opengl_get_display(struct graphics_opengl_window_system *x11) { return x11->display; } -static void * -graphics_opengl_get_window(struct graphics_opengl_window_system *x11) { +static void *graphics_opengl_get_window(struct graphics_opengl_window_system *x11) { return (void *)x11->window; } -static void -graphics_opengl_set_callbacks(struct graphics_opengl_window_system *x11, void *data, void *resize, void *button, - void *motion, void *keypress) { +static void graphics_opengl_set_callbacks(struct graphics_opengl_window_system *x11, void *data, void *resize, void *button, void *motion, void *keypress) { x11->data=data; x11->resize=resize; x11->button=button; @@ -67,8 +62,7 @@ struct graphics_opengl_window_system_methods graphics_opengl_x11_methods = { graphics_opengl_set_callbacks, }; -static void -graphics_opengl_x11_watch(struct graphics_opengl_window_system *x11) { +static void graphics_opengl_x11_watch(struct graphics_opengl_window_system *x11) { XEvent event; while (XPending(x11->display)) { XNextEvent(x11->display, &event); @@ -110,8 +104,7 @@ graphics_opengl_x11_watch(struct graphics_opengl_window_system *x11) { } struct graphics_opengl_window_system * -graphics_opengl_x11_new(void *displayname, int w, int h, int depth, - struct graphics_opengl_window_system_methods **methods) { +graphics_opengl_x11_new(void *displayname, int w, int h, int depth, struct graphics_opengl_window_system_methods **methods) { struct graphics_opengl_window_system *ret=g_new0(struct graphics_opengl_window_system, 1); XSetWindowAttributes attributes; unsigned long valuemask; diff --git a/navit/graphics/qt5/event_qt5.cpp b/navit/graphics/qt5/event_qt5.cpp index 02e637439..5c7c3ca27 100644 --- a/navit/graphics/qt5/event_qt5.cpp +++ b/navit/graphics/qt5/event_qt5.cpp @@ -92,8 +92,7 @@ void qt5_navit_timer::timerEvent(QTimerEvent* event) { qt5_navit_timer* qt5_timer = NULL; -static void -event_qt5_main_loop_run(void) { +static void event_qt5_main_loop_run(void) { dbg(lvl_debug, "enter"); if (navit_app != NULL) @@ -105,8 +104,7 @@ static void event_qt5_main_loop_quit(void) { exit(0); } -static struct event_watch* -event_qt5_add_watch(int fd, enum event_watch_cond cond, struct callback* cb) { +static struct event_watch* event_qt5_add_watch(int fd, enum event_watch_cond cond, struct callback* cb) { dbg(lvl_debug, "enter fd=%d", (int)(long)fd); struct event_watch* ret = g_new0(struct event_watch, 1); ret->fd = fd; @@ -117,16 +115,14 @@ event_qt5_add_watch(int fd, enum event_watch_cond cond, struct callback* cb) { return ret; } -static void -event_qt5_remove_watch(struct event_watch* ev) { +static void event_qt5_remove_watch(struct event_watch* ev) { dbg(lvl_debug, "enter"); g_hash_table_remove(qt5_timer->watches, GINT_TO_POINTER(ev->fd)); delete (ev->sn); g_free(ev); } -static struct event_timeout* -event_qt5_add_timeout(int timeout, int multi, struct callback* cb) { +static struct event_timeout* event_qt5_add_timeout(int timeout, int multi, struct callback* cb) { int id; dbg(lvl_debug, "add timeout %d, mul %d, %p ==", timeout, multi, cb); id = qt5_timer->startTimer(timeout); @@ -136,28 +132,24 @@ event_qt5_add_timeout(int timeout, int multi, struct callback* cb) { return (struct event_timeout*)(long)id; } -static void -event_qt5_remove_timeout(struct event_timeout* to) { +static void event_qt5_remove_timeout(struct event_timeout* to) { dbg(lvl_debug, "remove timeout (%d)", (int)(long)to); qt5_timer->killTimer((int)(long)to); g_hash_table_remove(qt5_timer->timer_callback, to); g_hash_table_remove(qt5_timer->timer_type, to); } -static struct event_idle* -event_qt5_add_idle(int priority, struct callback* cb) { +static struct event_idle* event_qt5_add_idle(int priority, struct callback* cb) { dbg(lvl_debug, "add idle event"); return (struct event_idle*)event_qt5_add_timeout(0, 1, cb); } -static void -event_qt5_remove_idle(struct event_idle* ev) { +static void event_qt5_remove_idle(struct event_idle* ev) { dbg(lvl_debug, "Remove idle timeout"); event_qt5_remove_timeout((struct event_timeout*)ev); } -static void -event_qt5_call_callback(struct callback_list* cb) { +static void event_qt5_call_callback(struct callback_list* cb) { dbg(lvl_debug, "enter"); } @@ -173,8 +165,7 @@ static struct event_methods event_qt5_methods = { event_qt5_call_callback, }; -static struct event_priv* -event_qt5_new(struct event_methods* meth) { +static struct event_priv* event_qt5_new(struct event_methods* meth) { *meth = event_qt5_methods; qt5_timer = new qt5_navit_timer(NULL); return NULL; diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp index ddcd51244..c23a4f60f 100644 --- a/navit/graphics/qt5/graphics_qt5.cpp +++ b/navit/graphics/qt5/graphics_qt5.cpp @@ -86,8 +86,7 @@ struct graphics_image_priv { QPixmap* pixmap; }; -static void -graphics_destroy(struct graphics_priv* gr) { +static void graphics_destroy(struct graphics_priv* gr) { // dbg(lvl_debug,"enter"); #if HAVE_FREETYPE gr->freetype_methods.destroy(); @@ -181,8 +180,7 @@ static const char* fontfamilies[] = { * * Allocates a font handle and returnes filled interface stucture */ -static struct graphics_font_priv* font_new(struct graphics_priv* gr, struct graphics_font_methods* meth, char* font, - int size, int flags) { +static struct graphics_font_priv* font_new(struct graphics_priv* gr, struct graphics_font_methods* meth, char* font, int size, int flags) { int a = 0; struct graphics_font_priv* font_priv; dbg(lvl_debug, "enter (font %s, %d, 0x%x)", font, size, flags); @@ -219,22 +217,19 @@ static struct graphics_font_priv* font_new(struct graphics_priv* gr, struct grap return font_priv; } -static void -gc_destroy(struct graphics_gc_priv* gc) { +static void gc_destroy(struct graphics_gc_priv* gc) { // dbg(lvl_debug,"enter gc=%p", gc); delete (gc->pen); delete (gc->brush); g_free(gc); } -static void -gc_set_linewidth(struct graphics_gc_priv* gc, int w) { +static void gc_set_linewidth(struct graphics_gc_priv* gc, int w) { // dbg(lvl_debug,"enter gc=%p, %d", gc, w); gc->pen->setWidth(w); } -static void -gc_set_dashes(struct graphics_gc_priv* gc, int w, int offset, unsigned char* dash_list, int n) { +static void gc_set_dashes(struct graphics_gc_priv* gc, int w, int offset, unsigned char* dash_list, int n) { if (n <= 0) { dbg(lvl_error, "Refuse to set dashes without dash pattern"); } @@ -254,8 +249,7 @@ gc_set_dashes(struct graphics_gc_priv* gc, int w, int offset, unsigned char* das gc->pen->setDashPattern(dashes); } -static void -gc_set_foreground(struct graphics_gc_priv* gc, struct color* c) { +static void gc_set_foreground(struct graphics_gc_priv* gc, struct color* c) { QColor col(c->r >> 8, c->g >> 8, c->b >> 8, c->a >> 8); // dbg(lvl_debug,"context %p: color %02x%02x%02x",gc, c->r >> 8, c->g >> 8, c->b >> 8); gc->pen->setColor(col); @@ -263,8 +257,7 @@ gc_set_foreground(struct graphics_gc_priv* gc, struct color* c) { //gc->c=*c; } -static void -gc_set_background(struct graphics_gc_priv* gc, struct color* c) { +static void gc_set_background(struct graphics_gc_priv* gc, struct color* c) { QColor col(c->r >> 8, c->g >> 8, c->b >> 8, c->a >> 8); // dbg(lvl_debug,"context %p: color %02x%02x%02x",gc, c->r >> 8, c->g >> 8, c->b >> 8); //gc->pen->setColor(col); @@ -302,9 +295,7 @@ struct graphics_image_methods image_methods = { image_destroy }; -static struct graphics_image_priv* -image_new(struct graphics_priv* gr, struct graphics_image_methods* meth, char* path, int* w, int* h, struct point* hot, - int rotation) { +static struct graphics_image_priv* image_new(struct graphics_priv* gr, struct graphics_image_methods* meth, char* path, int* w, int* h, struct point* hot, int rotation) { struct graphics_image_priv* image_priv; // dbg(lvl_debug,"enter %s, %d %d", path, *w, *h); if (path[0] == 0) { @@ -384,8 +375,7 @@ image_new(struct graphics_priv* gr, struct graphics_image_methods* meth, char* p return image_priv; } -static void -draw_lines(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* p, int count) { +static void draw_lines(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* p, int count) { int i; QPolygon polygon; // dbg(lvl_debug,"enter gr=%p, gc=%p, (%d, %d)", gr, gc, p->x, p->y); @@ -398,8 +388,7 @@ draw_lines(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* gr->painter->drawPolyline(polygon); } -static void -draw_polygon(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* p, int count) { +static void draw_polygon(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* p, int count) { int i; QPolygon polygon; // dbg(lvl_debug,"enter gr=%p, gc=%p, (%d, %d)", gr, gc, p->x, p->y); @@ -420,8 +409,7 @@ draw_polygon(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point gr->painter->drawPolygon(polygon); } -static void -draw_rectangle(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* p, int w, int h) { +static void draw_rectangle(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* p, int w, int h) { // dbg(lvl_debug,"gr=%p gc=%p %d,%d,%d,%d", gr, gc, p->x, p->y, w, h); if (gr->painter == NULL) return; @@ -435,8 +423,7 @@ draw_rectangle(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct poi gr->painter->fillRect(p->x, p->y, w, h, *gc->brush); } -static void -draw_circle(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* p, int r) { +static void draw_circle(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* p, int r) { // dbg(lvl_debug,"enter gr=%p, gc=%p, (%d,%d) r=%d", gr, gc, p->x, p->y, r); if (gr->painter == NULL) return; @@ -457,9 +444,7 @@ draw_circle(struct graphics_priv* gr, struct graphics_gc_priv* gc, struct point* * * Renders given text on gr surface. Draws nice contrast outline around text. */ -static void -draw_text(struct graphics_priv* gr, struct graphics_gc_priv* fg, struct graphics_gc_priv* bg, - struct graphics_font_priv* font, char* text, struct point* p, int dx, int dy) { +static void draw_text(struct graphics_priv* gr, struct graphics_gc_priv* fg, struct graphics_gc_priv* bg, struct graphics_font_priv* font, char* text, struct point* p, int dx, int dy) { dbg(lvl_debug, "enter gc=%p, fg=%p, bg=%p pos(%d,%d) d(%d, %d) %s", gr, fg, bg, p->x, p->y, dx, dy, text); QPainter* painter = gr->painter; if (painter == NULL) @@ -550,8 +535,7 @@ draw_text(struct graphics_priv* gr, struct graphics_gc_priv* fg, struct graphics #endif } -static void -draw_image(struct graphics_priv* gr, struct graphics_gc_priv* fg, struct point* p, struct graphics_image_priv* img) { +static void draw_image(struct graphics_priv* gr, struct graphics_gc_priv* fg, struct point* p, struct graphics_image_priv* img) { // dbg(lvl_debug,"enter"); if (gr->painter != NULL) gr->painter->drawPixmap(p->x, p->y, *img->pixmap); @@ -604,14 +588,12 @@ static void draw_drag(struct graphics_priv* gr, struct point* p) { } } -static void -background_gc(struct graphics_priv* gr, struct graphics_gc_priv* gc) { +static void background_gc(struct graphics_priv* gr, struct graphics_gc_priv* gc) { // dbg(lvl_debug,"register context %p on %p", gc, gr); gr->background_graphics_gc_priv = gc; } -static void -draw_mode(struct graphics_priv* gr, enum draw_mode_num mode) { +static void draw_mode(struct graphics_priv* gr, enum draw_mode_num mode) { switch (mode) { case draw_mode_begin: dbg(lvl_debug, "Begin drawing on context %p (use == %d)", gr, gr->use_count); @@ -653,17 +635,14 @@ draw_mode(struct graphics_priv* gr, enum draw_mode_num mode) { } } -static struct graphics_priv* overlay_new(struct graphics_priv* gr, struct graphics_methods* meth, struct point* p, - int w, int h, int wraparound); +static struct graphics_priv* overlay_new(struct graphics_priv* gr, struct graphics_methods* meth, struct point* p, int w, int h, int wraparound); void resize_callback(struct graphics_priv* gr, int w, int h) { // dbg(lvl_debug,"enter (%d, %d)", w, h); - callback_list_call_attr_2(gr->callbacks, attr_resize, - GINT_TO_POINTER(w), GINT_TO_POINTER(h)); + callback_list_call_attr_2(gr->callbacks, attr_resize, GINT_TO_POINTER(w), GINT_TO_POINTER(h)); } -static int -graphics_qt5_fullscreen(struct window* w, int on) { +static int graphics_qt5_fullscreen(struct window* w, int on) { struct graphics_priv* gr; // dbg(lvl_debug,"enter"); gr = (struct graphics_priv*)w->priv; @@ -687,8 +666,7 @@ graphics_qt5_fullscreen(struct window* w, int on) { } #ifdef SAILFISH_OS -static void -keep_display_on(struct graphics_priv* priv) { +static void keep_display_on(struct graphics_priv* priv) { // dbg(lvl_debug,"enter"); QDBusConnection system = QDBusConnection::connectToBus(QDBusConnection::SystemBus, "system"); QDBusInterface interface("com.nokia.mce", "/com/nokia/mce/request", "com.nokia.mce.request", system); @@ -697,8 +675,7 @@ keep_display_on(struct graphics_priv* priv) { } #endif -static void -graphics_qt5_disable_suspend(struct window* w) { +static void graphics_qt5_disable_suspend(struct window* w) { // dbg(lvl_debug,"enter"); #ifdef SAILFISH_OS struct graphics_priv* gr; @@ -711,8 +688,7 @@ graphics_qt5_disable_suspend(struct window* w) { #endif } -static void* -get_data(struct graphics_priv* this_priv, char const* type) { +static void* get_data(struct graphics_priv* this_priv, char const* type) { // dbg(lvl_debug,"enter: %s", type); if (strcmp(type, "window") == 0) { struct window* win; @@ -749,8 +725,7 @@ static void image_free(struct graphics_priv* gr, struct graphics_image_priv* pri * * Calculates the bounding box around the given text. */ -static void get_text_bbox(struct graphics_priv* gr, struct graphics_font_priv* font, char* text, int dx, int dy, - struct point* ret, int estimate) { +static void get_text_bbox(struct graphics_priv* gr, struct graphics_font_priv* font, char* text, int dx, int dy, struct point* ret, int estimate) { int i; struct point pt; QString tmp = QString::fromUtf8(text); @@ -833,8 +808,7 @@ static struct graphics_methods graphics_methods = { }; /* create new graphics context on given context */ -static struct graphics_priv* -overlay_new(struct graphics_priv* gr, struct graphics_methods* meth, struct point* p, int w, int h, int wraparound) { +static struct graphics_priv* overlay_new(struct graphics_priv* gr, struct graphics_methods* meth, struct point* p, int w, int h, int wraparound) { struct graphics_priv* graphics_priv = NULL; graphics_priv = g_new0(struct graphics_priv, 1); *meth = graphics_methods; @@ -878,8 +852,7 @@ overlay_new(struct graphics_priv* gr, struct graphics_methods* meth, struct poin } /* create application and initial graphics context */ -static struct graphics_priv* -graphics_qt5_new(struct navit* nav, struct graphics_methods* meth, struct attr** attrs, struct callback_list* cbl) { +static struct graphics_priv* graphics_qt5_new(struct navit* nav, struct graphics_methods* meth, struct attr** attrs, struct callback_list* cbl) { struct graphics_priv* graphics_priv = NULL; struct attr* event_loop_system = NULL; struct attr* platform = NULL; diff --git a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp index 7f90aa9d4..423f3d5fb 100644 --- a/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp +++ b/navit/graphics/qt_qpainter/graphics_qt_qpainter.cpp @@ -35,8 +35,7 @@ //# Comment: //# Authors: Martin Schaller (04/2008), Stefan Klumpp (04/2008) //############################################################################################################## -static void -overlay_rect(struct graphics_priv *parent, struct graphics_priv *overlay, int clean, QRect *r) { +static void overlay_rect(struct graphics_priv *parent, struct graphics_priv *overlay, int clean, QRect *r) { struct point p; int w,h; if (clean) { @@ -59,8 +58,7 @@ overlay_rect(struct graphics_priv *parent, struct graphics_priv *overlay, int cl r->setRect(p.x, p.y, w, h); } -void -qt_qpainter_draw(struct graphics_priv *gr, const QRect *r, int paintev) { +void qt_qpainter_draw(struct graphics_priv *gr, const QRect *r, int paintev) { if (!paintev) { #ifndef QT_QPAINTER_NO_WIDGET dbg(lvl_debug,"update %d,%d %d x %d", r->x(), r->y(), r->width(), r->height()); @@ -172,8 +170,7 @@ static struct graphics_font_methods font_methods = { //# Comment: //# Authors: Martin Schaller (04/2008) //############################################################################################################## -static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, - char *fontfamily, int size, int flags) { +static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *fontfamily, int size, int flags) { struct graphics_font_priv *ret=g_new0(struct graphics_font_priv, 1); ret->font=new QFont("Arial",size/20); *meth=font_methods; @@ -259,8 +256,7 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics //# Comment: //# Authors: Martin Schaller (04/2008) //############################################################################################################## -static struct graphics_image_priv * image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, - int *w, int *h, struct point *hot, int rotation) { +static struct graphics_image_priv * image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation) { struct graphics_image_priv *ret; QPixmap *cachedPixmap; QString key(path); @@ -366,8 +362,7 @@ static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, s //# Comment: //# Authors: Martin Schaller (04/2008) //############################################################################################################## -static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, - struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { +static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { QPainter *painter=gr->painter; #ifndef QT_QPAINTER_USE_FREETYPE QString tmp=QString::fromUtf8(text); @@ -440,13 +435,11 @@ static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, str //# Comment: //# Authors: Martin Schaller (04/2008) //############################################################################################################## -static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, - struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { gr->painter->drawPixmap(p->x, p->y, *img->pixmap); } -static void -draw_drag(struct graphics_priv *gr, struct point *p) { +static void draw_drag(struct graphics_priv *gr, struct point *p) { if (!gr->cleanup) { gr->pclean=gr->p; gr->cleanup=1; @@ -519,8 +512,7 @@ static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graph static int argc=1; static char *argv[]= {NULL,NULL,NULL}; -static int -fullscreen(struct window *win, int on) { +static int fullscreen(struct window *win, int on) { #ifndef QT_QPAINTER_NO_WIDGET struct graphics_priv *this_=(struct graphics_priv *)win->priv; QWidget* _outerWidget; @@ -537,8 +529,7 @@ fullscreen(struct window *win, int on) { return 1; } -static void -disable_suspend(struct window *win) { +static void disable_suspend(struct window *win) { #ifdef HAVE_QPE struct graphics_priv *this_=(struct graphics_priv *)win->priv; this_->app->setTempScreenSaverMode(QPEApplication::DisableLightOff); @@ -588,15 +579,12 @@ static void * get_data(struct graphics_priv *this_, const char *type) { return NULL; } -static void -image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { +static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { delete priv->pixmap; g_free(priv); } -static void -get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, - int estimate) { +static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate) { QPainter *painter=gr->painter; QString tmp=QString::fromUtf8(text); painter->setFont(*font->font); @@ -684,8 +672,7 @@ static struct graphics_methods graphics_methods = { //# Comment: //# Authors: Martin Schaller (04/2008) //############################################################################################################## -static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, - int w, int h,int wraparound) { +static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h,int wraparound) { *meth=graphics_methods; struct graphics_priv *ret=g_new0(struct graphics_priv, 1); #ifdef QT_QPAINTER_USE_FREETYPE @@ -716,8 +703,7 @@ static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graph static struct graphics_priv *event_gr; -static void -event_qt_main_loop_run(void) { +static void event_qt_main_loop_run(void) { event_gr->app->exec(); } @@ -726,8 +712,7 @@ static void event_qt_main_loop_quit(void) { exit(0); } -static struct event_watch * -event_qt_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { +static struct event_watch *event_qt_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { dbg(lvl_debug,"enter fd=%d",(int)(long)fd); struct event_watch *ret=g_new0(struct event_watch, 1); ret->fd=fd; @@ -738,16 +723,14 @@ event_qt_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { return ret; } -static void -event_qt_remove_watch(struct event_watch *ev) { +static void event_qt_remove_watch(struct event_watch *ev) { g_hash_table_remove(event_gr->widget->watches, GINT_TO_POINTER(ev->fd)); delete(ev->sn); g_free(ev); } -static struct event_timeout * -event_qt_add_timeout(int timeout, int multi, struct callback *cb) { +static struct event_timeout *event_qt_add_timeout(int timeout, int multi, struct callback *cb) { int id; id=event_gr->widget->startTimer(timeout); g_hash_table_insert(event_gr->widget->timer_callback, (void *)id, cb); @@ -755,27 +738,23 @@ event_qt_add_timeout(int timeout, int multi, struct callback *cb) { return (struct event_timeout *)id; } -void -event_qt_remove_timeout(struct event_timeout *ev) { +void event_qt_remove_timeout(struct event_timeout *ev) { event_gr->widget->killTimer((int)(long)ev); g_hash_table_remove(event_gr->widget->timer_callback, ev); g_hash_table_remove(event_gr->widget->timer_type, ev); } -static struct event_idle * -event_qt_add_idle(int priority, struct callback *cb) { +static struct event_idle *event_qt_add_idle(int priority, struct callback *cb) { dbg(lvl_debug,"enter"); return (struct event_idle *)event_qt_add_timeout(0, 1, cb); } -static void -event_qt_remove_idle(struct event_idle *ev) { +static void event_qt_remove_idle(struct event_idle *ev) { dbg(lvl_debug,"enter"); event_qt_remove_timeout((struct event_timeout *) ev); } -static void -event_qt_call_callback(struct callback_list *cb) { +static void event_qt_call_callback(struct callback_list *cb) { dbg(lvl_debug,"enter"); } @@ -807,8 +786,7 @@ event_qt_new(struct event_methods *meth) { //# Comment: //# Authors: Martin Schaller (04/2008) //############################################################################################################## -static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct graphics_methods *meth, - struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv * graphics_qt_qpainter_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct graphics_priv *ret; struct font_priv * (*font_freetype_new)(void *meth); struct attr *attr; diff --git a/navit/graphics/sdl/event.c b/navit/graphics/sdl/event.c index f5499c0c2..e94f1431b 100644 --- a/navit/graphics/sdl/event.c +++ b/navit/graphics/sdl/event.c @@ -215,8 +215,7 @@ static void event_sdl_watch_stopthread() { } } -static struct event_watch * -event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { +static struct event_watch *event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { dbg(lvl_debug, "fd(%d) cond(%x) cb(%x)", fd, cond, cb); event_sdl_watch_stopthread(); @@ -267,8 +266,7 @@ static void event_sdl_remove_watch(struct event_watch *ew) { /* Timeout */ -static struct event_timeout * -event_sdl_add_timeout(int timeout, int multi, struct callback *cb) { +static struct event_timeout *event_sdl_add_timeout(int timeout, int multi, struct callback *cb) { struct event_timeout * ret = g_new0(struct event_timeout, 1); if (!ret) return ret; @@ -307,8 +305,7 @@ static gint sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb) { return 0; } -static struct event_idle * -event_sdl_add_idle(int priority, struct callback *cb) { +static struct event_idle *event_sdl_add_idle(int priority, struct callback *cb) { dbg(lvl_debug, "add idle priority(%d) cb(%p)", priority, cb); struct idle_task *task = g_new0(struct idle_task, 1); @@ -368,8 +365,7 @@ static struct event_methods event_sdl_methods = { event_sdl_main_loop_run, event_sdl_remove_idle, event_sdl_call_callback, }; -static struct event_priv * -event_sdl_new(struct event_methods* methods) { +static struct event_priv *event_sdl_new(struct event_methods* methods) { idle_tasks = g_ptr_array_new(); *methods = event_sdl_methods; return NULL; diff --git a/navit/graphics/sdl/event_sdl.c b/navit/graphics/sdl/event_sdl.c index d74b91f27..5e258c643 100644 --- a/navit/graphics/sdl/event_sdl.c +++ b/navit/graphics/sdl/event_sdl.c @@ -43,8 +43,7 @@ static struct event_idle *event_sdl_add_idle(int, struct callback *); static void event_sdl_remove_idle(struct event_idle *); static void event_sdl_call_callback(struct callback_list *); -static Uint32 -sdl_timer_callback(Uint32 interval, void* param) { +static Uint32 sdl_timer_callback(Uint32 interval, void* param) { struct event_timeout *timeout=(struct event_timeout*)param; dbg(lvl_debug,"timer(%p) multi(%d) interval(%d) fired", param, timeout->multi, interval); @@ -71,21 +70,18 @@ sdl_timer_callback(Uint32 interval, void* param) { /* SDL Mainloop */ -static void -event_sdl_main_loop_run(void) { +static void event_sdl_main_loop_run(void) { graphics_sdl_idle(NULL); event_sdl_watch_stopthread(); } -static void -event_sdl_main_loop_quit(void) { +static void event_sdl_main_loop_quit(void) { quit_event_loop = 1; } /* Watch */ -void -event_sdl_watch_thread (GPtrArray *watch_list) { +void event_sdl_watch_thread (GPtrArray *watch_list) { struct pollfd *pfds = g_new0 (struct pollfd, watch_list->len); struct event_watch *ew; int ret; @@ -123,8 +119,7 @@ event_sdl_watch_thread (GPtrArray *watch_list) { pthread_exit(0); } -static void -event_sdl_watch_startthread(GPtrArray *watch_list) { +static void event_sdl_watch_startthread(GPtrArray *watch_list) { dbg(lvl_debug,"enter"); if (sdl_watch_thread) event_sdl_watch_stopthread(); @@ -135,8 +130,7 @@ event_sdl_watch_startthread(GPtrArray *watch_list) { dbg_assert (ret == 0); } -static void -event_sdl_watch_stopthread() { +static void event_sdl_watch_stopthread() { dbg(lvl_debug,"enter"); if (sdl_watch_thread) { /* Notify the watch thread that the list of FDs will change */ @@ -146,8 +140,7 @@ event_sdl_watch_stopthread() { } } -static struct event_watch * -event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { +static struct event_watch *event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { dbg(lvl_debug,"fd(%d) cond(%x) cb(%x)", fd, cond, cb); event_sdl_watch_stopthread(); @@ -183,8 +176,7 @@ event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { return new_ew; } -static void -event_sdl_remove_watch(struct event_watch *ew) { +static void event_sdl_remove_watch(struct event_watch *ew) { dbg(lvl_debug,"enter %p",ew); event_sdl_watch_stopthread(); @@ -199,8 +191,7 @@ event_sdl_remove_watch(struct event_watch *ew) { /* Timeout */ -static struct event_timeout * -event_sdl_add_timeout(int timeout, int multi, struct callback *cb) { +static struct event_timeout *event_sdl_add_timeout(int timeout, int multi, struct callback *cb) { struct event_timeout * ret = g_new0(struct event_timeout, 1); if(!ret) { dbg(lvl_error,"g_new0 failed"); @@ -214,8 +205,7 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb) { return ret; } -static void -event_sdl_remove_timeout(struct event_timeout *to) { +static void event_sdl_remove_timeout(struct event_timeout *to) { dbg(lvl_info,"enter %p", to); if(to) { /* do not SDL_RemoveTimer if oneshot timer has already fired */ @@ -232,8 +222,7 @@ event_sdl_remove_timeout(struct event_timeout *to) { /* Idle */ /* sort ptr_array by priority, increasing order */ -static gint -sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb) { +static gint sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb) { struct idle_task *a = (struct idle_task *)parama; struct idle_task *b = (struct idle_task *)paramb; if (a->priority < b->priority) @@ -243,8 +232,7 @@ sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb) { return 0; } -static struct event_idle * -event_sdl_add_idle(int priority, struct callback *cb) { +static struct event_idle *event_sdl_add_idle(int priority, struct callback *cb) { dbg(lvl_debug,"add idle priority(%d) cb(%p)", priority, cb); struct idle_task *task = g_new0(struct idle_task, 1); @@ -274,16 +262,14 @@ event_sdl_add_idle(int priority, struct callback *cb) { return (struct event_idle *)task; } -static void -event_sdl_remove_idle(struct event_idle *task) { +static void event_sdl_remove_idle(struct event_idle *task) { dbg(lvl_debug,"remove task(%p)", task); g_ptr_array_remove(idle_tasks, (gpointer)task); } /* callback */ -static void -event_sdl_call_callback(struct callback_list *cbl) { +static void event_sdl_call_callback(struct callback_list *cbl) { dbg(lvl_debug,"call_callback cbl(%p)",cbl); SDL_Event event; SDL_UserEvent userevent; @@ -311,14 +297,12 @@ static struct event_methods event_sdl_methods = { event_sdl_call_callback, }; -static struct event_priv * -event_sdl_new(struct event_methods* methods) { +static struct event_priv *event_sdl_new(struct event_methods* methods) { idle_tasks = g_ptr_array_new(); *methods = event_sdl_methods; return NULL; } -void -event_sdl_register(void) { +void event_sdl_register(void) { plugin_register_category_event("sdl", event_sdl_new); } diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c index 92f8f4eb8..d9d31df8e 100644 --- a/navit/graphics/sdl/graphics_sdl.c +++ b/navit/graphics/sdl/graphics_sdl.c @@ -182,8 +182,7 @@ struct graphics_image_priv { }; -static void -graphics_destroy(struct graphics_priv *gr) { +static void graphics_destroy(struct graphics_priv *gr) { dbg(lvl_debug, "graphics_destroy %p %u", gr, gr->overlay_mode); if(gr->overlay_mode) { @@ -207,24 +206,20 @@ graphics_destroy(struct graphics_priv *gr) { /* graphics_gc */ -static void -gc_destroy(struct graphics_gc_priv *gc) { +static void gc_destroy(struct graphics_gc_priv *gc) { g_free(gc); } -static void -gc_set_linewidth(struct graphics_gc_priv *gc, int w) { +static void gc_set_linewidth(struct graphics_gc_priv *gc, int w) { dbg(lvl_debug, "gc_set_linewidth %p %d", gc, w); gc->linewidth = w; } -static void -gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { +static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n) { /* TODO */ } -static void -gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { dbg(lvl_debug, "gc_set_foreground: %p %d %d %d %d", gc, c->a, c->r, c->g, c->b); gc->fore_r = c->r/256; gc->fore_g = c->g/256; @@ -232,8 +227,7 @@ gc_set_foreground(struct graphics_gc_priv *gc, struct color *c) { gc->fore_a = c->a/256; } -static void -gc_set_background(struct graphics_gc_priv *gc, struct color *c) { +static void gc_set_background(struct graphics_gc_priv *gc, struct color *c) { dbg(lvl_debug, "gc_set_background: %p %d %d %d %d", gc, c->a, c->r, c->g, c->b); gc->back_r = c->r/256; gc->back_g = c->g/256; @@ -258,9 +252,7 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics } -static struct graphics_image_priv * -image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, - struct point *hot, int rotation) { +static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation) { struct graphics_image_priv *gi; /* FIXME: meth is not used yet.. so gi leaks. at least xpm is small */ @@ -286,14 +278,12 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n return gi; } -static void -image_free(struct graphics_priv *gr, struct graphics_image_priv * gi) { +static void image_free(struct graphics_priv *gr, struct graphics_image_priv * gi) { SDL_FreeSurface(gi->img); g_free(gi); } -static void -draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent && gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) { return; @@ -332,8 +322,7 @@ draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point } } -static void -draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { +static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent && gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) { return; @@ -356,8 +345,7 @@ draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct poi gc->fore_a)); } -static void -draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r) { +static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r) { if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent && gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) { return; @@ -388,8 +376,7 @@ draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point } -static void -draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { +static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent && gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) { return; @@ -498,8 +485,7 @@ draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point * } -static void -set_pixel(SDL_Surface *surface, int x, int y, Uint8 r2, Uint8 g2, Uint8 b2, Uint8 a2) { +static void set_pixel(SDL_Surface *surface, int x, int y, Uint8 r2, Uint8 g2, Uint8 b2, Uint8 a2) { if(x<0 || y<0 || x>=surface->w || y>=surface->h) { return; } @@ -531,8 +517,7 @@ set_pixel(SDL_Surface *surface, int x, int y, Uint8 r2, Uint8 g2, Uint8 b2, Uint } -static void -resize_ft_buffer (unsigned int new_size) { +static void resize_ft_buffer (unsigned int new_size) { if (new_size > ft_buffer_size) { g_free (ft_buffer); ft_buffer = g_malloc (new_size); @@ -541,10 +526,7 @@ resize_ft_buffer (unsigned int new_size) { } } -static void -display_text_draw(struct font_freetype_text *text, - struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct graphics_gc_priv *bg, int color, struct point *p) { +static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, int color, struct point *p) { int i, x, y, stride; struct font_freetype_glyph *g, **gp; struct color transparent = { 0x0000, 0x0000, 0x0000, 0x0000 }; @@ -679,10 +661,7 @@ display_text_draw(struct font_freetype_text *text, } } -static void -draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, - struct graphics_gc_priv *bg, struct graphics_font_priv *font, - char *text, struct point *p, int dx, int dy) { +static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent && gr->overlay_parent->overlay_enable && !gr->overlay_enable)) { @@ -696,9 +675,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, dbg(lvl_error, "no font, returning"); return; } - t = gr->freetype_methods.text_new(text, - (struct font_freetype_font *) font, - dx, dy); + t = gr->freetype_methods.text_new(text, (struct font_freetype_font *) font, dx, dy); struct point p_eff; p_eff.x = p->x; @@ -708,8 +685,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, gr->freetype_methods.text_destroy(t); } -static void -draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent && gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) { return; @@ -725,14 +701,12 @@ draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point * SDL_BlitSurface(img->img, NULL, gr->screen, &r); } -static void -background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { +static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { dbg(lvl_debug, "background_gc"); } -static void -draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { +static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { struct graphics_priv *ov; SDL_Rect rect; int i; @@ -753,8 +727,7 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { if(rect.y<0) rect.y += gr->screen->h; rect.w = ov->screen->w; rect.h = ov->screen->h; - SDL_BlitSurface(ov->screen, NULL, - gr->screen, &rect); + SDL_BlitSurface(ov->screen, NULL, gr->screen, &rect); } } } @@ -775,8 +748,8 @@ static void overlay_disable(struct graphics_priv *gr, int disable) { draw_mode(curr_gr,draw_mode_end); } -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound); +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, + int w, int h, int wraparound); static int window_fullscreen(struct window *win, int on) { struct graphics_priv *gr=(struct graphics_priv *)win->priv; @@ -798,8 +771,7 @@ static int window_fullscreen(struct window *win, int on) { return 1; } -static void * -get_data(struct graphics_priv *this, char const *type) { +static void *get_data(struct graphics_priv *this, char const *type) { if(strcmp(type, "window") == 0) { struct window *win; win=g_new(struct window, 1); @@ -845,8 +817,7 @@ static struct graphics_methods graphics_methods = { NULL, /* hide_native_keyboard */ }; -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h,int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h,int wraparound) { struct graphics_priv *ov; Uint32 rmask, gmask, bmask, amask; int i; @@ -1304,8 +1275,7 @@ static gboolean graphics_sdl_idle(void *data) { } -static struct graphics_priv * -graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { struct graphics_priv *this=g_new0(struct graphics_priv, 1); struct font_priv *(*font_freetype_new) (void *meth); struct attr *attr; @@ -1456,8 +1426,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr * #ifdef USE_WEBOS /* ---------- SDL Eventhandling ---------- */ -static Uint32 -sdl_timer_callback(Uint32 interval, void* param) { +static Uint32 sdl_timer_callback(Uint32 interval, void* param) { struct event_timeout *timeout=(struct event_timeout*)param; dbg(lvl_debug,"timer(%p) multi(%d) interval(%d) fired", param, timeout->multi, interval); @@ -1484,22 +1453,19 @@ sdl_timer_callback(Uint32 interval, void* param) { /* SDL Mainloop */ -static void -event_sdl_main_loop_run(void) { +static void event_sdl_main_loop_run(void) { PDL_ScreenTimeoutEnable(PDL_FALSE); graphics_sdl_idle(NULL); PDL_ScreenTimeoutEnable(PDL_TRUE); } -static void -event_sdl_main_loop_quit(void) { +static void event_sdl_main_loop_quit(void) { quit_event_loop = 1; } /* Watch */ -static void -event_sdl_watch_thread (GPtrArray *watch_list) { +static void event_sdl_watch_thread (GPtrArray *watch_list) { struct pollfd *pfds = g_new0 (struct pollfd, watch_list->len); struct event_watch *ew; int ret; @@ -1537,8 +1503,7 @@ event_sdl_watch_thread (GPtrArray *watch_list) { pthread_exit(0); } -static void -event_sdl_watch_startthread(GPtrArray *watch_list) { +static void event_sdl_watch_startthread(GPtrArray *watch_list) { dbg(lvl_debug,"enter"); if (sdl_watch_thread) event_sdl_watch_stopthread(); @@ -1549,8 +1514,7 @@ event_sdl_watch_startthread(GPtrArray *watch_list) { dbg_assert (ret == 0); } -static void -event_sdl_watch_stopthread() { +static void event_sdl_watch_stopthread() { dbg(lvl_debug,"enter"); if (sdl_watch_thread) { /* Notify the watch thread that the list of FDs will change */ @@ -1560,8 +1524,7 @@ event_sdl_watch_stopthread() { } } -static struct event_watch * -event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { +static struct event_watch *event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { dbg(lvl_debug,"fd(%d) cond(%x) cb(%x)", fd, cond, cb); event_sdl_watch_stopthread(); @@ -1597,8 +1560,7 @@ event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb) { return new_ew; } -static void -event_sdl_remove_watch(struct event_watch *ew) { +static void event_sdl_remove_watch(struct event_watch *ew) { dbg(lvl_debug,"enter %p",ew); event_sdl_watch_stopthread(); @@ -1613,8 +1575,7 @@ event_sdl_remove_watch(struct event_watch *ew) { /* Timeout */ -static struct event_timeout * -event_sdl_add_timeout(int timeout, int multi, struct callback *cb) { +static struct event_timeout *event_sdl_add_timeout(int timeout, int multi, struct callback *cb) { struct event_timeout * ret = g_new0(struct event_timeout, 1); if(!ret) { dbg(lvl_error,"g_new0 failed"); @@ -1628,8 +1589,7 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb) { return ret; } -static void -event_sdl_remove_timeout(struct event_timeout *to) { +static void event_sdl_remove_timeout(struct event_timeout *to) { dbg(lvl_info,"enter %p", to); if(to) { /* do not SDL_RemoveTimer if oneshot timer has already fired */ @@ -1646,8 +1606,7 @@ event_sdl_remove_timeout(struct event_timeout *to) { /* Idle */ /* sort ptr_array by priority, increasing order */ -static gint -sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb) { +static gint sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb) { struct idle_task *a = (struct idle_task *)parama; struct idle_task *b = (struct idle_task *)paramb; if (a->priority < b->priority) @@ -1657,8 +1616,7 @@ sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb) { return 0; } -static struct event_idle * -event_sdl_add_idle(int priority, struct callback *cb) { +static struct event_idle *event_sdl_add_idle(int priority, struct callback *cb) { dbg(lvl_debug,"add idle priority(%d) cb(%p)", priority, cb); struct idle_task *task = g_new0(struct idle_task, 1); @@ -1688,16 +1646,14 @@ event_sdl_add_idle(int priority, struct callback *cb) { return (struct event_idle *)task; } -static void -event_sdl_remove_idle(struct event_idle *task) { +static void event_sdl_remove_idle(struct event_idle *task) { dbg(lvl_debug,"remove task(%p)", task); g_ptr_array_remove(idle_tasks, (gpointer)task); } /* callback */ -static void -event_sdl_call_callback(struct callback_list *cbl) { +static void event_sdl_call_callback(struct callback_list *cbl) { dbg(lvl_debug,"call_callback cbl(%p)",cbl); SDL_Event event; SDL_UserEvent userevent; @@ -1725,8 +1681,7 @@ static struct event_methods event_sdl_methods = { event_sdl_call_callback, }; -static struct event_priv * -event_sdl_new(struct event_methods* methods) { +static struct event_priv *event_sdl_new(struct event_methods* methods) { idle_tasks = g_ptr_array_new(); *methods = event_sdl_methods; return NULL; @@ -1735,8 +1690,7 @@ event_sdl_new(struct event_methods* methods) { /* ---------- SDL Eventhandling ---------- */ #endif -void -plugin_init(void) { +void plugin_init(void) { #ifdef USE_WEBOS plugin_register_category_event("sdl", event_sdl_new); #endif diff --git a/navit/graphics/win32/graphics_win32.c b/navit/graphics/win32/graphics_win32.c index 668cd595d..7a8d4e8cc 100644 --- a/navit/graphics/win32/graphics_win32.c +++ b/navit/graphics/win32/graphics_win32.c @@ -589,8 +589,7 @@ static int fullscreen(struct window *win, int on) { } extern void WINAPI SystemIdleTimerReset(void); -static struct event_timeout * -event_win32_add_timeout(int timeout, int multi, struct callback *cb); +static struct event_timeout *event_win32_add_timeout(int timeout, int multi, struct callback *cb); static void disable_suspend(struct window *win) { #ifdef HAVE_API_WIN32_CE @@ -1036,8 +1035,7 @@ static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct grap #include "png.h" -static int -pngdecode(struct graphics_priv *gr, char *name, struct graphics_image_priv *img) { +static int pngdecode(struct graphics_priv *gr, char *name, struct graphics_image_priv *img) { png_struct *png_ptr = NULL; png_info *info_ptr = NULL; png_byte buf[8]; @@ -1233,8 +1231,7 @@ static void pngscale(struct graphics_image_priv *img, struct graphics_priv *gr, } -static void -pngrender(struct graphics_image_priv *img, struct graphics_priv *gr, int x0, int y0) { +static void pngrender(struct graphics_image_priv *img, struct graphics_priv *gr, int x0, int y0) { if (gr->AlphaBlend && img->hBitmap) { HDC hdc; HBITMAP oldBitmap; @@ -1295,8 +1292,7 @@ pngrender(struct graphics_image_priv *img, struct graphics_priv *gr, int x0, int } } -static int -xpmdecode(char *name, struct graphics_image_priv *img) { +static int xpmdecode(char *name, struct graphics_image_priv *img) { img->pxpm = Xpm2bmp_new(); if (Xpm2bmp_load( img->pxpm, name ) != 0) { g_free(img->pxpm); @@ -1371,8 +1367,7 @@ static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, st pngrender(img, gr, p->x, p->y); } -static struct graphics_priv * -graphics_win32_new_helper(struct graphics_methods *meth); +static struct graphics_priv *graphics_win32_new_helper(struct graphics_methods *meth); static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int wraparound) { dbg(lvl_debug, "resize overlay: %x, x: %d, y: %d, w: %d, h: %d, wraparound: %d", gr, p->x, p->y, w, h, wraparound); @@ -1388,8 +1383,8 @@ static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int } -static struct graphics_priv * -overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, + int w, int h, int wraparound) { struct graphics_priv *this=graphics_win32_new_helper(meth); dbg(lvl_debug, "overlay: %x, x: %d, y: %d, w: %d, h: %d, wraparound: %d", this, p->x, p->y, w, h, wraparound); this->width = w; @@ -1476,8 +1471,7 @@ static struct graphics_methods graphics_methods = { }; -static struct graphics_priv * -graphics_win32_new_helper(struct graphics_methods *meth) { +static struct graphics_priv *graphics_win32_new_helper(struct graphics_methods *meth) { struct graphics_priv *this_=g_new0(struct graphics_priv,1); *meth=graphics_methods; this_->mode = -1; @@ -1517,8 +1511,8 @@ static void bind_late(struct graphics_priv* gra_priv) { -static struct graphics_priv* -graphics_win32_new( struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv* graphics_win32_new( struct navit *nav, struct graphics_methods *meth, struct attr **attrs, + struct callback_list *cbl) { struct attr *attr; struct graphics_priv* this_; @@ -1554,8 +1548,7 @@ graphics_win32_new( struct navit *nav, struct graphics_methods *meth, struct att } -static void -event_win32_main_loop_run(void) { +static void event_win32_main_loop_run(void) { MSG msg; dbg(lvl_debug,"enter"); @@ -1585,14 +1578,12 @@ static void event_win32_main_loop_quit(void) { DestroyWindow(g_hwnd); } -static struct event_watch * -event_win32_add_watch(int h, enum event_watch_cond cond, struct callback *cb) { +static struct event_watch *event_win32_add_watch(int h, enum event_watch_cond cond, struct callback *cb) { dbg(lvl_debug,"enter"); return NULL; } -static void -event_win32_remove_watch(struct event_watch *ev) { +static void event_win32_remove_watch(struct event_watch *ev) { dbg(lvl_debug,"enter"); } @@ -1632,8 +1623,7 @@ static VOID CALLBACK win32_timer_cb(HWND hwnd, UINT uMsg, run_timer(idEvent); } -static struct event_timeout * -event_win32_add_timeout(int timeout, int multi, struct callback *cb) { +static struct event_timeout *event_win32_add_timeout(int timeout, int multi, struct callback *cb) { struct event_timeout *t; t = g_new0(struct event_timeout, 1); if (!t) @@ -1646,8 +1636,7 @@ event_win32_add_timeout(int timeout, int multi, struct callback *cb) { return t; } -static void -event_win32_remove_timeout(struct event_timeout *to) { +static void event_win32_remove_timeout(struct event_timeout *to) { if (to) { GList *l; struct event_timeout *t=NULL; @@ -1669,18 +1658,15 @@ event_win32_remove_timeout(struct event_timeout *to) { } } -static struct event_idle * -event_win32_add_idle(int priority, struct callback *cb) { +static struct event_idle *event_win32_add_idle(int priority, struct callback *cb) { return (struct event_idle *)event_win32_add_timeout(1, 1, cb); } -static void -event_win32_remove_idle(struct event_idle *ev) { +static void event_win32_remove_idle(struct event_idle *ev) { event_win32_remove_timeout((struct event_timeout *)ev); } -static void -event_win32_call_callback(struct callback_list *cb) { +static void event_win32_call_callback(struct callback_list *cb) { PostMessage(g_hwnd, WM_USER+2, (WPARAM)cb, (LPARAM)0); } @@ -1696,14 +1682,12 @@ static struct event_methods event_win32_methods = { event_win32_call_callback, }; -static struct event_priv * -event_win32_new(struct event_methods *meth) { +static struct event_priv *event_win32_new(struct event_methods *meth) { *meth=event_win32_methods; return NULL; } -void -plugin_init(void) { +void plugin_init(void) { plugin_register_category_graphics("win32", graphics_win32_new); plugin_register_category_event("win32", event_win32_new); } |