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

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

Issue 7739001: Remove redundant allocation and SkBitmap copy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | « no previous file | no next file » | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after
1073 SkBitmap bg_tint = SkBitmapOperations::CreateHSLShiftedBitmap( 1073 SkBitmap bg_tint = SkBitmapOperations::CreateHSLShiftedBitmap(
1074 *base_image, GetTint(ThemeService::TINT_BACKGROUND_TAB)); 1074 *base_image, GetTint(ThemeService::TINT_BACKGROUND_TAB));
1075 return new SkBitmap(SkBitmapOperations::CreateTiledBitmap( 1075 return new SkBitmap(SkBitmapOperations::CreateTiledBitmap(
1076 bg_tint, 0, 0, bg_tint.width(), bg_tint.height())); 1076 bg_tint, 0, 0, bg_tint.width(), bg_tint.height()));
1077 } 1077 }
1078 1078
1079 SkBitmap* GtkThemeService::GenerateTintedIcon( 1079 SkBitmap* GtkThemeService::GenerateTintedIcon(
1080 int base_id, 1080 int base_id,
1081 const color_utils::HSL& tint) const { 1081 const color_utils::HSL& tint) const {
1082 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 1082 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
1083 scoped_ptr<SkBitmap> button(new SkBitmap(*rb.GetBitmapNamed(base_id)));
1084 return new SkBitmap(SkBitmapOperations::CreateHSLShiftedBitmap( 1083 return new SkBitmap(SkBitmapOperations::CreateHSLShiftedBitmap(
1085 *button, tint)); 1084 *rb.GetBitmapNamed(base_id), tint));
1086 } 1085 }
1087 1086
1088 void GtkThemeService::GetNormalButtonTintHSL( 1087 void GtkThemeService::GetNormalButtonTintHSL(
1089 color_utils::HSL* tint) const { 1088 color_utils::HSL* tint) const {
1090 GtkStyle* window_style = gtk_rc_get_style(fake_window_); 1089 GtkStyle* window_style = gtk_rc_get_style(fake_window_);
1091 const GdkColor accent_gdk_color = window_style->bg[GTK_STATE_SELECTED]; 1090 const GdkColor accent_gdk_color = window_style->bg[GTK_STATE_SELECTED];
1092 const GdkColor base_color = window_style->base[GTK_STATE_NORMAL]; 1091 const GdkColor base_color = window_style->base[GTK_STATE_NORMAL];
1093 1092
1094 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get()); 1093 GtkStyle* label_style = gtk_rc_get_style(fake_label_.get());
1095 const GdkColor text_color = label_style->fg[GTK_STATE_NORMAL]; 1094 const GdkColor text_color = label_style->fg[GTK_STATE_NORMAL];
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1196 cairo_set_line_width(cr, 1.0); 1195 cairo_set_line_width(cr, 1.0);
1197 cairo_move_to(cr, start_x, widget->allocation.y); 1196 cairo_move_to(cr, start_x, widget->allocation.y);
1198 cairo_line_to(cr, start_x, 1197 cairo_line_to(cr, start_x,
1199 widget->allocation.y + widget->allocation.height); 1198 widget->allocation.y + widget->allocation.height);
1200 cairo_stroke(cr); 1199 cairo_stroke(cr);
1201 cairo_destroy(cr); 1200 cairo_destroy(cr);
1202 cairo_pattern_destroy(pattern); 1201 cairo_pattern_destroy(pattern);
1203 1202
1204 return TRUE; 1203 return TRUE;
1205 } 1204 }
OLDNEW
« 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