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

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

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 988450ed95488717afee60735f164790046d14ec..f379c57458fced7fc4386ae77be73af338dca441 100644
--- a/chrome/browser/themes/browser_theme_pack.cc
+++ b/chrome/browser/themes/browser_theme_pack.cc
@@ -477,17 +477,16 @@ class ThemeImageSource: public gfx::ImageSkiaSource {
}
virtual ~ThemeImageSource() {}
- virtual gfx::ImageSkiaRep GetImageForScale(
- ui::ScaleFactor scale_factor) OVERRIDE {
- if (source_.HasRepresentation(scale_factor))
- return source_.GetRepresentation(scale_factor);
+ virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE {
+ if (source_.HasRepresentation(scale))
+ return source_.GetRepresentation(scale);
const gfx::ImageSkiaRep& rep_100p =
- source_.GetRepresentation(ui::SCALE_FACTOR_100P);
+ source_.GetRepresentation(1.0f);
SkBitmap scaled_bitmap = CreateLowQualityResizedBitmap(
rep_100p.sk_bitmap(),
ui::SCALE_FACTOR_100P,
- scale_factor);
- return gfx::ImageSkiaRep(scaled_bitmap, scale_factor);
+ ui::GetScaleFactorFromScale(scale));
+ return gfx::ImageSkiaRep(scaled_bitmap, scale);
}
private:
@@ -509,13 +508,13 @@ class ThemeImagePngSource : public gfx::ImageSkiaSource {
virtual ~ThemeImagePngSource() {}
private:
- virtual gfx::ImageSkiaRep GetImageForScale(
- ui::ScaleFactor scale_factor) OVERRIDE {
+ virtual gfx::ImageSkiaRep GetImageForScale(float scale) OVERRIDE {
+ ui::ScaleFactor scale_factor = ui::GetScaleFactorFromScale(scale);
// Look up the bitmap for |scale factor| in the bitmap map. If found
// return it.
BitmapMap::const_iterator exact_bitmap_it = bitmap_map_.find(scale_factor);
if (exact_bitmap_it != bitmap_map_.end())
- return gfx::ImageSkiaRep(exact_bitmap_it->second, scale_factor);
+ return gfx::ImageSkiaRep(exact_bitmap_it->second, scale);
// Look up the raw PNG data for |scale_factor| in the png map. If found,
// decode it, store the result in the bitmap map and return it.
@@ -529,7 +528,7 @@ class ThemeImagePngSource : public gfx::ImageSkiaSource {
return gfx::ImageSkiaRep();
}
bitmap_map_[scale_factor] = bitmap;
- return gfx::ImageSkiaRep(bitmap, scale_factor);
+ return gfx::ImageSkiaRep(bitmap, scale);
}
// Find an available PNG for another scale factor. We want to use the
@@ -571,7 +570,7 @@ class ThemeImagePngSource : public gfx::ImageSkiaSource {
available_scale_factor,
scale_factor);
bitmap_map_[scale_factor] = scaled_bitmap;
- return gfx::ImageSkiaRep(scaled_bitmap, scale_factor);
+ return gfx::ImageSkiaRep(scaled_bitmap, scale);
}
PngMap png_map_;
@@ -1285,7 +1284,8 @@ bool BrowserThemePack::LoadRawBitmapsTo(
if (gfx::PNGCodec::Decode(raw_data->front(), raw_data->size(),
&bitmap)) {
image_skia.AddRepresentation(
- gfx::ImageSkiaRep(bitmap, scale_factor));
+ gfx::ImageSkiaRep(bitmap,
+ ui::GetScaleFactorScale(scale_factor)));
} else {
NOTREACHED() << "Unable to decode theme image resource "
<< it->first;
@@ -1473,7 +1473,9 @@ void BrowserThemePack::RepackImages(const ImageCache& images,
NOTREACHED() << "Image file for resource " << it->first
<< " could not be encoded.";
}
- int raw_id = GetRawIDByPersistentID(it->first, rep_it->scale_factor());
+ int raw_id = GetRawIDByPersistentID(
+ it->first,
+ ui::GetScaleFactorFromScale(rep_it->scale()));
(*reencoded_images)[raw_id] =
base::RefCountedBytes::TakeVector(&bitmap_data);
}

Powered by Google App Engine
This is Rietveld 408576698