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

Unified Diff: chrome/browser/ui/views/elevation_icon_setter.cc

Issue 849543003: Make elevation icon size correct in different DPI settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix build error Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/elevation_icon_setter.cc
diff --git a/chrome/browser/ui/views/elevation_icon_setter.cc b/chrome/browser/ui/views/elevation_icon_setter.cc
index 99912883269f0eaf945133d24f2ba5d8491f0759..6b6c8aa25e2b3de2148e3863259f4a3daf001ede 100644
--- a/chrome/browser/ui/views/elevation_icon_setter.cc
+++ b/chrome/browser/ui/views/elevation_icon_setter.cc
@@ -14,6 +14,7 @@
#include "base/win/win_util.h"
#include "base/win/windows_version.h"
#include "ui/gfx/icon_util.h"
+#include "ui/gfx/win/dpi.h"
#endif
@@ -71,8 +72,13 @@ ElevationIconSetter::~ElevationIconSetter() {
void ElevationIconSetter::SetButtonIcon(scoped_ptr<SkBitmap> icon) {
if (icon) {
- button_->SetImage(views::Button::STATE_NORMAL,
- gfx::ImageSkia::CreateFrom1xBitmap(*icon));
+ float device_scale_factor = 1.0f;
+#if defined(OS_WIN)
+ device_scale_factor = gfx::GetDPIScale();
Peter Kasting 2015/01/21 20:18:37 Actually you might want a comment here like: Wind
xiaoling 2015/01/21 20:23:34 Done.
+#endif
+ button_->SetImage(
+ views::Button::STATE_NORMAL,
+ gfx::ImageSkia(gfx::ImageSkiaRep(*icon, device_scale_factor)));
button_->SizeToPreferredSize();
if (button_->parent())
button_->parent()->Layout();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698