From 40bad03889d4fc90799fdfe39a3fd503cdfb492e Mon Sep 17 00:00:00 2001 From: "erg@google.com" Date: Wed, 9 Sep 2009 23:07:10 +0000 Subject: Upload GdkPixbufs into cairo surfaces so they (hopefully) live on the X server and have better performance. In the presence of XRender, let cairo do things smarter. This is a big win performance wise. BrowserWindowGtk::OnCustomFrameExpose, a heavy user of images sped up from an average runtime of 20.5ms to 0.7ms. TEST=Run through valgrind, don't leak memory. TEST=Run both before and after using xtrace. Notice fewer XCreatePixmap requests and more XRender-CreatePicture requests. BUG=http://crbug.com/10499 Review URL: http://codereview.chromium.org/197046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25814 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/gtk/bookmark_bar_gtk.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'chrome/browser/gtk/bookmark_bar_gtk.cc') diff --git a/chrome/browser/gtk/bookmark_bar_gtk.cc b/chrome/browser/gtk/bookmark_bar_gtk.cc index 0504349..3caac71 100644 --- a/chrome/browser/gtk/bookmark_bar_gtk.cc +++ b/chrome/browser/gtk/bookmark_bar_gtk.cc @@ -21,6 +21,7 @@ #include "chrome/browser/gtk/bookmark_tree_model.h" #include "chrome/browser/gtk/bookmark_utils_gtk.h" #include "chrome/browser/gtk/browser_window_gtk.h" +#include "chrome/browser/gtk/cairo_cached_surface.h" #include "chrome/browser/gtk/custom_button.h" #include "chrome/browser/gtk/gtk_chrome_button.h" #include "chrome/browser/gtk/gtk_theme_provider.h" @@ -905,10 +906,9 @@ gboolean BookmarkBarGtk::OnEventBoxExpose(GtkWidget* widget, bar->window_->tabstrip()->GetTabStripOriginForWidget(widget); GtkThemeProvider* theme_provider = bar->theme_provider_; - GdkPixbuf* toolbar_background = theme_provider->GetPixbufNamed( - IDR_THEME_TOOLBAR); - gdk_cairo_set_source_pixbuf(cr, toolbar_background, tabstrip_origin.x(), - tabstrip_origin.y()); + CairoCachedSurface* background = theme_provider->GetSurfaceNamed( + IDR_THEME_TOOLBAR, widget); + background->SetSource(cr, tabstrip_origin.x(), tabstrip_origin.y()); // We tile the toolbar background in both directions. cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); cairo_rectangle(cr, -- cgit v1.1