summaryrefslogtreecommitdiffstats
path: root/chrome/browser/gtk/custom_button.cc
diff options
context:
space:
mode:
authortc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-16 16:52:36 +0000
committertc@google.com <tc@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-16 16:52:36 +0000
commitde2baedbb8df526db72fb6ddc151e9435db8b78f (patch)
treeb31900fe03fd0421907ae79f1216f5b55042363f /chrome/browser/gtk/custom_button.cc
parent6deb272a76b6214157cb9dec271e4c4e1a6d3e8f (diff)
downloadchromium_src-de2baedbb8df526db72fb6ddc151e9435db8b78f.zip
chromium_src-de2baedbb8df526db72fb6ddc151e9435db8b78f.tar.gz
chromium_src-de2baedbb8df526db72fb6ddc151e9435db8b78f.tar.bz2
Have ResourceBundle own GdkPixbufs.
This is the same as how ResourceBundle owns the SkBitmaps it loads. This should be faster than before because ResourceBundle will only load each bitmap once and cache the image. Also fix a memory leak in GdkPixbufFromSkBitmap. valgrind says we're not leaking here. BUG=9988 Review URL: http://codereview.chromium.org/67179 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/custom_button.cc')
-rw-r--r--chrome/browser/gtk/custom_button.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc
index 3110dea..e7389cb 100644
--- a/chrome/browser/gtk/custom_button.cc
+++ b/chrome/browser/gtk/custom_button.cc
@@ -17,20 +17,16 @@ CustomDrawButtonBase::CustomDrawButtonBase(
int depressed_id) {
// Load the button images from the resource bundle.
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
- pixbufs_[GTK_STATE_NORMAL] = normal_id ? rb.LoadPixbuf(normal_id) : NULL;
- pixbufs_[GTK_STATE_ACTIVE] = active_id ? rb.LoadPixbuf(active_id) : NULL;
+ pixbufs_[GTK_STATE_NORMAL] = normal_id ? rb.GetPixbufNamed(normal_id) : NULL;
+ pixbufs_[GTK_STATE_ACTIVE] = active_id ? rb.GetPixbufNamed(active_id) : NULL;
pixbufs_[GTK_STATE_PRELIGHT] =
- highlight_id ? rb.LoadPixbuf(highlight_id) : NULL;
+ highlight_id ? rb.GetPixbufNamed(highlight_id) : NULL;
pixbufs_[GTK_STATE_SELECTED] = NULL;
pixbufs_[GTK_STATE_INSENSITIVE] =
- depressed_id ? rb.LoadPixbuf(depressed_id) : NULL;
+ depressed_id ? rb.GetPixbufNamed(depressed_id) : NULL;
}
CustomDrawButtonBase::~CustomDrawButtonBase() {
- for (size_t i = 0; i < arraysize(pixbufs_); ++i) {
- if (pixbufs_[i])
- g_object_unref(pixbufs_[i]);
- }
}
gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget, GdkEventExpose* e) {