From 33af42360f4609e30efaf72b241dfaae8998db07 Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 7 Oct 2011 19:39:52 +0000 Subject: fix ico handler to actually decode to bitmap when called via get_internal svn path=/trunk/netsurf/; revision=12980 --- desktop/browser.c | 3 +++ gtk/scaffolding.c | 6 ++++-- image/ico.c | 7 +++++++ 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/desktop/browser.c b/desktop/browser.c index 29359593e..b74a27d89 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -906,6 +906,9 @@ static nserror browser_window_favicon_callback(hlcache_handle *c, bw->current_favicon = c; bw->loading_favicon = NULL; + LOG(("Content ended up with mime type of '%s'", + lwc_string_data((content_get_mime_type(c))))); + /* content_get_bitmap on the hlcache_handle should give * us the favicon bitmap at this point */ diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index b9a4b0909..a602cd54f 100644 --- a/gtk/scaffolding.c +++ b/gtk/scaffolding.c @@ -2006,8 +2006,10 @@ void gui_window_set_icon(struct gui_window *_g, hlcache_handle *icon) if (icon_bitmap != NULL) { GdkPixbuf *pb = gtk_bitmap_get_primary(icon_bitmap); - if (pb != NULL && gdk_pixbuf_get_width(pb) > 0 && - gdk_pixbuf_get_height(pb) > 0) { + + if ((pb != NULL) && + (gdk_pixbuf_get_width(pb) > 0) && + (gdk_pixbuf_get_height(pb) > 0)) { pb = gdk_pixbuf_scale_simple(pb, 16, 16, GDK_INTERP_HYPER); iconImage = GTK_IMAGE(gtk_image_new_from_pixbuf(pb)); } diff --git a/image/ico.c b/image/ico.c index 6a8da57ea..7b76ca447 100644 --- a/image/ico.c +++ b/image/ico.c @@ -215,6 +215,13 @@ static nserror nsico_clone(const struct content *old, struct content **newc) static void *nsico_get_internal(const struct content *c, void *context) { nsico_content *ico = (nsico_content *) c; + struct bmp_image *bmp = ico_find(ico->ico, 255, 255); + + if (!bmp->decoded) + if (bmp_decode(bmp) != BMP_OK) + return NULL; + + ico->bitmap = bmp->bitmap; return ico->bitmap; } -- cgit v1.2.3