fix ico handler to actually decode to bitmap when called via get_internal

svn path=/trunk/netsurf/; revision=12980
This commit is contained in:
Vincent Sanders 2011-10-07 19:39:52 +00:00
parent c22373e000
commit 33af42360f
3 changed files with 14 additions and 2 deletions

View File

@ -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
*/

View File

@ -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));
}

View File

@ -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;
}