summaryrefslogtreecommitdiffstats
path: root/src/widgets/icon.cpp
diff options
context:
space:
mode:
authorJon A. Cruz <jon@joncruz.org>2009-03-30 09:36:22 +0000
committerjoncruz <joncruz@users.sourceforge.net>2009-03-30 09:36:22 +0000
commit07774ce1144e0d9b6e78200fefadedad66438662 (patch)
tree2f5450d6ebfb7ddce2c0473a057f659159e818a2 /src/widgets/icon.cpp
parentrestore the pattern from clipboard ability (diff)
downloadinkscape-07774ce1144e0d9b6e78200fefadedad66438662.tar.gz
inkscape-07774ce1144e0d9b6e78200fefadedad66438662.zip
Fix icon cache code to properly render multiple sizes as needed.
(bzr r7591)
Diffstat (limited to 'src/widgets/icon.cpp')
-rw-r--r--src/widgets/icon.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/widgets/icon.cpp b/src/widgets/icon.cpp
index 0bed152f8..220ffc722 100644
--- a/src/widgets/icon.cpp
+++ b/src/widgets/icon.cpp
@@ -908,6 +908,9 @@ static void addToIconSet(GdkPixbuf* pb, gchar const* name, GtkIconSize lsize, un
for ( std::vector<IconCacheItem>::iterator it = iconSetCache[name].begin(); it != iconSetCache[name].end(); ++it ) {
if ( it->_lsize == lsize ) {
+ if (dump) {
+ g_message(" erasing %s:%d %p", name, it->_lsize, it->_pb);
+ }
iconSetCache[name].erase(it);
break;
}
@@ -937,9 +940,23 @@ bool prerender_icon(gchar const *name, GtkIconSize lsize, unsigned psize)
if (pb) {
return false;
} else {
- pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(), name, psize,
- (GtkIconLookupFlags) 0, NULL);
+ GtkIconTheme* theme = gtk_icon_theme_get_default();
+ if ( gtk_icon_theme_has_icon(theme, name) ) {
+ gint *sizeArray = gtk_icon_theme_get_icon_sizes( theme, name );
+ for (gint* cur = sizeArray; *cur; cur++) {
+ if (static_cast<gint>(psize) == *cur) {
+ pb = gtk_icon_theme_load_icon( theme, name, psize,
+ (GtkIconLookupFlags) 0, NULL );
+ break;
+ }
+ }
+ g_free(sizeArray);
+ sizeArray = 0;
+ }
if (!pb) {
+ if (dump) {
+ g_message("prerender_icon [%s] %d", name, psize);
+ }
guchar* px = load_svg_pixels(name, lsize, psize);
if ( !px ) {
// check for a fallback name
@@ -958,6 +975,9 @@ bool prerender_icon(gchar const *name, GtkIconSize lsize, unsigned psize)
g_message("XXXXXXXXXXXXXXXXXXXXXXXXXXXXX error!!! pixels not found for '%s'", name);
}
}
+ else if (dump) {
+ g_message("prerender_icon [%s] %d NOT!!!!!!", name, psize);
+ }
if (pb) {
pb_cache[key] = pb;