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

Unified Diff: ui/gfx/canvas_paint_win.h

Issue 12257016: (Not ready for review!) Toolbar and views high dpi support. Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Cleaned up more useless diffs. Created 7 years, 10 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/gfx/canvas.cc ('k') | ui/gfx/display.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« no previous file with comments | « ui/gfx/canvas.cc ('k') | ui/gfx/display.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698