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

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

Issue 8769017: GTK: Move CairoCachedSurface from being owned by GtkThemeService to gfx::Image. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase for commit 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 | « chrome/browser/ui/gtk/custom_button.h ('k') | chrome/browser/ui/gtk/find_bar_gtk.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/gtk/custom_button.cc
diff --git a/chrome/browser/ui/gtk/custom_button.cc b/chrome/browser/ui/gtk/custom_button.cc
index c0f8111585af318f704c9b9d395bf4c2c4e943d5..2b25796f22f6dae528f6884f11bdb3eb0f84b5b1 100644
--- a/chrome/browser/ui/gtk/custom_button.cc
+++ b/chrome/browser/ui/gtk/custom_button.cc
@@ -6,7 +6,6 @@
#include "base/basictypes.h"
#include "base/logging.h"
-#include "chrome/browser/ui/gtk/cairo_cached_surface.h"
#include "chrome/browser/ui/gtk/gtk_chrome_button.h"
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
@@ -16,6 +15,7 @@
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/gtk_util.h"
+#include "ui/gfx/image/cairo_cached_surface.h"
#include "ui/gfx/skbitmap_operations.h"
CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeService* theme_provider,
@@ -32,8 +32,8 @@ CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeService* theme_provider,
theme_service_(theme_provider),
flipped_(false) {
for (int i = 0; i < (GTK_STATE_INSENSITIVE + 1); ++i)
- surfaces_[i].reset(new CairoCachedSurface);
- background_image_.reset(new CairoCachedSurface);
+ surfaces_[i].reset(new gfx::CairoCachedSurface);
+ background_image_.reset(new gfx::CairoCachedSurface);
if (theme_provider) {
// Load images by pretending that we got a BROWSER_THEME_CHANGED
@@ -81,8 +81,8 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget,
paint_state = GTK_STATE_NORMAL;
bool animating_hover = hover_state > 0.0 &&
paint_state == GTK_STATE_NORMAL;
- CairoCachedSurface* pixbuf = PixbufForState(paint_state);
- CairoCachedSurface* hover_pixbuf = PixbufForState(GTK_STATE_PRELIGHT);
+ gfx::CairoCachedSurface* pixbuf = PixbufForState(paint_state);
+ gfx::CairoCachedSurface* hover_pixbuf = PixbufForState(GTK_STATE_PRELIGHT);
if (!pixbuf || !pixbuf->valid())
return FALSE;
@@ -107,15 +107,15 @@ gboolean CustomDrawButtonBase::OnExpose(GtkWidget* widget,
int y = allocation.height - pixbuf->Height();
if (background_image_->valid()) {
- background_image_->SetSource(cairo_context, x, y);
+ background_image_->SetSource(cairo_context, widget, x, y);
cairo_paint(cairo_context);
}
- pixbuf->SetSource(cairo_context, x, y);
+ pixbuf->SetSource(cairo_context, widget, x, y);
cairo_paint(cairo_context);
if (animating_hover) {
- hover_pixbuf->SetSource(cairo_context, x, y);
+ hover_pixbuf->SetSource(cairo_context, widget, x, y);
cairo_paint_with_alpha(cairo_context, hover_state);
}
@@ -161,8 +161,8 @@ void CustomDrawButtonBase::Observe(int type,
theme_service_->GetRTLEnabledPixbufNamed(disabled_id_) : NULL);
}
-CairoCachedSurface* CustomDrawButtonBase::PixbufForState(int state) {
- CairoCachedSurface* pixbuf = surfaces_[state].get();
+gfx::CairoCachedSurface* CustomDrawButtonBase::PixbufForState(int state) {
+ gfx::CairoCachedSurface* pixbuf = surfaces_[state].get();
// Fall back to the default image if we don't have one for this state.
if (!pixbuf || !pixbuf->valid())
« no previous file with comments | « chrome/browser/ui/gtk/custom_button.h ('k') | chrome/browser/ui/gtk/find_bar_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698