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 | |
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')
20 files changed, 134 insertions, 139 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)); diff --git a/chrome/browser/browser_theme_provider.h b/chrome/browser/browser_theme_provider.h index 5313cec..0d11a6a 100644 --- a/chrome/browser/browser_theme_provider.h +++ b/chrome/browser/browser_theme_provider.h @@ -9,12 +9,12 @@ #include <string> #include <vector> +#include "app/gfx/color_utils.h" #include "app/resource_bundle.h" #include "app/theme_provider.h" #include "base/basictypes.h" #include "base/non_thread_safe.h" #include "base/ref_counted.h" -#include "skia/ext/skia_utils.h" class Extension; class Profile; @@ -93,12 +93,12 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, static const SkColor kDefaultColorControlBackground; static const SkColor kDefaultColorButtonBackground; - static const skia::HSL kDefaultTintButtons; - static const skia::HSL kDefaultTintFrame; - static const skia::HSL kDefaultTintFrameInactive; - static const skia::HSL kDefaultTintFrameIncognito; - static const skia::HSL kDefaultTintFrameIncognitoInactive; - static const skia::HSL kDefaultTintBackgroundTab; + static const color_utils::HSL kDefaultTintButtons; + static const color_utils::HSL kDefaultTintFrame; + static const color_utils::HSL kDefaultTintFrameInactive; + static const color_utils::HSL kDefaultTintFrameIncognito; + static const color_utils::HSL kDefaultTintFrameIncognitoInactive; + static const color_utils::HSL kDefaultTintBackgroundTab; static const char* kDefaultThemeID; @@ -209,10 +209,10 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, void SetColor(const char* id, const SkColor& color); // Sets an individual tint value. - void SetTint(const char* id, const skia::HSL& tint); + void SetTint(const char* id, const color_utils::HSL& tint); // Get the specified tint - |id| is one of the TINT_* enum values. - skia::HSL GetTint(int id); + color_utils::HSL GetTint(int id); // Generate any frame colors that weren't specified. void GenerateFrameColors(); @@ -255,7 +255,7 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, private: typedef std::map<const int, std::string> ImageMap; typedef std::map<const std::string, SkColor> ColorMap; - typedef std::map<const std::string, skia::HSL> TintMap; + typedef std::map<const std::string, color_utils::HSL> TintMap; typedef std::map<const std::string, int> DisplayPropertyMap; typedef std::map<const int, std::vector<unsigned char> > RawDataMap; typedef std::map<const int, std::string> ResourceNameMap; @@ -264,7 +264,7 @@ class BrowserThemeProvider : public base::RefCounted<BrowserThemeProvider>, const std::string GetTintKey(int id); // Returns the default tint for the given tint |id| TINT_* enum value. - skia::HSL GetDefaultTint(int id); + color_utils::HSL GetDefaultTint(int id); // Returns the string key for the given color |id| COLOR_* enum value. const std::string GetColorKey(int id); diff --git a/chrome/browser/browser_theme_provider_gtk.cc b/chrome/browser/browser_theme_provider_gtk.cc index 2787dce..ac04e65 100644 --- a/chrome/browser/browser_theme_provider_gtk.cc +++ b/chrome/browser/browser_theme_provider_gtk.cc @@ -7,6 +7,7 @@ #include "app/l10n_util.h" #include "base/gfx/gtk_util.h" #include "base/logging.h" +#include "third_party/skia/include/core/SkBitmap.h" GdkPixbuf* BrowserThemeProvider::GetPixbufNamed(int id) { return GetPixbufImpl(id, false); diff --git a/chrome/browser/browser_theme_provider_mac.mm b/chrome/browser/browser_theme_provider_mac.mm index 063ec25..6df0336 100644 --- a/chrome/browser/browser_theme_provider_mac.mm +++ b/chrome/browser/browser_theme_provider_mac.mm @@ -6,14 +6,14 @@ #import <Cocoa/Cocoa.h> +#include "app/gfx/color_utils.h" #include "base/logging.h" -#include "skia/ext/skia_utils.h" #include "skia/ext/skia_utils_mac.h" namespace { -void HSLToHSB(const skia::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) { - SkColor color = skia::HSLToSkColor(1.0, hsl); // alpha value doesn't matter +void HSLToHSB(const color_utils::HSL& hsl, CGFloat* h, CGFloat* s, CGFloat* b) { + SkColor color = color_utils::HSLToSkColor(hsl, 255); // alpha doesn't matter SkScalar hsv[3]; SkColorToHSV(color, hsv); @@ -106,7 +106,7 @@ NSColor* BrowserThemeProvider::GetNSColorTint(int id) { TintMap::iterator tint_iter = tints_.find(GetTintKey(id)); if (tint_iter != tints_.end()) { - skia::HSL tint = tint_iter->second; + color_utils::HSL tint = tint_iter->second; CGFloat hue, saturation, brightness; HSLToHSB(tint, &hue, &saturation, &brightness); diff --git a/chrome/browser/dom_ui/dom_ui_theme_source.cc b/chrome/browser/dom_ui/dom_ui_theme_source.cc index b956c3e..d2607be 100644 --- a/chrome/browser/dom_ui/dom_ui_theme_source.cc +++ b/chrome/browser/dom_ui/dom_ui_theme_source.cc @@ -135,11 +135,11 @@ void DOMUIThemeSource::InitNewTabCSS() { SkColor color_header = tp->GetColor(BrowserThemeProvider::COLOR_NTP_HEADER); // Generate a lighter color for the header gradients. - skia::HSL header_lighter; - skia::SkColorToHSL(color_header, header_lighter); + color_utils::HSL header_lighter; + color_utils::SkColorToHSL(color_header, &header_lighter); header_lighter.l += (1 - header_lighter.l) * 0.33; SkColor color_header_gradient_light = - skia::HSLToSkColor(SkColorGetA(color_header), header_lighter); + color_utils::HSLToSkColor(header_lighter, SkColorGetA(color_header)); // Generate section border color from the header color. See // BookmarkBarView::Paint for how we do this for the bookmark bar diff --git a/chrome/browser/download/download_util.cc b/chrome/browser/download/download_util.cc index 6b3b2f1..c52780b 100644 --- a/chrome/browser/download/download_util.cc +++ b/chrome/browser/download/download_util.cc @@ -12,6 +12,7 @@ #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/file_util.h" +#include "base/gfx/rect.h" #include "base/string_util.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/download/download_item_model.h" diff --git a/chrome/browser/gtk/browser_titlebar.cc b/chrome/browser/gtk/browser_titlebar.cc index fe85dbb..248b945 100644 --- a/chrome/browser/gtk/browser_titlebar.cc +++ b/chrome/browser/gtk/browser_titlebar.cc @@ -10,6 +10,7 @@ #include <string> #include <vector> +#include "app/gfx/skbitmap_operations.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "base/gfx/gtk_util.h" @@ -31,7 +32,6 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "skia/ext/image_operations.h" namespace { @@ -93,12 +93,12 @@ GdkPixbuf* GetOTRAvatar() { return otr_avatar; } -// Converts a GdkColor to a skia::HSL. -skia::HSL GdkColorToHSL(const GdkColor* color) { - skia::HSL hsl; - skia::SkColorToHSL(SkColorSetRGB(color->red >> 8, - color->green >> 8, - color->blue >> 8), hsl); +// Converts a GdkColor to a color_utils::HSL. +color_utils::HSL GdkColorToHSL(const GdkColor* color) { + color_utils::HSL hsl; + color_utils::SkColorToHSL(SkColorSetRGB(color->red >> 8, + color->green >> 8, + color->blue >> 8), &hsl); return hsl; } @@ -107,10 +107,10 @@ skia::HSL GdkColorToHSL(const GdkColor* color) { GdkColor PickLuminosityContrastingColor(const GdkColor* base, const GdkColor* one, const GdkColor* two) { - // Convert all GdkColors to skia::HSLs. - skia::HSL baseHSL = GdkColorToHSL(base); - skia::HSL oneHSL = GdkColorToHSL(one); - skia::HSL twoHSL = GdkColorToHSL(two); + // Convert all GdkColors to color_utils::HSLs. + color_utils::HSL baseHSL = GdkColorToHSL(base); + color_utils::HSL oneHSL = GdkColorToHSL(one); + color_utils::HSL twoHSL = GdkColorToHSL(two); double one_difference = fabs(baseHSL.l - oneHSL.l); double two_difference = fabs(baseHSL.l - twoHSL.l); @@ -591,7 +591,7 @@ static void MakeThrobberFrames(int resource_id, // Make a separate GdkPixbuf for each frame of the animation. for (size_t i = 0; i < num_frames; ++i) { - SkBitmap frame = skia::ImageOperations::CreateTiledBitmap(*frame_strip, + SkBitmap frame = SkBitmapOperations::CreateTiledBitmap(*frame_strip, i * frame_size, 0, frame_size, frame_size); frames->push_back(gfx::GdkPixbufFromSkBitmap(&frame)); } diff --git a/chrome/browser/gtk/browser_window_gtk.cc b/chrome/browser/gtk/browser_window_gtk.cc index 8b2dae5..cadfb08 100644 --- a/chrome/browser/gtk/browser_window_gtk.cc +++ b/chrome/browser/gtk/browser_window_gtk.cc @@ -9,6 +9,7 @@ #include <string> +#include "app/gfx/color_utils.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/theme_provider.h" @@ -75,7 +76,6 @@ #include "grit/generated_resources.h" #include "grit/google_chrome_strings.h" #include "grit/theme_resources.h" -#include "skia/ext/skia_utils.h" #include "skia/ext/skia_utils_gtk.h" #if defined(OS_CHROMEOS) @@ -1767,8 +1767,8 @@ void BrowserWindowGtk::SetBackgroundColor() { // When the cursor is over the divider, GTK+ normally lightens the background // color by 1.3 (see LIGHTNESS_MULT in gtkstyle.c). Since we're setting the // color, override the prelight also. - skia::HSL hsl = { -1, 0.5, 0.65 }; - SkColor frame_prelight_color = skia::HSLShift(frame_color, hsl); + color_utils::HSL hsl = { -1, 0.5, 0.65 }; + SkColor frame_prelight_color = color_utils::HSLShift(frame_color, hsl); GdkColor frame_prelight_color_gdk = SkColorToGdkColor(frame_prelight_color); gtk_widget_modify_bg(contents_split_, GTK_STATE_PRELIGHT, &frame_prelight_color_gdk); diff --git a/chrome/browser/gtk/custom_button.cc b/chrome/browser/gtk/custom_button.cc index 745f495..3e4e1cf 100644 --- a/chrome/browser/gtk/custom_button.cc +++ b/chrome/browser/gtk/custom_button.cc @@ -4,6 +4,7 @@ #include "chrome/browser/gtk/custom_button.h" +#include "app/gfx/skbitmap_operations.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/theme_provider.h" @@ -15,7 +16,6 @@ #include "chrome/common/gtk_util.h" #include "chrome/common/notification_service.h" #include "grit/theme_resources.h" -#include "skia/ext/image_operations.h" CustomDrawButtonBase::CustomDrawButtonBase(GtkThemeProvider* theme_provider, int normal_id, int active_id, int highlight_id, int depressed_id) @@ -104,8 +104,8 @@ void CustomDrawButtonBase::SetBackground(SkColor color, background_image_->UsePixbuf(NULL); } } else { - SkBitmap img = skia::ImageOperations::CreateButtonBackground(color, - *image, *mask); + SkBitmap img = + SkBitmapOperations::CreateButtonBackground(color, *image, *mask); GdkPixbuf* pixbuf = gfx::GdkPixbufFromSkBitmap(&img); background_image_->UsePixbuf(pixbuf); diff --git a/chrome/browser/gtk/gtk_theme_provider.cc b/chrome/browser/gtk/gtk_theme_provider.cc index 428e58b..15d0b77 100644 --- a/chrome/browser/gtk/gtk_theme_provider.cc +++ b/chrome/browser/gtk/gtk_theme_provider.cc @@ -6,6 +6,7 @@ #include <gtk/gtk.h> +#include "app/gfx/color_utils.h" #include "base/gfx/gtk_util.h" #include "chrome/browser/metrics/user_metrics.h" #include "chrome/browser/profile.h" @@ -31,9 +32,9 @@ namespace { const int kToolbarImageWidth = 64; const int kToolbarImageHeight = 128; -const skia::HSL kExactColor = { -1, -1, -1 }; +const color_utils::HSL kExactColor = { -1, -1, -1 }; -const skia::HSL kDefaultFrameShift = { -1, -1, 0.4 }; +const color_utils::HSL kDefaultFrameShift = { -1, -1, 0.4 }; // Values used as the new luminance and saturation values in the inactive tab // text color. @@ -352,8 +353,8 @@ void GtkThemeProvider::LoadGtkValues() { // color, change the luminosity of the frame color downwards to 80% of what // it currently is. This is in a futile attempt to match the default // metacity and xfwm themes. - SkColor shifted = skia::HSLShift(GdkToSkColor(&frame_color), - kDefaultFrameShift); + SkColor shifted = color_utils::HSLShift(GdkToSkColor(&frame_color), + kDefaultFrameShift); frame_color.pixel = 0; frame_color.red = SkColorGetR(shifted) * kSkiaToGDKMultiplier; frame_color.green = SkColorGetG(shifted) * kSkiaToGDKMultiplier; @@ -363,15 +364,15 @@ void GtkThemeProvider::LoadGtkValues() { // By default, the button tint color is the background selection color. But // this can be unreadable in some dark themes, so we set a minimum contrast // between the button color and the toolbar color. - skia::HSL button_hsl; - skia::SkColorToHSL(GdkToSkColor(&button_color), button_hsl); - skia::HSL toolbar_hsl; - skia::SkColorToHSL(GdkToSkColor(&toolbar_color), toolbar_hsl); + color_utils::HSL button_hsl; + color_utils::SkColorToHSL(GdkToSkColor(&button_color), &button_hsl); + color_utils::HSL toolbar_hsl; + color_utils::SkColorToHSL(GdkToSkColor(&toolbar_color), &toolbar_hsl); double hsl_difference = fabs(button_hsl.l - toolbar_hsl.l); if (hsl_difference <= kMinimumLuminanceDifference) { // Not enough contrast. Try the text color instead. - skia::HSL label_hsl; - skia::SkColorToHSL(GdkToSkColor(&label_color), label_hsl); + color_utils::HSL label_hsl; + color_utils::SkColorToHSL(GdkToSkColor(&label_color), &label_hsl); double label_difference = fabs(label_hsl.l - toolbar_hsl.l); if (label_difference >= kMinimumLuminanceDifference) { button_color = label_color; @@ -405,7 +406,7 @@ void GtkThemeProvider::LoadGtkValues() { // background tab color, with the lightness and saturation moved in the // opposite direction. (We don't touch the hue, since there should be subtle // hints of the color in the text.) - skia::HSL inactive_tab_text_hsl = GetTint(TINT_BACKGROUND_TAB); + color_utils::HSL inactive_tab_text_hsl = GetTint(TINT_BACKGROUND_TAB); if (inactive_tab_text_hsl.l < 0.5) inactive_tab_text_hsl.l = kDarkInactiveLuminance; else @@ -417,7 +418,7 @@ void GtkThemeProvider::LoadGtkValues() { inactive_tab_text_hsl.s = kLightInactiveSaturation; SetColor(kColorBackgroundTabText, - skia::HSLToSkColor(255, inactive_tab_text_hsl)); + color_utils::HSLToSkColor(inactive_tab_text_hsl, 255)); // The inactive color/tint is special: We *must* use the exact insensitive // color for all inactive windows, otherwise we end up neon pink half the @@ -437,10 +438,12 @@ void GtkThemeProvider::SetThemeColorFromGtk(const char* id, GdkColor* color) { SetColor(id, GdkToSkColor(color)); } -void GtkThemeProvider::SetThemeTintFromGtk(const char* id, GdkColor* color, - const skia::HSL& default_tint) { - skia::HSL hsl; - skia::SkColorToHSL(GdkToSkColor(color), hsl); +void GtkThemeProvider::SetThemeTintFromGtk( + const char* id, + GdkColor* color, + const color_utils::HSL& default_tint) { + color_utils::HSL hsl; + color_utils::SkColorToHSL(GdkToSkColor(color), &hsl); if (default_tint.s != -1) hsl.s = default_tint.s; diff --git a/chrome/browser/gtk/gtk_theme_provider.h b/chrome/browser/gtk/gtk_theme_provider.h index 14b6e73..a7b7ab3 100644 --- a/chrome/browser/gtk/gtk_theme_provider.h +++ b/chrome/browser/gtk/gtk_theme_provider.h @@ -9,12 +9,11 @@ #include <string> #include <vector> +#include "app/gfx/color_utils.h" #include "chrome/browser/browser_theme_provider.h" #include "chrome/common/notification_observer.h" #include "chrome/common/owned_widget_gtk.h" -#include "skia/ext/skia_utils.h" - class CairoCachedSurface; class Profile; @@ -112,7 +111,7 @@ class GtkThemeProvider : public BrowserThemeProvider, // Sets the underlying theme colors/tints from a GTK color. void SetThemeColorFromGtk(const char* id, GdkColor* color); void SetThemeTintFromGtk(const char* id, GdkColor* color, - const skia::HSL& default_tint); + const color_utils::HSL& default_tint); // Split out from FreePlatformCaches so it can be called in our destructor; // FreePlatformCaches() is called from the BrowserThemeProvider's destructor, diff --git a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc index 213475a..658d01f 100644 --- a/chrome/browser/gtk/tabs/tab_renderer_gtk.cc +++ b/chrome/browser/gtk/tabs/tab_renderer_gtk.cc @@ -9,6 +9,7 @@ #include "app/gfx/canvas_paint.h" #include "app/gfx/favicon_size.h" +#include "app/gfx/skbitmap_operations.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "chrome/browser/browser.h" @@ -23,7 +24,6 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "skia/ext/image_operations.h" namespace { @@ -697,13 +697,13 @@ SkBitmap* TabRendererGtk::GetMaskedBitmap(const SkBitmap* mask, // offsets. delete it->second.bitmap; } - SkBitmap image = skia::ImageOperations::CreateTiledBitmap( + SkBitmap image = SkBitmapOperations::CreateTiledBitmap( *background, bg_offset_x, bg_offset_y, mask->width(), height() + kToolbarOverlap); CachedBitmap bitmap = { bg_offset_x, bg_offset_y, - new SkBitmap(skia::ImageOperations::CreateMaskedBitmap(image, *mask)) + new SkBitmap(SkBitmapOperations::CreateMaskedBitmap(image, *mask)) }; cached_bitmaps_[std::make_pair(mask, background)] = bitmap; return bitmap.bitmap; diff --git a/chrome/browser/tab_contents/thumbnail_generator.cc b/chrome/browser/tab_contents/thumbnail_generator.cc index 7d20381..1a5c5c4 100644 --- a/chrome/browser/tab_contents/thumbnail_generator.cc +++ b/chrome/browser/tab_contents/thumbnail_generator.cc @@ -6,13 +6,13 @@ #include <algorithm> +#include "app/gfx/skbitmap_operations.h" #include "base/histogram.h" #include "base/time.h" #include "chrome/browser/renderer_host/backing_store.h" #include "chrome/browser/renderer_host/render_view_host.h" #include "chrome/common/notification_service.h" #include "chrome/common/property_bag.h" -#include "skia/ext/image_operations.h" #include "skia/ext/platform_canvas.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -139,9 +139,8 @@ SkBitmap GetThumbnailForBackingStore(BackingStore* backing_store) { NOTIMPLEMENTED(); #endif - result = skia::ImageOperations::DownsampleByTwoUntilSize( - bmp, - kThumbnailWidth, kThumbnailHeight); + result = SkBitmapOperations::DownsampleByTwoUntilSize(bmp, kThumbnailWidth, + kThumbnailHeight); #if defined(OS_WIN) // This is a bit subtle. SkBitmaps are refcounted, but the magic ones in diff --git a/chrome/browser/views/bookmark_bar_view.cc b/chrome/browser/views/bookmark_bar_view.cc index bf0ec9a..586422a 100644 --- a/chrome/browser/views/bookmark_bar_view.cc +++ b/chrome/browser/views/bookmark_bar_view.cc @@ -37,7 +37,6 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "skia/ext/skia_utils.h" #include "views/controls/button/menu_button.h" #include "views/controls/menu/menu_item_view.h" #include "views/drag_utils.h" diff --git a/chrome/browser/views/bookmark_manager_view.cc b/chrome/browser/views/bookmark_manager_view.cc index 384a2ce..5203346 100644 --- a/chrome/browser/views/bookmark_manager_view.cc +++ b/chrome/browser/views/bookmark_manager_view.cc @@ -29,6 +29,7 @@ #include "grit/generated_resources.h" #include "grit/locale_settings.h" #include "skia/ext/skia_utils.h" +#include "third_party/skia/include/core/SkShader.h" #include "views/grid_layout.h" #include "views/controls/button/menu_button.h" #include "views/controls/menu/menu_item_view.h" diff --git a/chrome/browser/views/detachable_toolbar_view.cc b/chrome/browser/views/detachable_toolbar_view.cc index 8363620..10613bb 100644 --- a/chrome/browser/views/detachable_toolbar_view.cc +++ b/chrome/browser/views/detachable_toolbar_view.cc @@ -7,7 +7,9 @@ #include "app/gfx/canvas.h" #include "chrome/browser/browser_theme_provider.h" #include "grit/theme_resources.h" +#include "skia/ext/skia_utils.h" #include "third_party/skia/include/core/SkBitmap.h" +#include "third_party/skia/include/core/SkShader.h" // How round the 'new tab' style bookmarks bar is. static const int kNewtabBarRoundness = 5; diff --git a/chrome/browser/views/extensions/extension_shelf.cc b/chrome/browser/views/extensions/extension_shelf.cc index 0b9ae7c..efab520 100644 --- a/chrome/browser/views/extensions/extension_shelf.cc +++ b/chrome/browser/views/extensions/extension_shelf.cc @@ -24,7 +24,6 @@ #include "chrome/common/extensions/extension.h" #include "chrome/common/notification_service.h" #include "chrome/common/pref_names.h" -#include "skia/ext/skia_utils.h" #include "views/controls/label.h" #include "views/screen.h" #include "views/widget/root_view.h" diff --git a/chrome/browser/views/tabs/tab_2.cc b/chrome/browser/views/tabs/tab_2.cc index 8065060..8cfe8a5 100644 --- a/chrome/browser/views/tabs/tab_2.cc +++ b/chrome/browser/views/tabs/tab_2.cc @@ -7,6 +7,7 @@ #include "app/gfx/canvas.h" #include "app/gfx/font.h" #include "app/gfx/path.h" +#include "app/gfx/skbitmap_operations.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "app/slide_animation.h" @@ -17,7 +18,6 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "skia/ext/image_operations.h" #include "views/animator.h" #include "views/controls/button/image_button.h" #include "views/widget/widget.h" @@ -525,23 +525,21 @@ void Tab2::PaintInactiveTabBackground(gfx::Canvas* canvas) { // Draw left edge. Don't draw over the toolbar, as we're not the foreground // tab. - SkBitmap tab_l = skia::ImageOperations::CreateTiledBitmap( - *tab_bg, offset, background_offset_.y(), - tab_active_.l_width, height()); - SkBitmap theme_l = skia::ImageOperations::CreateMaskedBitmap( - tab_l, *tab_alpha_.image_l); + SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( + *tab_bg, offset, background_offset_.y(), tab_active_.l_width, height()); + SkBitmap theme_l = + SkBitmapOperations::CreateMaskedBitmap(tab_l, *tab_alpha_.image_l); canvas->DrawBitmapInt(theme_l, 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, false); // Draw right edge. Again, don't draw over the toolbar. - SkBitmap tab_r = skia::ImageOperations::CreateTiledBitmap( - *tab_bg, + SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, offset + width() - tab_active_.r_width, background_offset_.y(), tab_active_.r_width, height()); - SkBitmap theme_r = skia::ImageOperations::CreateMaskedBitmap( - tab_r, *tab_alpha_.image_r); + SkBitmap theme_r = + SkBitmapOperations::CreateMaskedBitmap(tab_r, *tab_alpha_.image_r); canvas->DrawBitmapInt(theme_r, 0, 0, theme_r.width(), theme_r.height() - kToolbarOverlap, width() - theme_r.width(), 0, theme_r.width(), @@ -576,19 +574,17 @@ void Tab2::PaintActiveTabBackground(gfx::Canvas* canvas) { SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); // Draw left edge. - SkBitmap tab_l = skia::ImageOperations::CreateTiledBitmap( + SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( *tab_bg, offset, 0, tab_active_.l_width, height()); - SkBitmap theme_l = skia::ImageOperations::CreateMaskedBitmap( - tab_l, *tab_alpha_.image_l); + SkBitmap theme_l = + SkBitmapOperations::CreateMaskedBitmap(tab_l, *tab_alpha_.image_l); canvas->DrawBitmapInt(theme_l, 0, 0); // Draw right edge. - SkBitmap tab_r = skia::ImageOperations::CreateTiledBitmap( - *tab_bg, - offset + width() - tab_active_.r_width, 0, - tab_active_.r_width, height()); - SkBitmap theme_r = skia::ImageOperations::CreateMaskedBitmap( - tab_r, *tab_alpha_.image_r); + SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, + offset + width() - tab_active_.r_width, 0, tab_active_.r_width, height()); + SkBitmap theme_r = + SkBitmapOperations::CreateMaskedBitmap(tab_r, *tab_alpha_.image_r); canvas->DrawBitmapInt(theme_r, width() - tab_active_.r_width, 0); // Draw center. Instead of masking out the top portion we simply skip over it @@ -607,12 +603,12 @@ void Tab2::PaintActiveTabBackground(gfx::Canvas* canvas) { } void Tab2::PaintHoverTabBackground(gfx::Canvas* canvas, double opacity) { - SkBitmap left = skia::ImageOperations::CreateBlendedBitmap( - *tab_inactive_.image_l, *tab_active_.image_l, opacity); - SkBitmap center = skia::ImageOperations::CreateBlendedBitmap( - *tab_inactive_.image_c, *tab_active_.image_c, opacity); - SkBitmap right = skia::ImageOperations::CreateBlendedBitmap( - *tab_inactive_.image_r, *tab_active_.image_r, opacity); + SkBitmap left = SkBitmapOperations::CreateBlendedBitmap( + *tab_inactive_.image_l, *tab_active_.image_l, opacity); + SkBitmap center = SkBitmapOperations::CreateBlendedBitmap( + *tab_inactive_.image_c, *tab_active_.image_c, opacity); + SkBitmap right = SkBitmapOperations::CreateBlendedBitmap( + *tab_inactive_.image_r, *tab_active_.image_r, opacity); canvas->DrawBitmapInt(left, 0, 0); canvas->TileImageInt(center, tab_active_.l_width, 0, diff --git a/chrome/browser/views/tabs/tab_overview_cell.cc b/chrome/browser/views/tabs/tab_overview_cell.cc index 0dc46e5..4bebd42 100644 --- a/chrome/browser/views/tabs/tab_overview_cell.cc +++ b/chrome/browser/views/tabs/tab_overview_cell.cc @@ -5,8 +5,8 @@ #include "chrome/browser/views/tabs/tab_overview_cell.h" #include "app/gfx/favicon_size.h" +#include "app/gfx/skbitmap_operations.h" #include "base/string_util.h" -#include "skia/ext/image_operations.h" #include "views/border.h" #include "views/controls/image_view.h" #include "views/controls/label.h" @@ -67,7 +67,7 @@ TabOverviewCell::TabOverviewCell() : configured_thumbnail_(false) { void TabOverviewCell::SetThumbnail(const SkBitmap& thumbnail) { // Do mipmapped-based resampling to get closer to the correct size. The // input bitmap isn't guaranteed to have any specific resolution. - thumbnail_view_->SetImage(skia::ImageOperations::DownsampleByTwoUntilSize( + thumbnail_view_->SetImage(SkBitmapOperations::DownsampleByTwoUntilSize( thumbnail, kThumbnailWidth, kThumbnailHeight)); configured_thumbnail_ = true; } diff --git a/chrome/browser/views/tabs/tab_renderer.cc b/chrome/browser/views/tabs/tab_renderer.cc index 8e051c3..79664fd 100644 --- a/chrome/browser/views/tabs/tab_renderer.cc +++ b/chrome/browser/views/tabs/tab_renderer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include "app/gfx/canvas.h" #include "app/gfx/favicon_size.h" #include "app/gfx/font.h" +#include "app/gfx/skbitmap_operations.h" #include "app/l10n_util.h" #include "app/resource_bundle.h" #include "chrome/browser/browser.h" @@ -20,7 +21,6 @@ #include "grit/app_resources.h" #include "grit/generated_resources.h" #include "grit/theme_resources.h" -#include "skia/ext/image_operations.h" #include "views/widget/widget.h" #include "views/window/non_client_view.h" #include "views/window/window.h" @@ -657,23 +657,21 @@ void TabRenderer::PaintInactiveTabBackground(gfx::Canvas* canvas) { // Draw left edge. Don't draw over the toolbar, as we're not the foreground // tab. - SkBitmap tab_l = skia::ImageOperations::CreateTiledBitmap( - *tab_bg, offset, bg_offset_y, - tab_active.l_width, height()); - SkBitmap theme_l = skia::ImageOperations::CreateMaskedBitmap( - tab_l, *tab_alpha.image_l); + SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( + *tab_bg, offset, bg_offset_y, tab_active.l_width, height()); + SkBitmap theme_l = + SkBitmapOperations::CreateMaskedBitmap(tab_l, *tab_alpha.image_l); canvas->DrawBitmapInt(theme_l, 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, 0, 0, theme_l.width(), theme_l.height() - kToolbarOverlap, false); // Draw right edge. Again, don't draw over the toolbar. - SkBitmap tab_r = skia::ImageOperations::CreateTiledBitmap( - *tab_bg, + SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, offset + width() - tab_active.r_width, bg_offset_y, tab_active.r_width, height()); - SkBitmap theme_r = skia::ImageOperations::CreateMaskedBitmap( - tab_r, *tab_alpha.image_r); + SkBitmap theme_r = + SkBitmapOperations::CreateMaskedBitmap(tab_r, *tab_alpha.image_r); canvas->DrawBitmapInt(theme_r, 0, 0, theme_r.width(), theme_r.height() - kToolbarOverlap, width() - theme_r.width(), 0, theme_r.width(), @@ -708,19 +706,17 @@ void TabRenderer::PaintActiveTabBackground(gfx::Canvas* canvas) { SkBitmap* tab_bg = GetThemeProvider()->GetBitmapNamed(IDR_THEME_TOOLBAR); // Draw left edge. - SkBitmap tab_l = skia::ImageOperations::CreateTiledBitmap( + SkBitmap tab_l = SkBitmapOperations::CreateTiledBitmap( *tab_bg, offset, 0, tab_active.l_width, height()); - SkBitmap theme_l = skia::ImageOperations::CreateMaskedBitmap( - tab_l, *tab_alpha.image_l); + SkBitmap theme_l = + SkBitmapOperations::CreateMaskedBitmap(tab_l, *tab_alpha.image_l); canvas->DrawBitmapInt(theme_l, 0, 0); // Draw right edge. - SkBitmap tab_r = skia::ImageOperations::CreateTiledBitmap( - *tab_bg, - offset + width() - tab_active.r_width, 0, - tab_active.r_width, height()); - SkBitmap theme_r = skia::ImageOperations::CreateMaskedBitmap( - tab_r, *tab_alpha.image_r); + SkBitmap tab_r = SkBitmapOperations::CreateTiledBitmap(*tab_bg, + offset + width() - tab_active.r_width, 0, tab_active.r_width, height()); + SkBitmap theme_r = + SkBitmapOperations::CreateMaskedBitmap(tab_r, *tab_alpha.image_r); canvas->DrawBitmapInt(theme_r, width() - tab_active.r_width, 0); // Draw center. Instead of masking out the top portion we simply skip over it @@ -740,12 +736,12 @@ void TabRenderer::PaintActiveTabBackground(gfx::Canvas* canvas) { void TabRenderer::PaintHoverTabBackground(gfx::Canvas* canvas, double opacity) { - SkBitmap left = skia::ImageOperations::CreateBlendedBitmap( - *tab_inactive.image_l, *tab_active.image_l, opacity); - SkBitmap center = skia::ImageOperations::CreateBlendedBitmap( - *tab_inactive.image_c, *tab_active.image_c, opacity); - SkBitmap right = skia::ImageOperations::CreateBlendedBitmap( - *tab_inactive.image_r, *tab_active.image_r, opacity); + SkBitmap left = SkBitmapOperations::CreateBlendedBitmap( + *tab_inactive.image_l, *tab_active.image_l, opacity); + SkBitmap center = SkBitmapOperations::CreateBlendedBitmap( + *tab_inactive.image_c, *tab_active.image_c, opacity); + SkBitmap right = SkBitmapOperations::CreateBlendedBitmap( + *tab_inactive.image_r, *tab_active.image_r, opacity); canvas->DrawBitmapInt(left, 0, 0); canvas->TileImageInt(center, tab_active.l_width, 0, |