Commit 4d617d01 authored by ananta@chromium.org's avatar ananta@chromium.org

Fix extension icons showing up with incorrect size on Chrome HiDPI Windows...

Fix extension icons showing up with incorrect size on Chrome HiDPI Windows with scales of 150% and above.

The extension sources associated with icons were using the ui::GetImageScale function which returns the dpi scale
on Windows HiDPI. Fix is to use the GetScaleForScaleFactor function instead.

BUG=375461
R=oshima

Review URL: https://codereview.chromium.org/297763004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271856 0039d316-1c4b-4281-b951-d872f2087c98
parent 6c9bedf7
......@@ -186,7 +186,7 @@ void SetDefaultsFromValue(const base::DictionaryValue* dict,
if (icon_value->GetString(kIconSizes[i].size_string, &str_value) &&
StringToSkBitmap(str_value, &bitmap)) {
CHECK(!bitmap.isNull());
float scale = ui::GetImageScale(kIconSizes[i].scale);
float scale = ui::GetScaleForScaleFactor(kIconSizes[i].scale);
icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale));
}
}
......@@ -216,7 +216,7 @@ scoped_ptr<base::DictionaryValue> DefaultsToValue(ExtensionAction* action) {
if (!icon.isNull()) {
base::DictionaryValue* icon_value = new base::DictionaryValue();
for (size_t i = 0; i < arraysize(kIconSizes); i++) {
float scale = ui::GetImageScale(kIconSizes[i].scale);
float scale = ui::GetScaleForScaleFactor(kIconSizes[i].scale);
if (icon.HasRepresentation(scale)) {
icon_value->SetString(
kIconSizes[i].size_string,
......@@ -681,7 +681,7 @@ bool ExtensionActionSetIconFunction::RunExtensionAction() {
SkBitmap bitmap;
EXTENSION_FUNCTION_VALIDATE(IPC::ReadParam(&pickle, &iter, &bitmap));
CHECK(!bitmap.isNull());
float scale = ui::GetImageScale(kIconSizes[i].scale);
float scale = ui::GetScaleForScaleFactor(kIconSizes[i].scale);
icon.AddRepresentation(gfx::ImageSkiaRep(bitmap, scale));
}
}
......
......@@ -164,7 +164,7 @@ gfx::ImageSkiaRep IconImage::LoadImageForScaleFactor(
if (!extension_)
return gfx::ImageSkiaRep();
const float scale = ui::GetImageScale(scale_factor);
const float scale = ui::GetScaleForScaleFactor(scale_factor);
const int resource_size_in_pixel =
static_cast<int>(resource_size_in_dip_ * scale);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment