From c2b5b48de565a5d7df532e48f9fcb44bd8aaacd9 Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Sat, 13 Aug 2005 15:30:24 +0000 Subject: Reject favicons that are < 12x12. 2005-08-13 Christian Persch * embed/ephy-favicon-cache.c: (ephy_favicon_cache_get): Reject favicons that are < 12x12. --- embed/ephy-favicon-cache.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'embed/ephy-favicon-cache.c') diff --git a/embed/ephy-favicon-cache.c b/embed/ephy-favicon-cache.c index e720bb7a8..f06cfa41a 100644 --- a/embed/ephy-favicon-cache.c +++ b/embed/ephy-favicon-cache.c @@ -583,6 +583,7 @@ ephy_favicon_cache_get (EphyFaviconCache *cache, char *pix_file; GdkPixbuf *pixbuf = NULL; guint checklevel = NEEDS_MASK; + int width, height; if (url == NULL) return NULL; @@ -810,8 +811,18 @@ ephy_favicon_cache_get (EphyFaviconCache *cache, return NULL; } - if (gdk_pixbuf_get_width (pixbuf) > 16 || - gdk_pixbuf_get_height (pixbuf) > 16) + width = gdk_pixbuf_get_width (pixbuf); + height = gdk_pixbuf_get_height (pixbuf); + + /* Reject icons that are too small */ + if (width < 12 || height < 12) + { + entry->load_failed = TRUE; + return NULL; + } + + /* Scale icons that are too big */ + if (width > 16 || height > 16) { GdkPixbuf *scaled = gdk_pixbuf_scale_simple (pixbuf, 16, 16, GDK_INTERP_NEAREST); -- cgit v1.2.3