Commit 5d2ce5fc authored by Qiang Xu's avatar Qiang Xu Committed by Commit Bot

app_list: resize launcher search icon image to proper size

context:
In crbug.com/490597, 2x image is used for HiDPI blur issue. Then there
is a CL "Migrate LauncherSearchResult to use SetBadgeIcon", 
https://codereview.chromium.org/1200543003, which I think it removes
the proper handling of the size of this 2x loading.

changes:
When custom icon is loaded, resize it to proper size.

HiDPI screenshot: https://screenshot.googleplex.com/2rWk8akUx99

Test: tested that it works fine now,
screenshot: https://screenshot.googleplex.com/u9BapUpenhu
Bug: 723021
Change-Id: If18a59e7aaeed48e9a0e88409f8672d057eb986a
Reviewed-on: https://chromium-review.googlesource.com/592415Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarYuki Awano <yawano@chromium.org>
Commit-Queue: Qiang(Joe) Xu <warx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#490707}
parent 0f3fc0e0
......@@ -38,8 +38,7 @@ LauncherSearchIconImageLoader::LauncherSearchIconImageLoader(
icon_size_(icon_dimension, icon_dimension),
error_reporter_(std::move(error_reporter)) {}
LauncherSearchIconImageLoader::~LauncherSearchIconImageLoader() {
}
LauncherSearchIconImageLoader::~LauncherSearchIconImageLoader() = default;
void LauncherSearchIconImageLoader::LoadResources() {
DCHECK(custom_icon_image_.isNull());
......@@ -69,7 +68,6 @@ void LauncherSearchIconImageLoader::LoadResources() {
return;
}
// Update() is called when custom icon is loaded.
LoadIconResourceFromExtension();
}
......@@ -127,7 +125,8 @@ void LauncherSearchIconImageLoader::OnCustomIconLoaded(
}
const bool previously_unbadged = custom_icon_image_.isNull();
custom_icon_image_ = image;
custom_icon_image_ = gfx::ImageSkiaOperations::CreateResizedImage(
image, skia::ImageOperations::RESIZE_BEST, icon_size_);
NotifyObserversIconImageChange();
// If custom_icon_image_ is not set before, extension icon moves from main
......
......@@ -27,8 +27,8 @@ LauncherSearchIconImageLoaderImpl::LauncherSearchIconImageLoaderImpl(
std::move(error_reporter)),
weak_ptr_factory_(this) {}
LauncherSearchIconImageLoaderImpl::~LauncherSearchIconImageLoaderImpl() {
}
LauncherSearchIconImageLoaderImpl::~LauncherSearchIconImageLoaderImpl() =
default;
const gfx::ImageSkia& LauncherSearchIconImageLoaderImpl::LoadExtensionIcon() {
extension_icon_image_.reset(new extensions::IconImage(
......@@ -44,8 +44,7 @@ void LauncherSearchIconImageLoaderImpl::LoadIconResourceFromExtension() {
const extensions::ExtensionResource& resource =
extension_->GetResource(file_path);
// Load image as scale factor 2.0. Resizing image to proper size depending on
// DPI is done in BadgedIconSource.
// Load image as scale factor 2.0 (crbug.com/490597).
std::vector<extensions::ImageLoader::ImageRepresentation> info_list;
info_list.push_back(extensions::ImageLoader::ImageRepresentation(
resource, extensions::ImageLoader::ImageRepresentation::ALWAYS_RESIZE,
......
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