OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef UI_GFX_CANVAS_PAINT_WIN_H_ | 5 #ifndef UI_GFX_CANVAS_PAINT_WIN_H_ |
6 #define UI_GFX_CANVAS_PAINT_WIN_H_ | 6 #define UI_GFX_CANVAS_PAINT_WIN_H_ |
7 | 7 |
8 #include "skia/ext/platform_canvas.h" | 8 #include "skia/ext/platform_canvas.h" |
9 #include "ui/base/win/dpi.h" | 9 #include "ui/base/win/dpi.h" |
10 #include "ui/gfx/canvas.h" | 10 #include "ui/gfx/canvas.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 RecreateBackingCanvas(gfx::Size(width, height), | 114 RecreateBackingCanvas(gfx::Size(width, height), |
115 ui::GetScaleFactorFromScale(ui::win::GetDeviceScaleFactor()), | 115 ui::GetScaleFactorFromScale(ui::win::GetDeviceScaleFactor()), |
116 opaque); | 116 opaque); |
117 skia::PlatformCanvas* canvas = platform_canvas(); | 117 skia::PlatformCanvas* canvas = platform_canvas(); |
118 | 118 |
119 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); | 119 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); |
120 | 120 |
121 // This will bring the canvas into the screen coordinate system for the | 121 // This will bring the canvas into the screen coordinate system for the |
122 // dirty rect | 122 // dirty rect |
123 canvas->translate( | 123 canvas->translate( |
124 SkScalarRoundToInt(-ps_.rcPaint.left/ui::win::GetDeviceScaleFactor()), | 124 -ps_.rcPaint.left/ui::win::GetDeviceScaleFactor(), |
125 SkScalarRoundToInt(-ps_.rcPaint.top/ui::win::GetDeviceScaleFactor())); | 125 -ps_.rcPaint.top/ui::win::GetDeviceScaleFactor()); |
126 } | 126 } |
127 | 127 |
128 // If true, this canvas was created for a BeginPaint. | 128 // If true, this canvas was created for a BeginPaint. |
129 const bool for_paint_; | 129 const bool for_paint_; |
130 | 130 |
131 // Disallow copy and assign. | 131 // Disallow copy and assign. |
132 CanvasSkiaPaint(const CanvasSkiaPaint&); | 132 CanvasSkiaPaint(const CanvasSkiaPaint&); |
133 CanvasSkiaPaint& operator=(const CanvasSkiaPaint&); | 133 CanvasSkiaPaint& operator=(const CanvasSkiaPaint&); |
134 }; | 134 }; |
135 | 135 |
136 } // namespace gfx | 136 } // namespace gfx |
137 | 137 |
138 #endif // UI_GFX_CANVAS_PAINT_WIN_H_ | 138 #endif // UI_GFX_CANVAS_PAINT_WIN_H_ |
OLD | NEW |