diff options
author | mdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2015-01-23 21:25:26 +0000 |
---|---|---|
committer | mdankov <mdankov@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2015-01-23 21:25:26 +0000 |
commit | 27fc7a312945d9b145f0ce164ca92ee78154226d (patch) | |
tree | f07ee2e15fb4d6412e06e649a5668b09cd85a58f /navit | |
parent | 6088c52e28fe5994dc339a575c77517452a0bda7 (diff) | |
download | navit-27fc7a312945d9b145f0ce164ca92ee78154226d.tar.gz |
Fix:core:Better algorithm to select prescaled image to rescale. Try at first to load all bigger ones, then go down in standard sizes row.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@6004 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit')
-rw-r--r-- | navit/graphics.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/navit/graphics.c b/navit/graphics.c index 2858de828..d89d532d7 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -651,10 +651,10 @@ image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path, break; case 5: mode++; + i=0; /* If we have no size specifiers, try the default png now */ if(sz<=0) { new_name=g_strdup_printf("%s.png", name); - i=0; break; } /* Find best matching size from standard row */ @@ -664,12 +664,15 @@ image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path, i=1; /* Fall through */ case 6: - /* Select closest matching image from standard row */ + /* Select best matching image from standard row */ if(sz>0) { /* If size were specified, start with bmstd and then try standard sizes in row - * bmstd-1, bmstd+1, bmstd-2, bmstd+2 etc */ - n=bmstd+(i/2)*((i%2)*2-1); - if(++i==numstdsizes*2) + * bmstd, bmstd+1, bmstd+2, .. numstdsizes-1, bmstd-1, bmstd-2, .., 0 */ + n=bmstd+i; + if((bmstd+i)>=numstdsizes) + n=numstdsizes-i-1; + + if(++i==numstdsizes) mode++; } else { /* If no size were specified, start with the smallest standard size and then try following ones */ @@ -698,7 +701,7 @@ image_new_helper(struct graphics *gra, struct graphics_image *this_, char *path, this_->width=width; this_->height=height; - dbg(lvl_info,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, width, height); + dbg(lvl_debug,"Trying to load image '%s' for '%s' at %dx%d\n", new_name, path, width, height); if (zip) { unsigned char *start; int len; @@ -714,7 +717,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(lvl_debug,"Using image '%s' for '%s' at %dx%d\n", new_name, path, width, height); + dbg(lvl_info,"Using image '%s' for '%s' at %dx%d\n", new_name, path, width, height); g_free(new_name); break; } |