summaryrefslogtreecommitdiffstats
path: root/chrome/browser/themes/browser_theme_pack.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/themes/browser_theme_pack.cc')
-rw-r--r--chrome/browser/themes/browser_theme_pack.cc41
1 files changed, 19 insertions, 22 deletions
diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
index b5f17eb..0ae0895 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -311,18 +311,15 @@ base::RefCountedMemory* ReadFileData(const FilePath& path) {
// the returned image.
gfx::Image* CreateHSLShiftedImage(const gfx::Image& image,
const color_utils::HSL& hsl_shift) {
- const gfx::ImageSkia* src_image = image.ToImageSkia();
- const std::vector<SkBitmap> src_bitmaps = src_image->bitmaps();
- gfx::ImageSkia dst_image;
+ const std::vector<const SkBitmap*>& src_bitmaps =
+ image.ToImageSkia()->bitmaps();
+ std::vector<const SkBitmap*> dst_bitmaps;
for (size_t i = 0; i < src_bitmaps.size(); ++i) {
- const SkBitmap& bitmap = src_bitmaps[i];
- float scale_factor =
- static_cast<float>(bitmap.width()) / src_image->width();
- dst_image.AddBitmapForScale(
- SkBitmapOperations::CreateHSLShiftedBitmap(bitmap, hsl_shift),
- scale_factor);
+ const SkBitmap* bitmap = src_bitmaps[i];
+ dst_bitmaps.push_back(new SkBitmap(
+ SkBitmapOperations::CreateHSLShiftedBitmap(*bitmap, hsl_shift)));
}
- return new gfx::Image(dst_image);
+ return new gfx::Image(dst_bitmaps);
}
} // namespace
@@ -995,32 +992,32 @@ void BrowserThemePack::GenerateTabBackgroundImages(ImageCache* bitmaps) const {
// with a PRS_THEME_FRAME.
ImageCache::const_iterator it = bitmaps->find(prs_base_id);
if (it != bitmaps->end()) {
- const gfx::ImageSkia* image_to_tint = (it->second)->ToImageSkia();
- const std::vector<SkBitmap> bitmaps_to_tint = image_to_tint->bitmaps();
- gfx::ImageSkia tinted_image;
+ const gfx::Image& image_to_tint = *(it->second);
+ const std::vector<const SkBitmap*>& bitmaps_to_tint =
+ image_to_tint.ToImageSkia()->bitmaps();
+ std::vector<const SkBitmap*> tinted_bitmaps;
for (size_t j = 0; j < bitmaps_to_tint.size(); ++j) {
SkBitmap bg_tint = SkBitmapOperations::CreateHSLShiftedBitmap(
- bitmaps_to_tint[j], GetTintInternal(
+ *bitmaps_to_tint[j], GetTintInternal(
ThemeService::TINT_BACKGROUND_TAB));
int vertical_offset = bitmaps->count(prs_id)
? kRestoredTabVerticalOffset : 0;
- SkBitmap bg_tab = SkBitmapOperations::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.
ImageCache::const_iterator overlay_it = bitmaps->find(prs_id);
if (overlay_it != bitmaps->end()) {
const SkBitmap* overlay = overlay_it->second->ToSkBitmap();
- SkCanvas canvas(bg_tab);
- for (int x = 0; x < bg_tab.width(); x += overlay->width())
+ SkCanvas canvas(*bg_tab);
+ for (int x = 0; x < bg_tab->width(); x += overlay->width())
canvas.drawBitmap(*overlay, static_cast<SkScalar>(x), 0, NULL);
}
- float scale_factor =
- static_cast<float>(bg_tab.width()) / image_to_tint->width();
- tinted_image.AddBitmapForScale(bg_tab, scale_factor);
+ tinted_bitmaps.push_back(bg_tab);
}
- temp_output[prs_id] = new gfx::Image(tinted_image);
+ gfx::Image* tinted_image = new gfx::Image(tinted_bitmaps);
+ temp_output[prs_id] = tinted_image;
}
}