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

Unified Diff: ui/app_list/views/cached_label.cc

Issue 405373002: Use a correct scale factor in app_list::CachedLabel (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: call parent Created 6 years, 5 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 | « ui/app_list/views/cached_label.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/views/cached_label.cc
diff --git a/ui/app_list/views/cached_label.cc b/ui/app_list/views/cached_label.cc
index ea289f3008120b40426615095428c5c1c995fc4b..24a6f2ef83ea83320b1226a0a1d488e81fefc07c 100644
--- a/ui/app_list/views/cached_label.cc
+++ b/ui/app_list/views/cached_label.cc
@@ -5,8 +5,10 @@
#include "ui/app_list/views/cached_label.h"
#include "base/strings/utf_string_conversions.h"
+#include "ui/base/layout.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/gfx/canvas.h"
+#include "ui/views/widget/widget.h"
namespace app_list {
@@ -19,7 +21,9 @@ void CachedLabel::PaintToBackingImage() {
return;
bool is_opaque = SkColorGetA(background_color()) == 0xFF;
- gfx::Canvas canvas(size(), 1.0f, is_opaque);
+ float scale_factor =
+ ui::GetScaleFactorForNativeView(GetWidget()->GetNativeView());
+ gfx::Canvas canvas(size(), scale_factor, is_opaque);
// If a background is provided, it will initialize the canvas in
// View::OnPaintBackground(). Otherwise, the background must be set here.
if (!background()) {
@@ -38,4 +42,10 @@ void CachedLabel::OnPaint(gfx::Canvas* canvas) {
}
#endif
+void CachedLabel::OnDeviceScaleFactorChanged(
+ float device_scale_factor) {
+ Invalidate();
+ View::OnDeviceScaleFactorChanged(device_scale_factor);
+}
+
} // namespace app_list
« no previous file with comments | « ui/app_list/views/cached_label.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698