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

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

Issue 10388064: Add GetImageSkiaNamed to resource_bundle and theme_provider (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nits 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
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | ui/base/resource/resource_bundle.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/gtk_theme_service.h" 5 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
6 6
7 #include <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 8
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 ThemeService::Init(profile); 294 ThemeService::Init(profile);
295 } 295 }
296 296
297 SkBitmap* GtkThemeService::GetBitmapNamed(int id) const { 297 SkBitmap* GtkThemeService::GetBitmapNamed(int id) const {
298 // TODO(erg): Remove this const cast. The gfx::Image interface returns its 298 // TODO(erg): Remove this const cast. The gfx::Image interface returns its
299 // images const. GetBitmapNamed() also should but doesn't and has a million 299 // images const. GetBitmapNamed() also should but doesn't and has a million
300 // callsites. 300 // callsites.
301 return const_cast<SkBitmap*>(GetImageNamed(id)->ToSkBitmap()); 301 return const_cast<SkBitmap*>(GetImageNamed(id)->ToSkBitmap());
302 } 302 }
303 303
304 gfx::ImageSkia* GtkThemeService::GetImageSkiaNamed(int id) const {
305 // TODO(pkotwicz): Remove this const cast. The gfx::Image interface returns
306 // its images const. GetImageSkiaNamed() also should but has many callsites.
307 return const_cast<gfx::ImageSkia*>(GetImageNamed(id)->ToImageSkia());
308 }
309
304 const gfx::Image* GtkThemeService::GetImageNamed(int id) const { 310 const gfx::Image* GtkThemeService::GetImageNamed(int id) const {
305 // Try to get our cached version: 311 // Try to get our cached version:
306 ImageCache::const_iterator it = gtk_images_.find(id); 312 ImageCache::const_iterator it = gtk_images_.find(id);
307 if (it != gtk_images_.end()) 313 if (it != gtk_images_.end())
308 return it->second; 314 return it->second;
309 315
310 if (use_gtk_ && IsOverridableImage(id)) { 316 if (use_gtk_ && IsOverridableImage(id)) {
311 gfx::Image* image = new gfx::Image(GenerateGtkThemeBitmap(id)); 317 gfx::Image* image = new gfx::Image(GenerateGtkThemeBitmap(id));
312 gtk_images_[id] = image; 318 gtk_images_[id] = image;
313 return image; 319 return image;
(...skipping 829 matching lines...) Expand 10 before | Expand all | Expand 10 after
1143 cairo_new_path(cr); 1149 cairo_new_path(cr);
1144 cairo_set_line_width(cr, 1.0); 1150 cairo_set_line_width(cr, 1.0);
1145 cairo_move_to(cr, start_x, allocation.y); 1151 cairo_move_to(cr, start_x, allocation.y);
1146 cairo_line_to(cr, start_x, allocation.y + allocation.height); 1152 cairo_line_to(cr, start_x, allocation.y + allocation.height);
1147 cairo_stroke(cr); 1153 cairo_stroke(cr);
1148 cairo_destroy(cr); 1154 cairo_destroy(cr);
1149 cairo_pattern_destroy(pattern); 1155 cairo_pattern_destroy(pattern);
1150 1156
1151 return TRUE; 1157 return TRUE;
1152 } 1158 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/gtk_theme_service.h ('k') | ui/base/resource/resource_bundle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698