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

Unified Diff: ui/gfx/canvas_paint_win.h

Issue 16336027: Enable high dpi in win/views. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 years, 6 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/base/win/events_win.cc ('k') | ui/views/controls/native/native_view_host_win.cc » ('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..520bdcc482de1001fe59fa2f17b304ce56e35679 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"
@@ -110,16 +111,18 @@ class UI_EXPORT CanvasSkiaPaint : public Canvas {
const int width = ps_.rcPaint.right - ps_.rcPaint.left;
const int height = ps_.rcPaint.bottom - ps_.rcPaint.top;
- RecreateBackingCanvas(gfx::Size(width, height), ui::SCALE_FACTOR_100P,
- opaque);
+ RecreateBackingCanvas(gfx::Size(width, height),
+ ui::GetScaleFactorFromScale(ui::win::GetDeviceScaleFactor()),
+ opaque);
skia::PlatformCanvas* canvas = platform_canvas();
canvas->clear(SkColorSetARGB(0, 0, 0, 0));
// This will bring the canvas into the screen coordinate system for the
// dirty rect
- canvas->translate(SkIntToScalar(-ps_.rcPaint.left),
- SkIntToScalar(-ps_.rcPaint.top));
+ canvas->translate(
+ SkScalarRoundToInt(-ps_.rcPaint.left/ui::win::GetDeviceScaleFactor()),
+ SkScalarRoundToInt(-ps_.rcPaint.top/ui::win::GetDeviceScaleFactor()));
}
// If true, this canvas was created for a BeginPaint.
« no previous file with comments | « ui/base/win/events_win.cc ('k') | ui/views/controls/native/native_view_host_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698