rnorris/viking — comment on commit 1e68df9f0dd765e6668f5038447115c8a8279da3
File:  line 0
By rnorris:

I didn't think of improving the method at the time - just extending what was there.

In fact the resizing is very simple and I can junk these two commits generating large and small pngs.

If only I did this way at the time - this change was a lot quicker to generate!

The key function becomes this:

static GdkPixbuf *get_wp_sym_from_index ( gint i ) {
// 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 use large symbol
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;
}

And then with a small adjustment in the a_get_hashed_sym function:

- if ((!a_vik_get_use_large_waypoint_icons() && garmin_syms[i].data) ||
- (a_vik_get_use_large_waypoint_icons() && garmin_syms[i].data_large)) {
+ // Ensure at least one symbol available - the other can be auto generated
+ if ( garmin_syms[i].data || garmin_syms[i].data_large ) {

Then it's good to go. I'll put this into a proper patch sometime and probably shift it into the StagingPatches.