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

Side by Side Diff: ui/gfx/canvas_paint_win.cc

Issue 659883002: Enable hidpi on Linux, refactor a bit on Windows to share Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: constants Created 6 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/compiler_specific.h" 6 #include "base/compiler_specific.h"
7 #include "ui/gfx/canvas.h" 7 #include "ui/gfx/canvas.h"
8 #include "ui/gfx/canvas_skia_paint.h" 8 #include "ui/gfx/canvas_skia_paint.h"
9 #include "ui/gfx/rect.h" 9 #include "ui/gfx/rect.h"
10 10
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 } 48 }
49 49
50 void CanvasSkiaPaint::Init(bool opaque) { 50 void CanvasSkiaPaint::Init(bool opaque) {
51 // FIXME(brettw) for ClearType, we probably want to expand the bounds of 51 // FIXME(brettw) for ClearType, we probably want to expand the bounds of
52 // painting by one pixel so that the boundaries will be correct (ClearType 52 // painting by one pixel so that the boundaries will be correct (ClearType
53 // text can depend on the adjacent pixel). Then we would paint just the 53 // text can depend on the adjacent pixel). Then we would paint just the
54 // inset pixels to the screen. 54 // inset pixels to the screen.
55 const int width = ps_.rcPaint.right - ps_.rcPaint.left; 55 const int width = ps_.rcPaint.right - ps_.rcPaint.left;
56 const int height = ps_.rcPaint.bottom - ps_.rcPaint.top; 56 const int height = ps_.rcPaint.bottom - ps_.rcPaint.top;
57 57
58 RecreateBackingCanvas(gfx::Size(width, height), 58 RecreateBackingCanvas(
59 gfx::win::GetDeviceScaleFactor(), 59 gfx::Size(width, height), gfx::GetDeviceScaleFactor(), opaque);
60 opaque);
61 skia::PlatformCanvas* canvas = platform_canvas(); 60 skia::PlatformCanvas* canvas = platform_canvas();
62 61
63 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); 62 canvas->clear(SkColorSetARGB(0, 0, 0, 0));
64 63
65 // This will bring the canvas into the screen coordinate system for the 64 // This will bring the canvas into the screen coordinate system for the
66 // dirty rect 65 // dirty rect
67 canvas->translate( 66 canvas->translate(-ps_.rcPaint.left / gfx::GetDeviceScaleFactor(),
68 -ps_.rcPaint.left / gfx::win::GetDeviceScaleFactor(), 67 -ps_.rcPaint.top / gfx::GetDeviceScaleFactor());
69 -ps_.rcPaint.top / gfx::win::GetDeviceScaleFactor());
70 } 68 }
71 69
72 } // namespace gfx 70 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/canvas_paint_win.h ('k') | ui/gfx/dpi.h » ('j') | ui/gfx/dpi.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698