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

Side by Side Diff: chrome/browser/ui/gtk/custom_button.cc

Issue 10377122: Convert GdkPixbufFromSkBitmap and GdkPixbufToSkBitmap (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 months 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/gtk/custom_button.h" 5 #include "chrome/browser/ui/gtk/custom_button.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/ui/gtk/gtk_chrome_button.h" 10 #include "chrome/browser/ui/gtk/gtk_chrome_button.h"
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 void CustomDrawButtonBase::SetBackground(SkColor color, 141 void CustomDrawButtonBase::SetBackground(SkColor color,
142 SkBitmap* image, SkBitmap* mask) { 142 SkBitmap* image, SkBitmap* mask) {
143 if (!image || !mask) { 143 if (!image || !mask) {
144 if (background_image_->valid()) { 144 if (background_image_->valid()) {
145 background_image_->UsePixbuf(NULL); 145 background_image_->UsePixbuf(NULL);
146 } 146 }
147 } else { 147 } else {
148 SkBitmap img = 148 SkBitmap img =
149 SkBitmapOperations::CreateButtonBackground(color, *image, *mask); 149 SkBitmapOperations::CreateButtonBackground(color, *image, *mask);
150 150
151 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&img); 151 GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(img);
152 background_image_->UsePixbuf(pixbuf); 152 background_image_->UsePixbuf(pixbuf);
153 g_object_unref(pixbuf); 153 g_object_unref(pixbuf);
154 } 154 }
155 } 155 }
156 156
157 void CustomDrawButtonBase::Observe(int type, 157 void CustomDrawButtonBase::Observe(int type,
158 const content::NotificationSource& source, 158 const content::NotificationSource& source,
159 const content::NotificationDetails& details) { 159 const content::NotificationDetails& details) {
160 DCHECK(theme_service_); 160 DCHECK(theme_service_);
161 DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type); 161 DCHECK(chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 } 376 }
377 377
378 gtk_chrome_button_set_use_gtk_rendering( 378 gtk_chrome_button_set_use_gtk_rendering(
379 GTK_CHROME_BUTTON(widget()), UseGtkTheme()); 379 GTK_CHROME_BUTTON(widget()), UseGtkTheme());
380 } 380 }
381 381
382 bool CustomDrawButton::UseGtkTheme() { 382 bool CustomDrawButton::UseGtkTheme() {
383 return !forcing_chrome_theme_ && theme_service_ && 383 return !forcing_chrome_theme_ && theme_service_ &&
384 theme_service_->UsingNativeTheme(); 384 theme_service_->UsingNativeTheme();
385 } 385 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/content_setting_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/extensions/extension_install_dialog_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698