Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ui / app_list / views / cached_label.cc
index ea289f3..4499842 100644 (file)
@@ -5,8 +5,9 @@
 #include "ui/app_list/views/cached_label.h"
 
 #include "base/strings/utf_string_conversions.h"
-#include "ui/base/resource/resource_bundle.h"
+#include "ui/base/layout.h"
 #include "ui/gfx/canvas.h"
+#include "ui/views/widget/widget.h"
 
 namespace app_list {
 
@@ -19,7 +20,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 +41,10 @@ void CachedLabel::OnPaint(gfx::Canvas* canvas) {
 }
 #endif
 
+void CachedLabel::OnDeviceScaleFactorChanged(
+    float device_scale_factor) {
+  Invalidate();
+  View::OnDeviceScaleFactorChanged(device_scale_factor);
+}
+
 }  // namespace app_list