summaryrefslogtreecommitdiff
path: root/navit/graphics/sdl/graphics_sdl.c
diff options
context:
space:
mode:
Diffstat (limited to 'navit/graphics/sdl/graphics_sdl.c')
-rw-r--r--navit/graphics/sdl/graphics_sdl.c108
1 files changed, 54 insertions, 54 deletions
diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c
index b1a9c17b9..a87805b73 100644
--- a/navit/graphics/sdl/graphics_sdl.c
+++ b/navit/graphics/sdl/graphics_sdl.c
@@ -185,7 +185,7 @@ struct graphics_image_priv {
static void
graphics_destroy(struct graphics_priv *gr)
{
- dbg(lvl_debug, "graphics_destroy %p %u\n", gr, gr->overlay_mode);
+ dbg(lvl_debug, "graphics_destroy %p %u", gr, gr->overlay_mode);
if(gr->overlay_mode)
{
@@ -220,7 +220,7 @@ gc_destroy(struct graphics_gc_priv *gc)
static void
gc_set_linewidth(struct graphics_gc_priv *gc, int w)
{
- dbg(lvl_debug, "gc_set_linewidth %p %d\n", gc, w);
+ dbg(lvl_debug, "gc_set_linewidth %p %d", gc, w);
gc->linewidth = w;
}
@@ -233,7 +233,7 @@ 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)
{
- dbg(lvl_debug, "gc_set_foreground: %p %d %d %d %d\n", gc, c->a, c->r, c->g, c->b);
+ 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;
gc->fore_b = c->b/256;
@@ -243,7 +243,7 @@ gc_set_foreground(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\n", gc, c->a, c->r, c->g, c->b);
+ 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;
gc->back_b = c->b/256;
@@ -292,7 +292,7 @@ image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *n
else
{
/* TODO: debug "colour parse errors" on xpm */
- dbg(lvl_error,"image_new on '%s' failed: %s\n", name, IMG_GetError());
+ dbg(lvl_error,"image_new on '%s' failed: %s", name, IMG_GetError());
g_free(gi);
gi = NULL;
}
@@ -329,7 +329,7 @@ draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point
vx[i] = x;
vy[i] = y;
- dbg(lvl_debug, "draw_polygon: %p %i %d,%d\n", gc, i, p[i].x, p[i].y);
+ dbg(lvl_debug, "draw_polygon: %p %i %d,%d", gc, i, p[i].x, p[i].y);
}
if(gr->aa)
@@ -360,7 +360,7 @@ draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct poi
return;
}
- dbg(lvl_debug, "draw_rectangle: %d %d %d %d r=%d g=%d b=%d a=%d\n", p->x, p->y, w, h,
+ dbg(lvl_debug, "draw_rectangle: %d %d %d %d r=%d g=%d b=%d a=%d", p->x, p->y, w, h,
gc->fore_r, gc->fore_g, gc->fore_b, gc->fore_a);
if(w > gr->screen->w)
{
@@ -493,10 +493,10 @@ draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *
y_lw_adj = round(cos(angle)*(float)lw/2.0);
if((x_lw_adj < 0) || (y_lw_adj < 0))
{
- dbg(lvl_debug, "i=%d\n", i);
- dbg(lvl_debug, " %d,%d->%d,%d\n", p[i].x, p[i].y, p[i+1].x, p[i+1].y);
- dbg(lvl_debug, " lw=%d angle=%f\n", lw, 180.0 * angle / M_PI);
- dbg(lvl_debug, " x_lw_adj=%d y_lw_adj=%d\n", x_lw_adj, y_lw_adj);
+ dbg(lvl_debug, "i=%d", i);
+ dbg(lvl_debug, " %d,%d->%d,%d", p[i].x, p[i].y, p[i+1].x, p[i+1].y);
+ dbg(lvl_debug, " lw=%d angle=%f", lw, 180.0 * angle / M_PI);
+ dbg(lvl_debug, " x_lw_adj=%d y_lw_adj=%d", x_lw_adj, y_lw_adj);
}
}
@@ -586,7 +586,7 @@ resize_ft_buffer (unsigned int new_size)
if (new_size > ft_buffer_size) {
g_free (ft_buffer);
ft_buffer = g_malloc (new_size);
- dbg(lvl_debug, "old_size(%u) new_size(%u) ft_buffer(%p)\n", ft_buffer_size, new_size, ft_buffer);
+ dbg(lvl_debug, "old_size(%u) new_size(%u) ft_buffer(%p)", ft_buffer_size, new_size, ft_buffer);
ft_buffer_size = new_size;
}
}
@@ -744,7 +744,7 @@ draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg,
int color = 1;
if (!font) {
- dbg(lvl_error, "no font, returning\n");
+ dbg(lvl_error, "no font, returning");
return;
}
t = gr->freetype_methods.text_new(text,
@@ -780,7 +780,7 @@ draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *
static void
background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
{
- dbg(lvl_debug, "background_gc\n");
+ dbg(lvl_debug, "background_gc");
}
@@ -797,7 +797,7 @@ draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
}
else
{
- dbg(lvl_debug, "draw_mode: %d\n", mode);
+ dbg(lvl_debug, "draw_mode: %d", mode);
if(mode == draw_mode_end)
{
@@ -927,11 +927,11 @@ overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct poin
}
if(i == OVERLAY_MAX)
{
- dbg(lvl_error, "too many overlays! increase OVERLAY_MAX\n");
+ dbg(lvl_error, "too many overlays! increase OVERLAY_MAX");
return NULL;
}
- dbg(lvl_debug, "overlay_new %d %d %d %u %u (%x, %x, %x ,%x, %d)\n", i,
+ dbg(lvl_debug, "overlay_new %d %d %d %u %u (%x, %x, %x ,%x, %d)", i,
p->x,
p->y,
w,
@@ -1025,7 +1025,7 @@ static gboolean graphics_sdl_idle(void *data)
gr = the_graphics;
}
else {
- dbg(lvl_error,"graphics_idle: graphics not set!\n");
+ dbg(lvl_error,"graphics_idle: graphics not set!");
return FALSE;
}
}
@@ -1070,7 +1070,7 @@ static gboolean graphics_sdl_idle(void *data)
if (idle_tasks_idx >= idle_tasks->len)
idle_tasks_idx = 0;
- dbg(lvl_debug,"idle_tasks_idx(%d)\n",idle_tasks_idx);
+ dbg(lvl_debug,"idle_tasks_idx(%d)",idle_tasks_idx);
task = (struct idle_task *)g_ptr_array_index(idle_tasks,idle_tasks_idx);
if (idle_tasks_idx == 0) // only execute tasks with lowest priority value
@@ -1095,7 +1095,7 @@ static gboolean graphics_sdl_idle(void *data)
}
#ifdef USE_WEBOS
- dbg(lvl_debug,"SDL_Event %d\n", ev.type);
+ dbg(lvl_debug,"SDL_Event %d", ev.type);
#endif
switch(ev.type)
{
@@ -1220,7 +1220,7 @@ static gboolean graphics_sdl_idle(void *data)
key_mod &= ~(WEBOS_KEY_MOD_ORANGE_STICKY);
}
else {
- dbg(lvl_error,"Unknown key sym: %x\n", ev.key.keysym.sym);
+ dbg(lvl_error,"Unknown key sym: %x", ev.key.keysym.sym);
}
#else
/* return unicode chars when they can be converted to ascii */
@@ -1230,7 +1230,7 @@ static gboolean graphics_sdl_idle(void *data)
}
}
- dbg(lvl_info,"key mod: 0x%x\n", key_mod);
+ dbg(lvl_info,"key mod: 0x%x", key_mod);
if (keybuf[0]) {
callback_list_call_attr_1(gr->cbl, attr_keypress, (void *)keybuf);
@@ -1245,7 +1245,7 @@ static gboolean graphics_sdl_idle(void *data)
case SDL_MOUSEBUTTONDOWN:
{
- dbg(lvl_debug, "SDL_MOUSEBUTTONDOWN %d %d %d %d %d\n",
+ dbg(lvl_debug, "SDL_MOUSEBUTTONDOWN %d %d %d %d %d",
ev.button.which,
ev.button.button,
ev.button.state,
@@ -1260,7 +1260,7 @@ static gboolean graphics_sdl_idle(void *data)
case SDL_MOUSEBUTTONUP:
{
- dbg(lvl_debug, "SDL_MOUSEBUTTONUP %d %d %d %d %d\n",
+ dbg(lvl_debug, "SDL_MOUSEBUTTONUP %d %d %d %d %d",
ev.button.which,
ev.button.button,
ev.button.state,
@@ -1302,7 +1302,7 @@ static gboolean graphics_sdl_idle(void *data)
case SDL_USEREVENT:
{
SDL_UserEvent userevent = ev.user;
- dbg(lvl_info,"received SDL_USEREVENT type(%x) code(%x)\n",userevent.type,userevent.code);
+ dbg(lvl_info,"received SDL_USEREVENT type(%x) code(%x)",userevent.type,userevent.code);
if (userevent.type != SDL_USEREVENT)
break;
@@ -1322,28 +1322,28 @@ static gboolean graphics_sdl_idle(void *data)
else if(userevent.code == SDL_USEREVENT_CODE_TIMER)
{
struct callback *cb = (struct callback *)userevent.data1;
- dbg(lvl_debug, "SDL_USEREVENT timer received cb(%p)\n", cb);
+ dbg(lvl_debug, "SDL_USEREVENT timer received cb(%p)", cb);
callback_call_0(cb);
}
else if(userevent.code == SDL_USEREVENT_CODE_WATCH)
{
struct callback *cb = (struct callback *)userevent.data1;
- dbg(lvl_debug, "SDL_USEREVENT watch received cb(%p)\n", cb);
+ dbg(lvl_debug, "SDL_USEREVENT watch received cb(%p)", cb);
callback_call_0(cb);
}
else if(userevent.code == SDL_USEREVENT_CODE_CALL_CALLBACK)
{
struct callback_list *cbl = (struct callback_list *)userevent.data1;
- dbg(lvl_debug, "SDL_USEREVENT call_callback received cbl(%p)\n", cbl);
+ dbg(lvl_debug, "SDL_USEREVENT call_callback received cbl(%p)", cbl);
callback_list_call_0(cbl);
}
else if(userevent.code == SDL_USEREVENT_CODE_IDLE_EVENT) {
- dbg(lvl_debug, "SDL_USEREVENT idle_event received\n");
+ dbg(lvl_debug, "SDL_USEREVENT idle_event received");
}
#ifdef USE_WEBOS_ACCELEROMETER
else if(userevent.code == SDL_USEREVENT_CODE_ROTATE)
{
- dbg(lvl_debug, "SDL_USEREVENT rotate received\n");
+ dbg(lvl_debug, "SDL_USEREVENT rotate received");
switch(gr->orientation)
{
case WEBOS_ORIENTATION_PORTRAIT:
@@ -1366,14 +1366,14 @@ static gboolean graphics_sdl_idle(void *data)
}
#endif
else
- dbg(lvl_warning, "unknown SDL_USEREVENT\n");
+ dbg(lvl_warning, "unknown SDL_USEREVENT");
break;
}
#endif
default:
{
- dbg(lvl_debug, "SDL_Event %d\n", ev.type);
+ dbg(lvl_debug, "SDL_Event %d", ev.type);
break;
}
}
@@ -1423,7 +1423,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
int)) this->freetype_methods.font_new;
meth->get_text_bbox = (void*) this->freetype_methods.get_text_bbox;
- dbg(lvl_debug,"Calling SDL_Init\n");
+ dbg(lvl_debug,"Calling SDL_Init");
#ifdef USE_WEBOS
# ifdef USE_WEBOS_ACCELEROMETER
ret = SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER|SDL_INIT_JOYSTICK);
@@ -1435,18 +1435,18 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
#endif
if(ret < 0)
{
- dbg(lvl_error,"SDL_Init failed %d\n", ret);
+ dbg(lvl_error,"SDL_Init failed %d", ret);
this->freetype_methods.destroy();
g_free(this);
return NULL;
}
#ifdef USE_WEBOS
- dbg(lvl_debug,"Calling PDL_Init(0)\n");
+ dbg(lvl_debug,"Calling PDL_Init(0)");
ret = PDL_Init(0);
if(ret < 0)
{
- dbg(lvl_error,"PDL_Init failed %d\n", ret);
+ dbg(lvl_error,"PDL_Init failed %d", ret);
this->freetype_methods.destroy();
g_free(this);
return NULL;
@@ -1489,7 +1489,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
if(this->screen == NULL)
{
- dbg(lvl_error,"SDL_SetVideoMode failed\n");
+ dbg(lvl_error,"SDL_SetVideoMode failed");
this->freetype_methods.destroy();
g_free(this);
#ifdef USE_WEBOS
@@ -1503,7 +1503,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
w = this->screen->w;
h = this->screen->h;
- dbg(lvl_debug, "using screen %ix%i@%i\n",
+ dbg(lvl_debug, "using screen %ix%i@%i",
this->screen->w, this->screen->h,
this->screen->format->BytesPerPixel * 8);
#ifdef USE_WEBOS_ACCELEROMETER
@@ -1530,7 +1530,7 @@ graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr *
#ifdef USE_WEBOS
if(the_graphics!=NULL) {
- dbg(lvl_debug,"graphics_sdl_new: graphics struct already set: %d!\n", the_graphics_count);
+ dbg(lvl_debug,"graphics_sdl_new: graphics struct already set: %d!", the_graphics_count);
}
the_graphics = this;
the_graphics_count++;
@@ -1556,7 +1556,7 @@ 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\n", param, timeout->multi, interval);
+ dbg(lvl_debug,"timer(%p) multi(%d) interval(%d) fired", param, timeout->multi, interval);
SDL_Event event;
SDL_UserEvent userevent;
@@ -1613,7 +1613,7 @@ event_sdl_watch_thread (GPtrArray *watch_list)
for (idx = 0; idx < watch_list->len; idx++ ) {
if (pfds[idx].revents == pfds[idx].events) { /* The requested event happened, notify mainloop! */
ew = g_ptr_array_index (watch_list, idx);
- dbg(lvl_debug,"watch(%p) event(%d) encountered\n", ew, pfds[idx].revents);
+ dbg(lvl_debug,"watch(%p) event(%d) encountered", ew, pfds[idx].revents);
SDL_Event event;
SDL_UserEvent userevent;
@@ -1639,7 +1639,7 @@ event_sdl_watch_thread (GPtrArray *watch_list)
static void
event_sdl_watch_startthread(GPtrArray *watch_list)
{
- dbg(lvl_debug,"enter\n");
+ dbg(lvl_debug,"enter");
if (sdl_watch_thread)
event_sdl_watch_stopthread();
@@ -1652,7 +1652,7 @@ event_sdl_watch_startthread(GPtrArray *watch_list)
static void
event_sdl_watch_stopthread()
{
- dbg(lvl_debug,"enter\n");
+ dbg(lvl_debug,"enter");
if (sdl_watch_thread) {
/* Notify the watch thread that the list of FDs will change */
pthread_kill(sdl_watch_thread, SIGUSR1);
@@ -1664,7 +1664,7 @@ event_sdl_watch_stopthread()
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)\n", fd, cond, cb);
+ dbg(lvl_debug,"fd(%d) cond(%x) cb(%x)", fd, cond, cb);
event_sdl_watch_stopthread();
@@ -1702,7 +1702,7 @@ event_sdl_add_watch(int fd, enum event_watch_cond cond, struct callback *cb)
static void
event_sdl_remove_watch(struct event_watch *ew)
{
- dbg(lvl_debug,"enter %p\n",ew);
+ dbg(lvl_debug,"enter %p",ew);
event_sdl_watch_stopthread();
@@ -1721,10 +1721,10 @@ 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\n");
+ dbg(lvl_error,"g_new0 failed");
return ret;
}
- dbg(lvl_debug,"timer(%p) multi(%d) interval(%d) cb(%p) added\n",ret, multi, timeout, cb);
+ dbg(lvl_debug,"timer(%p) multi(%d) interval(%d) cb(%p) added",ret, multi, timeout, cb);
ret->multi = multi;
ret->cb = cb;
ret->id = SDL_AddTimer(timeout, sdl_timer_callback, ret);
@@ -1735,17 +1735,17 @@ event_sdl_add_timeout(int timeout, int multi, struct callback *cb)
static void
event_sdl_remove_timeout(struct event_timeout *to)
{
- dbg(lvl_info,"enter %p\n", to);
+ dbg(lvl_info,"enter %p", to);
if(to)
{
/* do not SDL_RemoveTimer if oneshot timer has already fired */
int ret = to->id == 0 ? SDL_TRUE : SDL_RemoveTimer(to->id);
if (ret == SDL_FALSE)
- dbg(lvl_error,"SDL_RemoveTimer (%p) failed\n", to->id);
+ dbg(lvl_error,"SDL_RemoveTimer (%p) failed", to->id);
g_free(to);
- dbg(lvl_debug,"timer(%p) removed\n", to);
+ dbg(lvl_debug,"timer(%p) removed", to);
}
}
@@ -1767,7 +1767,7 @@ sdl_sort_idle_tasks(gconstpointer parama, gconstpointer paramb)
static struct event_idle *
event_sdl_add_idle(int priority, struct callback *cb)
{
- dbg(lvl_debug,"add idle priority(%d) cb(%p)\n", priority, cb);
+ dbg(lvl_debug,"add idle priority(%d) cb(%p)", priority, cb);
struct idle_task *task = g_new0(struct idle_task, 1);
task->priority = priority;
@@ -1780,7 +1780,7 @@ event_sdl_add_idle(int priority, struct callback *cb)
SDL_Event event;
SDL_UserEvent userevent;
- dbg(lvl_debug,"poking eventloop because of new idle_events\n");
+ dbg(lvl_debug,"poking eventloop because of new idle_events");
userevent.type = SDL_USEREVENT;
userevent.code = SDL_USEREVENT_CODE_IDLE_EVENT;
@@ -1801,7 +1801,7 @@ event_sdl_add_idle(int priority, struct callback *cb)
static void
event_sdl_remove_idle(struct event_idle *task)
{
- dbg(lvl_debug,"remove task(%p)\n", task);
+ dbg(lvl_debug,"remove task(%p)", task);
g_ptr_array_remove(idle_tasks, (gpointer)task);
}
@@ -1810,7 +1810,7 @@ event_sdl_remove_idle(struct event_idle *task)
static void
event_sdl_call_callback(struct callback_list *cbl)
{
- dbg(lvl_debug,"call_callback cbl(%p)\n",cbl);
+ dbg(lvl_debug,"call_callback cbl(%p)",cbl);
SDL_Event event;
SDL_UserEvent userevent;