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

Unified Diff: chrome/browser/themes/browser_theme_pack.cc

Issue 10086023: Expose array of bitmaps contained by gfx::Image similar to NSImage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nicer diff Created 8 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/themes/browser_theme_pack.cc
diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc
index 448e566f8025e64044e0f9c253d3cdcbe9ecd22e..a6eb6727eacd1c70851d237ee9fc4a90ae4dde3d 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -24,6 +24,7 @@
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/codec/png_codec.h"
#include "ui/gfx/image/image.h"
+#include "ui/gfx/image/image_skia.h"
#include "ui/gfx/skbitmap_operations.h"
using content::BrowserThread;
@@ -310,8 +311,9 @@ RefCountedMemory* ReadFileData(const FilePath& path) {
gfx::Image* CreateHSLShiftedImage(const gfx::Image& image,
const color_utils::HSL& hsl_shift) {
std::vector<const SkBitmap*> bitmaps;
- for (size_t i = 0; i < image.GetNumberOfSkBitmaps(); ++i) {
- const SkBitmap* bitmap = image.GetSkBitmapAtIndex(i);
+ const gfx::ImageSkia* image_skia = image.ToImageSkia();
+ for (size_t i = 0; i < image_skia->GetNumberOfBitmaps(); ++i) {
+ const SkBitmap* bitmap = image_skia->GetBitmapAtIndex(i);
bitmaps.push_back(new SkBitmap(SkBitmapOperations::CreateHSLShiftedBitmap(
*bitmap, hsl_shift)));
}
@@ -989,9 +991,10 @@ void BrowserThemePack::GenerateTabBackgroundImages(ImageCache* bitmaps) const {
if (it != bitmaps->end()) {
const gfx::Image& image_to_tint = *(it->second);
std::vector<const SkBitmap*> tinted_bitmaps;
- for (size_t j = 0; j < image_to_tint.GetNumberOfSkBitmaps(); ++j) {
+ const gfx::ImageSkia* image_to_tint_skia = image_to_tint.ToImageSkia();
+ for (size_t j = 0; j < image_to_tint_skia->GetNumberOfBitmaps(); ++j) {
SkBitmap bg_tint = SkBitmapOperations::CreateHSLShiftedBitmap(
- *image_to_tint.GetSkBitmapAtIndex(j), GetTintInternal(
+ *image_to_tint_skia->GetBitmapAtIndex(j), GetTintInternal(
ThemeService::TINT_BACKGROUND_TAB));
int vertical_offset = bitmaps->count(prs_id)
? kRestoredTabVerticalOffset : 0;

Powered by Google App Engine
This is Rietveld 408576698