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

Side by Side Diff: chrome/browser/browser_theme_provider.cc

Issue 198003: Make theme setup a little faster by not blurring images for tab backgrounds.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/browser_theme_provider.h" 5 #include "chrome/browser/browser_theme_provider.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/gfx/png_decoder.h" 8 #include "base/gfx/png_decoder.h"
9 #include "base/gfx/png_encoder.h" 9 #include "base/gfx/png_encoder.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after
993 std::string resource_name; 993 std::string resource_name;
994 if (id == IDR_THEME_TAB_BACKGROUND) { 994 if (id == IDR_THEME_TAB_BACKGROUND) {
995 base_id = IDR_THEME_FRAME; 995 base_id = IDR_THEME_FRAME;
996 resource_name = "theme_tab_background"; 996 resource_name = "theme_tab_background";
997 } else { 997 } else {
998 base_id = IDR_THEME_FRAME_INCOGNITO; 998 base_id = IDR_THEME_FRAME_INCOGNITO;
999 resource_name = "theme_tab_background_incognito"; 999 resource_name = "theme_tab_background_incognito";
1000 } 1000 }
1001 std::map<int, SkBitmap*>::iterator it = image_cache_.find(base_id); 1001 std::map<int, SkBitmap*>::iterator it = image_cache_.find(base_id);
1002 if (it != image_cache_.end()) { 1002 if (it != image_cache_.end()) {
1003 SkBitmap* frame = it->second; 1003 SkBitmap* bg_tab = new SkBitmap(TintBitmap(*(it->second),
1004 int blur_amount = HasCustomImage(id) ? 1 : 2;
1005 SkBitmap blurred =
1006 skia::ImageOperations::CreateBlurredBitmap(*frame, blur_amount);
1007 SkBitmap* bg_tab = new SkBitmap(TintBitmap(blurred,
1008 TINT_BACKGROUND_TAB)); 1004 TINT_BACKGROUND_TAB));
1009 1005
1010 // If they've provided a custom image, overlay it. 1006 // If they've provided a custom image, overlay it.
1011 if (HasCustomImage(id)) { 1007 if (HasCustomImage(id)) {
1012 SkBitmap* overlay = LoadThemeBitmap(id); 1008 SkBitmap* overlay = LoadThemeBitmap(id);
1013 if (overlay) { 1009 if (overlay) {
1014 SkCanvas canvas(*bg_tab); 1010 SkCanvas canvas(*bg_tab);
1015 for (int x = 0; x < bg_tab->width(); x += overlay->width()) 1011 for (int x = 0; x < bg_tab->width(); x += overlay->width())
1016 canvas.drawBitmap(*overlay, static_cast<SkScalar>(x), 0, NULL); 1012 canvas.drawBitmap(*overlay, static_cast<SkScalar>(x), 0, NULL);
1017 } 1013 }
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1183 // the image_cache_, and have therefore all been deleted in the lines above. 1179 // the image_cache_, and have therefore all been deleted in the lines above.
1184 // TODO(mirandac): make memory management clearer here. 1180 // TODO(mirandac): make memory management clearer here.
1185 image_save_cache_.clear(); 1181 image_save_cache_.clear();
1186 } 1182 }
1187 1183
1188 #if defined(TOOLKIT_VIEWS) 1184 #if defined(TOOLKIT_VIEWS)
1189 void BrowserThemeProvider::FreePlatformCaches() { 1185 void BrowserThemeProvider::FreePlatformCaches() {
1190 // Views (Skia) has no platform image cache to clear. 1186 // Views (Skia) has no platform image cache to clear.
1191 } 1187 }
1192 #endif 1188 #endif
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