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

Unified Diff: chrome/browser/favicon/favicon_util.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix new usage of scale in FastShowPickler 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
« no previous file with comments | « chrome/browser/favicon/favicon_service.cc ('k') | chrome/browser/history/select_favicon_frames.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/favicon/favicon_util.cc
diff --git a/chrome/browser/favicon/favicon_util.cc b/chrome/browser/favicon/favicon_util.cc
index 4f2db614bf8a67fc5278e785a17c8633ce116cd7..a34ffca166ae5fc341c2fe5c814f27ad9194c9a9 100644
--- a/chrome/browser/favicon/favicon_util.cc
+++ b/chrome/browser/favicon/favicon_util.cc
@@ -43,18 +43,17 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing(
best_candidate = png_data[i].bitmap_data;
}
}
- png_reps.push_back(gfx::ImagePNGRep(best_candidate,
- ui::SCALE_FACTOR_100P));
+ png_reps.push_back(gfx::ImagePNGRep(best_candidate, 1.0f));
return png_reps;
}
// Cache the scale factor for each pixel size as |scale_factors| may contain
// any of GetFaviconScaleFactors() which may include scale factors not
- // supported by the platform. (ui::GetScaleFactorFromScale() cannot be used.)
+ // supported by the platform. (ui::GetSupportedScaleFactor() cannot be used.)
std::map<int, ui::ScaleFactor> desired_pixel_sizes;
for (size_t i = 0; i < scale_factors.size(); ++i) {
int pixel_size = floor(favicon_size *
- ui::GetScaleFactorScale(scale_factors[i]));
+ ui::GetImageScale(scale_factors[i]));
desired_pixel_sizes[pixel_size] = scale_factors[i];
}
@@ -71,7 +70,9 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing(
if (it == desired_pixel_sizes.end())
continue;
- png_reps.push_back(gfx::ImagePNGRep(png_data[i].bitmap_data, it->second));
+ png_reps.push_back(
+ gfx::ImagePNGRep(png_data[i].bitmap_data,
+ ui::GetImageScale(it->second)));
}
return png_reps;
@@ -137,7 +138,7 @@ SkBitmap ResizeBitmapByDownsamplingIfPossible(
// static
std::vector<ui::ScaleFactor> FaviconUtil::GetFaviconScaleFactors() {
- const float kScale1x = ui::GetScaleFactorScale(ui::SCALE_FACTOR_100P);
+ const float kScale1x = ui::GetImageScale(ui::SCALE_FACTOR_100P);
std::vector<ui::ScaleFactor> favicon_scale_factors =
ui::GetSupportedScaleFactors();
@@ -146,7 +147,7 @@ std::vector<ui::ScaleFactor> FaviconUtil::GetFaviconScaleFactors() {
// well.
size_t insert_index = favicon_scale_factors.size();
for (size_t i = 0; i < favicon_scale_factors.size(); ++i) {
- float scale = ui::GetScaleFactorScale(favicon_scale_factors[i]);
+ float scale = ui::GetImageScale(favicon_scale_factors[i]);
if (scale == kScale1x) {
return favicon_scale_factors;
} else if (scale > kScale1x) {
@@ -201,7 +202,7 @@ gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs(
std::vector<ui::ScaleFactor>::iterator it = std::find(
scale_factors_to_generate.begin(),
scale_factors_to_generate.end(),
- png_reps[i].scale_factor);
+ ui::GetSupportedScaleFactor(png_reps[i].scale));
CHECK(it != scale_factors_to_generate.end());
scale_factors_to_generate.erase(it);
}
@@ -229,7 +230,7 @@ gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs(
for (size_t i = 0; i < scale_factors_to_generate.size(); ++i) {
ui::ScaleFactor scale_factor = scale_factors_to_generate[i];
int desired_size_in_pixel =
- ceil(favicon_size * ui::GetScaleFactorScale(scale_factor));
+ ceil(favicon_size * ui::GetImageScale(scale_factor));
SkBitmap bitmap = ResizeBitmapByDownsamplingIfPossible(
bitmaps, desired_size_in_pixel);
resized_image_skia.AddRepresentation(
@@ -246,7 +247,7 @@ gfx::Image FaviconUtil::SelectFaviconFramesFromPNGs(
if (gfx::PNGCodec::EncodeBGRASkBitmap(
resized_image_skia_reps[i].sk_bitmap(), false, &png_bytes->data())) {
png_reps.push_back(gfx::ImagePNGRep(png_bytes,
- resized_image_skia_reps[i].scale_factor()));
+ resized_image_skia_reps[i].scale()));
}
}
« no previous file with comments | « chrome/browser/favicon/favicon_service.cc ('k') | chrome/browser/history/select_favicon_frames.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698