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

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: Rename methods and vars to make image_scale more clear 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/favicon/favicon_util.cc
diff --git a/chrome/browser/favicon/favicon_util.cc b/chrome/browser/favicon/favicon_util.cc
index 4d7dff2414a967026b4d1aed19c95608f30f228d..7dd074168284fb1f2853814a5ec2e1d37fb70fb9 100644
--- a/chrome/browser/favicon/favicon_util.cc
+++ b/chrome/browser/favicon/favicon_util.cc
@@ -42,18 +42,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];
}
@@ -70,7 +69,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;
@@ -80,7 +81,7 @@ std::vector<gfx::ImagePNGRep> SelectFaviconFramesFromPNGsWithoutResizing(
// 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();
@@ -89,7 +90,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) {
@@ -144,7 +145,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);
}
@@ -181,7 +182,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()));
}
}

Powered by Google App Engine
This is Rietveld 408576698