X-Git-Url: https://git.street.me.uk/andy/viking.git/blobdiff_plain/8eb76f51a2a5c7b6f3bbf1b6177bd0e54ce5d5e7..3ceb0792a9dca925baca43dab19d87f7bf27ae9e:/src/garminsymbols.c diff --git a/src/garminsymbols.c b/src/garminsymbols.c index d44e4407..b0b2cdbb 100644 --- a/src/garminsymbols.c +++ b/src/garminsymbols.c @@ -2,6 +2,8 @@ * viking -- GPS Data and Topo Analyzer, Explorer, and Manager * * Copyright (C) 2003-2005, Evan Battaglia + * Copyright (C) 2005, Alex Foobarian + * Copyright (C) 2008, Quy Tonthat * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -330,12 +332,24 @@ static void init_icons() { } static GdkPixbuf *get_wp_sym_from_index ( gint i ) { - if ( !garmin_syms[i].icon && - ((vik_use_small_wp_icons && garmin_syms[i].data) || - (!vik_use_small_wp_icons && garmin_syms[i].data_large))) { - garmin_syms[i].icon = gdk_pixbuf_from_pixdata ( - vik_use_small_wp_icons ? garmin_syms[i].data : garmin_syms[i].data_large, - FALSE, NULL ); + // Ensure data exists to either directly load icon or scale from the other set + if ( !garmin_syms[i].icon && ( garmin_syms[i].data || garmin_syms[i].data_large) ) { + if ( a_vik_get_use_large_waypoint_icons() ) { + if ( garmin_syms[i].data_large ) + // Directly load icon + garmin_syms[i].icon = gdk_pixbuf_from_pixdata ( garmin_syms[i].data_large, FALSE, NULL ); + else + // Up sample from small image + garmin_syms[i].icon = gdk_pixbuf_scale_simple ( gdk_pixbuf_from_pixdata ( garmin_syms[i].data, FALSE, NULL ), 30, 30, GDK_INTERP_BILINEAR ); + } + else { + if ( garmin_syms[i].data ) + // Directly use small symbol + garmin_syms[i].icon = gdk_pixbuf_from_pixdata ( garmin_syms[i].data, FALSE, NULL ); + else + // Down size large image + garmin_syms[i].icon = gdk_pixbuf_scale_simple ( gdk_pixbuf_from_pixdata ( garmin_syms[i].data_large, FALSE, NULL ), 18, 18, GDK_INTERP_BILINEAR ); + } } return garmin_syms[i].icon; } @@ -361,8 +375,8 @@ GdkPixbuf *a_get_wp_sym ( const gchar *sym ) { void a_populate_sym_list ( GtkListStore *list ) { gint i; for (i=0; i