summaryrefslogtreecommitdiff
path: root/navit/graphics.c
diff options
context:
space:
mode:
authorsleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2014-11-22 22:34:19 +0000
committersleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220>2014-11-22 22:34:19 +0000
commit0a57b790871b27ea6fd3b1ba97474dddcce7845f (patch)
tree0ad46b248e42f96e93b54874aa3b073ad1273aa1 /navit/graphics.c
parentcffcb036be4aa6097d064c5fb55f3de1a84b23d0 (diff)
downloadnavit-svn-0a57b790871b27ea6fd3b1ba97474dddcce7845f.tar.gz
Refactor:core:Introduce enum for debug levels, and use it everywhere.|First part of #1269.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5960 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/graphics.c')
-rw-r--r--navit/graphics.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/navit/graphics.c b/navit/graphics.c
index fd7006a0..042d666b 100644
--- a/navit/graphics.c
+++ b/navit/graphics.c
@@ -204,7 +204,7 @@ int
graphics_set_attr(struct graphics *gra, struct attr *attr)
{
int ret=1;
- dbg(0,"enter\n");
+ dbg(lvl_error,"enter\n");
if (gra->meth.set_attr)
ret=gra->meth.set_attr(gra->priv, attr);
if (!ret)
@@ -646,7 +646,7 @@ image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path,
this_->width=width;
this_->height=height;
- dbg(2,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, width, height);
+ dbg(lvl_info,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, width, height);
if (zip) {
unsigned char *start;
int len;
@@ -662,7 +662,7 @@ image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path,
this_->priv=gra->meth.image_new(gra->priv, &this_->meth, new_name, &this_->width, &this_->height, &this_->hot, rotate);
}
if (this_->priv) {
- dbg(1,"Using image '%s' for '%s' at %dx%d\n", new_name, path, width, height);
+ dbg(lvl_warning,"Using image '%s' for '%s' at %dx%d\n", new_name, path, width, height);
g_free(new_name);
break;
}
@@ -687,7 +687,7 @@ struct graphics_image * graphics_image_new_scaled_rotated(struct graphics *gra,
if ( g_hash_table_lookup_extended( gra->image_cache_hash, hash_key, NULL, (gpointer)&this_) ) {
g_free(hash_key);
- dbg(3,"Found cached image%sfor '%s'\n",this_?" ":" miss ",path);
+ dbg(lvl_debug,"Found cached image%sfor '%s'\n",this_?" ":" miss ",path);
return this_;
}
@@ -763,7 +763,7 @@ struct graphics_image * graphics_image_new_scaled_rotated(struct graphics *gra,
}
if (! this_->priv) {
- dbg(0,"No image for '%s'\n", path);
+ dbg(lvl_error,"No image for '%s'\n", path);
g_free(this_);
this_=NULL;
}
@@ -1139,7 +1139,7 @@ static void label_line(struct graphics *gra, struct graphics_gc *fg, struct grap
p_t.x=x;
p_t.y=y;
#if 0
- dbg(0,"display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l);
+ dbg(lvl_error,"display_text: '%s', %d, %d, %d, %d %d\n", label, x, y, dx*0x10000/l, dy*0x10000/l, l);
#endif
if (x < gra->r.rl.x && x + tl > gra->r.lu.x && y + tl > gra->r.lu.y && y - tl < gra->r.rl.y)
gra->meth.draw_text(gra->priv, fg->priv, bg?bg->priv:NULL, font->priv, label, &p_t, dx*0x10000/l, dy*0x10000/l);
@@ -1186,11 +1186,11 @@ intersection(struct point * a1, int adx, int ady, struct point * b1, int bdx, in
struct point * res)
{
int n, a, b;
- dbg(1,"%d,%d - %d,%d x %d,%d-%d,%d\n",a1->x,a1->y,a1->x+adx,a1->y+ady,b1->x,b1->y,b1->x+bdx,b1->y+bdy);
+ dbg(lvl_warning,"%d,%d - %d,%d x %d,%d-%d,%d\n",a1->x,a1->y,a1->x+adx,a1->y+ady,b1->x,b1->y,b1->x+bdx,b1->y+bdy);
n = bdy * adx - bdx * ady;
a = bdx * (a1->y - b1->y) - bdy * (a1->x - b1->x);
b = adx * (a1->y - b1->y) - ady * (a1->x - b1->x);
- dbg(1,"a %d b %d n %d\n",a,b,n);
+ dbg(lvl_warning,"a %d b %d n %d\n",a,b,n);
if (n < 0) {
n = -n;
a = -a;
@@ -1206,7 +1206,7 @@ intersection(struct point * a1, int adx, int ady, struct point * b1, int bdx, in
return 0;
res->x = a1->x + a * adx / n;
res->y = a1->y + a * ady / n;
- dbg(1,"%d,%d\n",res->x,res->y);
+ dbg(lvl_warning,"%d,%d\n",res->x,res->y);
return 1;
}
@@ -1285,7 +1285,7 @@ draw_circle(struct point *pnt, int diameter, int scale, int start, int len, stru
struct circle *c;
#if 0
- dbg(0,"diameter=%d start=%d len=%d pos=%d dir=%d\n", diameter, start, len, *pos, dir);
+ dbg(lvl_error,"diameter=%d start=%d len=%d pos=%d dir=%d\n", diameter, start, len, *pos, dir);
#endif
int count=64;
int end=start+len;
@@ -1466,7 +1466,7 @@ draw_shape(struct draw_polyline_context *ctx, struct point *pnt, int wi)
struct draw_polyline_shape *prev=&ctx->prev_shape;
#if 0
- dbg(0,"enter %d,%d - %d,%d %d\n",pnt[0].x,pnt[0].y,pnt[1].x,pnt[1].y,wi);
+ dbg(lvl_error,"enter %d,%d - %d,%d %d\n",pnt[0].x,pnt[0].y,pnt[1].x,pnt[1].y,wi);
#endif
*prev=*shape;
@@ -1495,7 +1495,7 @@ draw_shape(struct draw_polyline_context *ctx, struct point *pnt, int wi)
l = int_sqrt((dxs+dys)*lscales);
#endif
shape->fow=fowler(-shape->dy, shape->dx);
- dbg(1,"fow=%d\n",shape->fow);
+ dbg(lvl_warning,"fow=%d\n",shape->fow);
if (! l)
l=1;
if (wi*lscale > 10000)
@@ -1544,7 +1544,7 @@ draw_middle(struct draw_polyline_context *ctx, struct point *p)
draw_point(&ctx->shape, p, &ctx->res[ctx->ppos++], 1);
return 1;
}
- dbg(1,"delta %d\n",delta);
+ dbg(lvl_warning,"delta %d\n",delta);
if (delta > 0) {
struct point pos,poso;
draw_point(&ctx->shape, p, &pos, 1);
@@ -1604,9 +1604,9 @@ graphics_draw_polyline_as_polygon(struct graphics_priv *gra_priv, struct graphic
if (count < 2)
return;
#if 0
- dbg(0,"count=%d\n",count);
+ dbg(lvl_error,"count=%d\n",count);
for (i = 0 ; i < count ; i++)
- dbg(0,"%d,%d width %d\n",pnt[i].x,pnt[i].y,width[i]);
+ dbg(lvl_error,"%d,%d width %d\n",pnt[i].x,pnt[i].y,width[i]);
#endif
ctx.shape.l=0;
ctx.res=g_alloca(sizeof(struct point)*maxpoints);
@@ -1753,10 +1753,10 @@ graphics_draw_polyline_clipped(struct graphics *gra, struct graphics_gc *gc, str
segment_end.x=pa[i].x;
segment_end.y=pa[i].y;
segment_end.w=width[i];
- dbg(3, "Segment: [%d, %d] - [%d, %d]...\n", segment_start.x, segment_start.y, segment_end.x, segment_end.y);
+ dbg(lvl_debug, "Segment: [%d, %d] - [%d, %d]...\n", segment_start.x, segment_start.y, segment_end.x, segment_end.y);
clip_result=clip_line(&segment_start, &segment_end, &r);
if (clip_result != CLIPRES_INVISIBLE) {
- dbg(3, "....clipped to [%d, %d] - [%d, %d]\n", segment_start.x, segment_start.y, segment_end.x, segment_end.y);
+ dbg(lvl_debug, "....clipped to [%d, %d] - [%d, %d]\n", segment_start.x, segment_start.y, segment_end.x, segment_end.y);
if ((i == 1) || (clip_result & CLIPRES_START_CLIPPED)) {
points_to_draw[points_to_draw_cnt].x=segment_start.x;
points_to_draw[points_to_draw_cnt].y=segment_start.y;
@@ -1939,7 +1939,7 @@ graphics_icon_path(const char *icon)
static char *navit_sharedir;
char *ret=NULL;
struct file_wordexp *wordexp=NULL;
- dbg(1,"enter %s\n",icon);
+ dbg(lvl_warning,"enter %s\n",icon);
if (strchr(icon, '$')) {
wordexp=file_wordexp_new(icon);
if (file_wordexp_get_count(wordexp))
@@ -1952,7 +1952,7 @@ graphics_icon_path(const char *icon)
// get resources for the correct screen density
//
// this part not needed, android unpacks only the correct version into res/drawable dir!
- // dbg(1,"android icon_path %s\n",icon);
+ // dbg(lvl_warning,"android icon_path %s\n",icon);
// static char *android_density;
// android_density = getenv("ANDROID_DENSITY");
// ret=g_strdup_printf("res/drawable-%s/%s",android_density ,icon);
@@ -2061,7 +2061,7 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc
if (font)
gra->meth.draw_text(gra->priv, gc->priv, gc_background?gc_background->priv:NULL, font->priv, di->label, &p, 0x10000, 0);
else
- dbg(0,"Failed to get font with size %d\n",e->text_size);
+ dbg(lvl_error,"Failed to get font with size %d\n",e->text_size);
}
}
break;
@@ -2077,7 +2077,7 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc
if (font)
label_line(gra, gc, gc_background, font, pa, count, di->label);
else
- dbg(0,"Failed to get font with size %d\n",e->text_size);
+ dbg(lvl_error,"Failed to get font with size %d\n",e->text_size);
}
break;
case element_icon:
@@ -2100,7 +2100,7 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc
if (img)
dc->img=img;
else
- dbg(0,"failed to load icon '%s'\n", path);
+ dbg(lvl_error,"failed to load icon '%s'\n", path);
g_free(path);
}
if (img) {
@@ -2116,19 +2116,19 @@ displayitem_draw(struct displayitem *di, void *dummy, struct display_context *dc
}
break;
case element_image:
- dbg(1,"image: '%s'\n", di->label);
+ dbg(lvl_warning,"image: '%s'\n", di->label);
if (gra->meth.draw_image_warp) {
img=graphics_image_new_scaled_rotated(gra, di->label, -1, -1, 0);
if (img)
gra->meth.draw_image_warp(gra->priv, gra->gc[0]->priv, pa, count, img->priv);
} else
- dbg(0,"draw_image_warp not supported by graphics driver drawing '%s'\n", di->label);
+ dbg(lvl_error,"draw_image_warp not supported by graphics driver drawing '%s'\n", di->label);
break;
case element_arrows:
display_draw_arrows(gra,gc,pa,count);
break;
default:
- dbg(0, "Unhandled element type %d\n", e->type);
+ dbg(lvl_error, "Unhandled element type %d\n", e->type);
}
di=di->next;
@@ -2193,7 +2193,7 @@ graphics_draw_itemgra(struct graphics *gra, struct itemgra *itm, struct transfor
struct element *e=es->data;
if (e->coord_count) {
if (e->coord_count > max_coord) {
- dbg(0,"maximum number of coords reached: %d > %d\n",e->coord_count,max_coord);
+ dbg(lvl_error,"maximum number of coords reached: %d > %d\n",e->coord_count,max_coord);
di->count=max_coord;
} else
di->count=e->coord_count;
@@ -2295,7 +2295,7 @@ displaylist_update_hash(struct displaylist *displaylist)
displaylist->max_offset=0;
clear_hash(displaylist);
displaylist_update_layers(displaylist, displaylist->layout->layers, displaylist->order);
- dbg(1,"max offset %d\n",displaylist->max_offset);
+ dbg(lvl_warning,"max offset %d\n",displaylist->max_offset);
}
@@ -2400,12 +2400,12 @@ do_draw(struct displaylist *displaylist, int cancel, int flags)
if (! count)
continue;
#if 0
- dbg(0,"%s 0x%x 0x%x\n",item_to_name(item->type), item->id_hi, item->id_lo);
+ dbg(lvl_error,"%s 0x%x 0x%x\n",item_to_name(item->type), item->id_hi, item->id_lo);
#endif
if (displaylist->dc.pro != pro)
transform_from_to_count(ca, displaylist->dc.pro, ca, pro, count);
if (count == max) {
- dbg(0,"point count overflow %d for %s "ITEM_ID_FMT"\n", count,item_to_name(item->type),ITEM_ID_ARGS(*item));
+ dbg(lvl_error,"point count overflow %d for %s "ITEM_ID_FMT"\n", count,item_to_name(item->type),ITEM_ID_ARGS(*item));
displaylist->dc.maxlen=max*2;
}
if (item_is_custom_poi(*item)) {
@@ -2510,14 +2510,14 @@ static void graphics_load_mapset(struct graphics *gra, struct displaylist *displ
{
int order=transform_get_order(trans);
- dbg(1,"enter");
+ dbg(lvl_warning,"enter");
if (displaylist->busy) {
if (async == 1)
return;
do_draw(displaylist, 1, flags);
}
xdisplay_free(displaylist);
- dbg(1,"order=%d\n", order);
+ dbg(lvl_warning,"order=%d\n", order);
displaylist->dc.gra=gra;
displaylist->ms=mapset;