Index: ui/gfx/canvas_paint_win.h |
diff --git a/ui/gfx/canvas_paint_win.h b/ui/gfx/canvas_paint_win.h |
index 1316b9616bd7f0e719c4e7a0c14d62ea81ed7100..2c963b88381f7aec4c0367a39921234ae7358a28 100644 |
--- a/ui/gfx/canvas_paint_win.h |
+++ b/ui/gfx/canvas_paint_win.h |
@@ -6,6 +6,7 @@ |
#define UI_GFX_CANVAS_PAINT_WIN_H_ |
#include "skia/ext/platform_canvas.h" |
+#include "ui/base/win/dpi.h" |
#include "ui/gfx/canvas.h" |
#include "ui/gfx/canvas_paint.h" |
#include "ui/gfx/size.h" |
@@ -102,6 +103,17 @@ class UI_EXPORT CanvasSkiaPaint : public Canvas { |
init(opaque); |
} |
+#if defined(ENABLE_HIDPI) |
+ static ui::ScaleFactor GetScaleFactor() { |
+ float scale = ui::GetDPIScale(); |
+ if (scale > 1.6) |
+ return ui::SCALE_FACTOR_180P; |
+ else if (scale > 1.2) |
+ return ui::SCALE_FACTOR_140P; |
+ return ui::SCALE_FACTOR_100P; |
+ } |
+#endif |
+ |
void init(bool opaque) { |
// FIXME(brettw) for ClearType, we probably want to expand the bounds of |
// painting by one pixel so that the boundaries will be correct (ClearType |
@@ -109,9 +121,13 @@ class UI_EXPORT CanvasSkiaPaint : public Canvas { |
// inset pixels to the screen. |
const int width = ps_.rcPaint.right - ps_.rcPaint.left; |
const int height = ps_.rcPaint.bottom - ps_.rcPaint.top; |
- |
+#if defined(ENABLE_HIDPI) |
+ RecreateBackingCanvas(gfx::Size(width, height), GetScaleFactor(), |
+ opaque); |
+#else |
RecreateBackingCanvas(gfx::Size(width, height), ui::SCALE_FACTOR_100P, |
opaque); |
+#endif |
skia::PlatformCanvas* canvas = platform_canvas(); |
canvas->clear(SkColorSetARGB(0, 0, 0, 0)); |