Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4139)

Unified Diff: chrome/browser/ui/gtk/browser_toolbar_gtk.cc

Issue 8806026: GTK: Remove UseSurface() calls in browser toolbar. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/browser_toolbar_gtk.cc
diff --git a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
index aea48e453dcaf1f43969179cbeecd3ef1513a7a8..6861af8be088a9c6e1d07f2cfe58b728a8c63451 100644
--- a/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
+++ b/chrome/browser/ui/gtk/browser_toolbar_gtk.cc
@@ -52,6 +52,7 @@
#include "ui/base/accelerators/accelerator_gtk.h"
#include "ui/base/dragdrop/gtk_dnd_util.h"
#include "ui/base/l10n/l10n_util.h"
+#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas_skia_paint.h"
#include "ui/gfx/gtk_util.h"
#include "ui/gfx/image/cairo_cached_surface.h"
@@ -504,9 +505,10 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
area = area.Subtract(right).Subtract(left);
}
- gfx::CairoCachedSurface* background = theme_service_->GetSurfaceNamed(
- IDR_THEME_TOOLBAR, widget);
- background->SetSource(cr, widget, tabstrip_origin.x(), tabstrip_origin.y());
+ const gfx::Image* background =
+ theme_service_->GetImageNamed(IDR_THEME_TOOLBAR);
+ background->ToCairo()->SetSource(
+ cr, widget, tabstrip_origin.x(), tabstrip_origin.y());
cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
cairo_rectangle(cr, area.x(), area.y(), area.width(), area.height());
cairo_fill(cr);
@@ -529,17 +531,17 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
allocation.y + allocation.height);
cairo_t* copy_cr = cairo_create(target);
+ ResourceBundle& rb = ResourceBundle::GetSharedInstance();
+
cairo_set_operator(copy_cr, CAIRO_OPERATOR_SOURCE);
if (draw_left_corner) {
- gfx::CairoCachedSurface* left_corner = theme_service_->GetSurfaceNamed(
- IDR_CONTENT_TOP_LEFT_CORNER_MASK, widget);
- left_corner->SetSource(copy_cr, widget, left.x(), left.y());
+ rb.GetNativeImageNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK).ToCairo()->
+ SetSource(copy_cr, widget, left.x(), left.y());
cairo_paint(copy_cr);
}
if (draw_right_corner) {
- gfx::CairoCachedSurface* right_corner = theme_service_->GetSurfaceNamed(
- IDR_CONTENT_TOP_RIGHT_CORNER_MASK, widget);
- right_corner->SetSource(copy_cr, widget, right.x(), right.y());
+ rb.GetNativeImageNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK).ToCairo()->
+ SetSource(copy_cr, widget, right.x(), right.y());
// We fill a path rather than just painting because we don't want to
// overwrite the left corner.
cairo_rectangle(copy_cr, right.x(), right.y(),
@@ -549,8 +551,8 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
// Draw the background. CAIRO_OPERATOR_IN uses the existing pixel data as
// an alpha mask.
- background->SetSource(copy_cr, widget,
- tabstrip_origin.x(), tabstrip_origin.y());
+ background->ToCairo()->SetSource(copy_cr, widget,
+ tabstrip_origin.x(), tabstrip_origin.y());
cairo_set_operator(copy_cr, CAIRO_OPERATOR_IN);
cairo_pattern_set_extend(cairo_get_source(copy_cr), CAIRO_EXTEND_REPEAT);
cairo_paint(copy_cr);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698