OLD | NEW |
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 Loading... |
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 |
OLD | NEW |