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

Unified Diff: chrome/browser/ui/app_list/arc/arc_app_icon.cc

Issue 2915963002: [Merge M60] arg: Support non-standard display scale factors. (Closed)
Patch Set: Created 3 years, 7 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/ui/app_list/arc/arc_app_icon.h ('k') | chrome/browser/ui/app_list/arc/arc_app_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/app_list/arc/arc_app_icon.cc
diff --git a/chrome/browser/ui/app_list/arc/arc_app_icon.cc b/chrome/browser/ui/app_list/arc/arc_app_icon.cc
index 58c183d2bf27afd118050772006649b0ebbf3328..18bbb75da5ce01f614986953e53bf363517df6ce 100644
--- a/chrome/browser/ui/app_list/arc/arc_app_icon.cc
+++ b/chrome/browser/ui/app_list/arc/arc_app_icon.cc
@@ -213,11 +213,7 @@ void ArcAppIcon::DecodeRequest::OnImageDecoded(const SkBitmap& bitmap) {
return;
}
- gfx::ImageSkia image_skia;
- image_skia.AddRepresentation(gfx::ImageSkiaRep(
- bitmap,
- ui::GetScaleForScaleFactor(scale_factor_)));
- host_->Update(&image_skia);
+ host_->Update(scale_factor_, bitmap);
host_->DiscardDecodeRequest(this);
}
@@ -361,17 +357,15 @@ void ArcAppIcon::OnIconRead(
}
}
-void ArcAppIcon::Update(const gfx::ImageSkia* image) {
+void ArcAppIcon::Update(ui::ScaleFactor scale_factor, const SkBitmap& bitmap) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
- CHECK(image && !image->isNull());
- std::vector<gfx::ImageSkiaRep> reps = image->image_reps();
- for (const auto& image_rep : reps) {
- if (ui::IsSupportedScale(image_rep.scale())) {
- image_skia_.RemoveRepresentation(image_rep.scale());
- image_skia_.AddRepresentation(image_rep);
- }
- }
+ gfx::ImageSkiaRep image_rep(bitmap, ui::GetScaleForScaleFactor(scale_factor));
+ DCHECK(ui::IsSupportedScale(image_rep.scale()));
+
+ image_skia_.RemoveRepresentation(image_rep.scale());
+ image_skia_.AddRepresentation(image_rep);
+ image_skia_.RemoveUnsupportedRepresentationsForScale(image_rep.scale());
observer_->OnIconUpdated(this);
}
« no previous file with comments | « chrome/browser/ui/app_list/arc/arc_app_icon.h ('k') | chrome/browser/ui/app_list/arc/arc_app_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698