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

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

Issue 159903: Quick 'low-risk-for-the-next-release' fix to increase theme install/load perf... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 4 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/gfx/png_decoder.h" 7 #include "base/gfx/png_decoder.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/browser_list.h" 10 #include "chrome/browser/browser_list.h"
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 // The requested image is a background tab. Get a frame to create the 812 // The requested image is a background tab. Get a frame to create the
813 // tab against. As themes don't use the glass frame, we don't have to 813 // tab against. As themes don't use the glass frame, we don't have to
814 // worry about compositing them together, as our default theme provides 814 // worry about compositing them together, as our default theme provides
815 // the necessary bitmaps. 815 // the necessary bitmaps.
816 int base_id = (id == IDR_THEME_TAB_BACKGROUND) ? 816 int base_id = (id == IDR_THEME_TAB_BACKGROUND) ?
817 IDR_THEME_FRAME : IDR_THEME_FRAME_INCOGNITO; 817 IDR_THEME_FRAME : IDR_THEME_FRAME_INCOGNITO;
818 818
819 std::map<int, SkBitmap*>::iterator it = image_cache_.find(base_id); 819 std::map<int, SkBitmap*>::iterator it = image_cache_.find(base_id);
820 if (it != image_cache_.end()) { 820 if (it != image_cache_.end()) {
821 SkBitmap* frame = it->second; 821 SkBitmap* frame = it->second;
822 int blur_amount = (HasCustomImage(id)) ? 1 : 5; 822 int blur_amount = (HasCustomImage(id)) ? 1 : 2;
823 SkBitmap blurred = 823 SkBitmap blurred =
824 skia::ImageOperations::CreateBlurredBitmap(*frame, blur_amount); 824 skia::ImageOperations::CreateBlurredBitmap(*frame, blur_amount);
825 SkBitmap* bg_tab = new SkBitmap(TintBitmap(blurred, TINT_BACKGROUND_TAB)); 825 SkBitmap* bg_tab = new SkBitmap(TintBitmap(blurred, TINT_BACKGROUND_TAB));
826 826
827 // If they've provided a custom image, overlay it. 827 // If they've provided a custom image, overlay it.
828 if (HasCustomImage(id)) { 828 if (HasCustomImage(id)) {
829 SkBitmap* overlay = LoadThemeBitmap(id); 829 SkBitmap* overlay = LoadThemeBitmap(id);
830 if (overlay) { 830 if (overlay) {
831 SkCanvas canvas(*bg_tab); 831 SkCanvas canvas(*bg_tab);
832 for (int x = 0; x < bg_tab->width(); x += overlay->width()) 832 for (int x = 0; x < bg_tab->width(); x += overlay->width())
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 delete i->second; 980 delete i->second;
981 } 981 }
982 image_cache_.clear(); 982 image_cache_.clear();
983 } 983 }
984 984
985 #if defined(TOOLKIT_VIEWS) 985 #if defined(TOOLKIT_VIEWS)
986 void BrowserThemeProvider::FreePlatformCaches() { 986 void BrowserThemeProvider::FreePlatformCaches() {
987 // Views (Skia) has no platform image cache to clear. 987 // Views (Skia) has no platform image cache to clear.
988 } 988 }
989 #endif 989 #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