diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 01:14:52 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 01:14:52 +0000 |
commit | cab34d6a13d3044c59cd5dccdf4b04725a395aac (patch) | |
tree | d9c05fd2e59a12cedf72f97d8cb4c420ff4793bb /chrome/browser/browser_theme_provider.cc | |
parent | 37cc1a1eaaa0c425a1ba889cf619f464227f9906 (diff) | |
download | chromium_src-cab34d6a13d3044c59cd5dccdf4b04725a395aac.zip chromium_src-cab34d6a13d3044c59cd5dccdf4b04725a395aac.tar.gz chromium_src-cab34d6a13d3044c59cd5dccdf4b04725a395aac.tar.bz2 |
Move functions from skia/ext to app/gfx where possible: most of skia_utils.* and image_operations.* can be moved because they are not used by WebKit code.
This also fixes the spelling of "Convolusion" to "Convolution" and updates some copyrights.
This is a re-do of r26975, this time with WebKit update and some fixes to compile on Mac and Linux.
BUG=none
TEST=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27031 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_theme_provider.cc')
-rw-r--r-- | chrome/browser/browser_theme_provider.cc | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/chrome/browser/browser_theme_provider.cc b/chrome/browser/browser_theme_provider.cc index 3b1326c..fa6aa89 100644 --- a/chrome/browser/browser_theme_provider.cc +++ b/chrome/browser/browser_theme_provider.cc @@ -4,6 +4,7 @@ #include "chrome/browser/browser_theme_provider.h" +#include "app/gfx/skbitmap_operations.h" #include "base/file_util.h" #include "base/string_util.h" #include "base/gfx/png_decoder.h" @@ -25,10 +26,9 @@ #include "grit/theme_resources.h" #include "net/base/file_stream.h" #include "net/base/net_errors.h" -#include "skia/ext/image_operations.h" -#include "skia/ext/skia_utils.h" #include "third_party/skia/include/core/SkBitmap.h" #include "third_party/skia/include/core/SkCanvas.h" +#include "third_party/skia/include/core/SkUnPreMultiply.h" #if defined(OS_WIN) #include "app/win_util.h" @@ -125,15 +125,17 @@ const SkColor BrowserThemeProvider::kDefaultColorControlBackground = NULL; const SkColor BrowserThemeProvider::kDefaultColorButtonBackground = NULL; // Default tints. -const skia::HSL BrowserThemeProvider::kDefaultTintButtons = { -1, -1, -1 }; -const skia::HSL BrowserThemeProvider::kDefaultTintFrame = { -1, -1, -1 }; -const skia::HSL BrowserThemeProvider::kDefaultTintFrameInactive = +const color_utils::HSL BrowserThemeProvider::kDefaultTintButtons = + { -1, -1, -1 }; +const color_utils::HSL BrowserThemeProvider::kDefaultTintFrame = { -1, -1, -1 }; +const color_utils::HSL BrowserThemeProvider::kDefaultTintFrameInactive = { -1, -1, 0.75f }; -const skia::HSL BrowserThemeProvider::kDefaultTintFrameIncognito = +const color_utils::HSL BrowserThemeProvider::kDefaultTintFrameIncognito = { -1, 0.2f, 0.35f }; -const skia::HSL BrowserThemeProvider::kDefaultTintFrameIncognitoInactive = +const color_utils::HSL + BrowserThemeProvider::kDefaultTintFrameIncognitoInactive = { -1, 0.3f, 0.6f }; -const skia::HSL BrowserThemeProvider::kDefaultTintBackgroundTab = +const color_utils::HSL BrowserThemeProvider::kDefaultTintBackgroundTab = { -1, 0.5, 0.75 }; // Saved default values. @@ -680,7 +682,7 @@ const std::string BrowserThemeProvider::GetTintKey(int id) { } } -skia::HSL BrowserThemeProvider::GetDefaultTint(int id) { +color_utils::HSL BrowserThemeProvider::GetDefaultTint(int id) { switch (id) { case TINT_FRAME: return kDefaultTintFrame; @@ -695,23 +697,20 @@ skia::HSL BrowserThemeProvider::GetDefaultTint(int id) { case TINT_BACKGROUND_TAB: return kDefaultTintBackgroundTab; default: - skia::HSL result = {-1, -1, -1}; + color_utils::HSL result = {-1, -1, -1}; return result; } } -skia::HSL BrowserThemeProvider::GetTint(int id) { +color_utils::HSL BrowserThemeProvider::GetTint(int id) { DCHECK(CalledOnValidThread()); TintMap::iterator tint_iter = tints_.find(GetTintKey(id)); - if (tint_iter != tints_.end()) - return tint_iter->second; - else - return GetDefaultTint(id); + return (tint_iter == tints_.end()) ? GetDefaultTint(id) : tint_iter->second; } SkBitmap BrowserThemeProvider::TintBitmap(const SkBitmap& bitmap, int hsl_id) { - return skia::ImageOperations::CreateHSLShiftedBitmap(bitmap, GetTint(hsl_id)); + return SkBitmapOperations::CreateHSLShiftedBitmap(bitmap, GetTint(hsl_id)); } void BrowserThemeProvider::SetImageData(DictionaryValue* images_value, @@ -784,7 +783,7 @@ void BrowserThemeProvider::SetTintData(DictionaryValue* tints_value) { ListValue* tint_list; if (tints_value->GetList(*iter, &tint_list) && tint_list->GetSize() == 3) { - skia::HSL hsl = { -1, -1, -1 }; + color_utils::HSL hsl = { -1, -1, -1 }; int value = 0; if (!tint_list->GetReal(0, &hsl.h) && tint_list->GetInteger(0, &value)) hsl.h = value; @@ -912,7 +911,8 @@ void BrowserThemeProvider::SetColor(const char* key, const SkColor& color) { colors_[key] = color; } -void BrowserThemeProvider::SetTint(const char* key, const skia::HSL& tint) { +void BrowserThemeProvider::SetTint(const char* key, + const color_utils::HSL& tint) { tints_[key] = tint; } @@ -1057,9 +1057,8 @@ SkBitmap* BrowserThemeProvider::GenerateBitmap(int id) { SkBitmap bg_tint = TintBitmap(*(it->second), TINT_BACKGROUND_TAB); int vertical_offset = HasCustomImage(id) ? kRestoredTabVerticalOffset : 0; - SkBitmap* bg_tab = new SkBitmap( - skia::ImageOperations::CreateTiledBitmap(bg_tint, 0, - vertical_offset, bg_tint.width(), bg_tint.height())); + SkBitmap* bg_tab = new SkBitmap(SkBitmapOperations::CreateTiledBitmap( + bg_tint, 0, vertical_offset, bg_tint.width(), bg_tint.height())); // If they've provided a custom image, overlay it. if (HasCustomImage(id)) { @@ -1143,7 +1142,7 @@ void BrowserThemeProvider::SaveTintData() { if (tints_.size()) { TintMap::iterator iter = tints_.begin(); while (iter != tints_.end()) { - skia::HSL hsl = (*iter).second; + color_utils::HSL hsl = (*iter).second; ListValue* hsl_list = new ListValue(); hsl_list->Set(0, Value::CreateRealValue(hsl.h)); hsl_list->Set(1, Value::CreateRealValue(hsl.s)); |