Commit 751a6227 authored by erg@chromium.org's avatar erg@chromium.org

GTK: Remove deprecated GtkThemeSurface::GetSurfaceNamed() calls in browser...

GTK: Remove deprecated GtkThemeSurface::GetSurfaceNamed() calls in browser toolbar. Change to ResourceBundle when appropriate for sharing gfx::Images across profiles

BUG=106060
TEST=none

Review URL: http://codereview.chromium.org/8806026

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113346 0039d316-1c4b-4281-b951-d872f2087c98
parent a040ae4f
...@@ -52,6 +52,7 @@ ...@@ -52,6 +52,7 @@
#include "ui/base/accelerators/accelerator_gtk.h" #include "ui/base/accelerators/accelerator_gtk.h"
#include "ui/base/dragdrop/gtk_dnd_util.h" #include "ui/base/dragdrop/gtk_dnd_util.h"
#include "ui/base/l10n/l10n_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/canvas_skia_paint.h"
#include "ui/gfx/gtk_util.h" #include "ui/gfx/gtk_util.h"
#include "ui/gfx/image/cairo_cached_surface.h" #include "ui/gfx/image/cairo_cached_surface.h"
...@@ -504,9 +505,10 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget, ...@@ -504,9 +505,10 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
area = area.Subtract(right).Subtract(left); area = area.Subtract(right).Subtract(left);
} }
gfx::CairoCachedSurface* background = theme_service_->GetSurfaceNamed( const gfx::Image* background =
IDR_THEME_TOOLBAR, widget); theme_service_->GetImageNamed(IDR_THEME_TOOLBAR);
background->SetSource(cr, widget, tabstrip_origin.x(), tabstrip_origin.y()); background->ToCairo()->SetSource(
cr, widget, tabstrip_origin.x(), tabstrip_origin.y());
cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT); cairo_pattern_set_extend(cairo_get_source(cr), CAIRO_EXTEND_REPEAT);
cairo_rectangle(cr, area.x(), area.y(), area.width(), area.height()); cairo_rectangle(cr, area.x(), area.y(), area.width(), area.height());
cairo_fill(cr); cairo_fill(cr);
...@@ -529,17 +531,17 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget, ...@@ -529,17 +531,17 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
allocation.y + allocation.height); allocation.y + allocation.height);
cairo_t* copy_cr = cairo_create(target); cairo_t* copy_cr = cairo_create(target);
ResourceBundle& rb = ResourceBundle::GetSharedInstance();
cairo_set_operator(copy_cr, CAIRO_OPERATOR_SOURCE); cairo_set_operator(copy_cr, CAIRO_OPERATOR_SOURCE);
if (draw_left_corner) { if (draw_left_corner) {
gfx::CairoCachedSurface* left_corner = theme_service_->GetSurfaceNamed( rb.GetNativeImageNamed(IDR_CONTENT_TOP_LEFT_CORNER_MASK).ToCairo()->
IDR_CONTENT_TOP_LEFT_CORNER_MASK, widget); SetSource(copy_cr, widget, left.x(), left.y());
left_corner->SetSource(copy_cr, widget, left.x(), left.y());
cairo_paint(copy_cr); cairo_paint(copy_cr);
} }
if (draw_right_corner) { if (draw_right_corner) {
gfx::CairoCachedSurface* right_corner = theme_service_->GetSurfaceNamed( rb.GetNativeImageNamed(IDR_CONTENT_TOP_RIGHT_CORNER_MASK).ToCairo()->
IDR_CONTENT_TOP_RIGHT_CORNER_MASK, widget); SetSource(copy_cr, widget, right.x(), right.y());
right_corner->SetSource(copy_cr, widget, right.x(), right.y());
// We fill a path rather than just painting because we don't want to // We fill a path rather than just painting because we don't want to
// overwrite the left corner. // overwrite the left corner.
cairo_rectangle(copy_cr, right.x(), right.y(), cairo_rectangle(copy_cr, right.x(), right.y(),
...@@ -549,7 +551,7 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget, ...@@ -549,7 +551,7 @@ gboolean BrowserToolbarGtk::OnAlignmentExpose(GtkWidget* widget,
// Draw the background. CAIRO_OPERATOR_IN uses the existing pixel data as // Draw the background. CAIRO_OPERATOR_IN uses the existing pixel data as
// an alpha mask. // an alpha mask.
background->SetSource(copy_cr, widget, background->ToCairo()->SetSource(copy_cr, widget,
tabstrip_origin.x(), tabstrip_origin.y()); tabstrip_origin.x(), tabstrip_origin.y());
cairo_set_operator(copy_cr, CAIRO_OPERATOR_IN); cairo_set_operator(copy_cr, CAIRO_OPERATOR_IN);
cairo_pattern_set_extend(cairo_get_source(copy_cr), CAIRO_EXTEND_REPEAT); cairo_pattern_set_extend(cairo_get_source(copy_cr), CAIRO_EXTEND_REPEAT);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment