OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 BASE_GFX_PLATFORM_CANVAS_WIN_H_ | 5 #ifndef PlatformCanvasWin_h |
6 #define BASE_GFX_PLATFORM_CANVAS_WIN_H_ | 6 #define PlatformCanvasWin_h |
7 | 7 |
8 #include "base/gfx/platform_device_win.h" | 8 #include <windows.h> |
| 9 |
| 10 #include "PlatformDeviceWin.h" |
9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
10 | 12 |
11 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
12 | 14 |
13 namespace gfx { | 15 namespace gfx { |
14 | 16 |
15 // This class is a specialization of the regular SkCanvas that is designed to | 17 // This class is a specialization of the regular SkCanvas that is designed to |
16 // work with a gfx::PlatformDevice to manage platform-specific drawing. It | 18 // work with a gfx::PlatformDevice to manage platform-specific drawing. It |
17 // allows using both Skia operations and platform-specific operations. | 19 // allows using both Skia operations and platform-specific operations. |
18 class PlatformCanvasWin : public SkCanvas { | 20 class PlatformCanvasWin : public SkCanvas { |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 67 |
66 // Creates a device store for use by the canvas. By default, it creates a | 68 // Creates a device store for use by the canvas. By default, it creates a |
67 // BitmapPlatformDeviceWin. Can be overridden to change the object type. | 69 // BitmapPlatformDeviceWin. Can be overridden to change the object type. |
68 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque, | 70 virtual SkDevice* createPlatformDevice(int width, int height, bool is_opaque, |
69 HANDLE shared_section); | 71 HANDLE shared_section); |
70 | 72 |
71 private: | 73 private: |
72 // Unimplemented. | 74 // Unimplemented. |
73 virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap); | 75 virtual SkDevice* setBitmapDevice(const SkBitmap& bitmap); |
74 | 76 |
75 DISALLOW_COPY_AND_ASSIGN(PlatformCanvasWin); | 77 // Disallow copy and assign. |
| 78 PlatformCanvasWin(const PlatformCanvasWin&); |
| 79 PlatformCanvasWin& operator=(const PlatformCanvasWin&); |
76 }; | 80 }; |
77 | 81 |
78 // A class designed to help with WM_PAINT operations on Windows. It will | 82 // A class designed to help with WM_PAINT operations on Windows. It will |
79 // do BeginPaint/EndPaint on init/destruction, and will create the bitmap and | 83 // do BeginPaint/EndPaint on init/destruction, and will create the bitmap and |
80 // canvas with the correct size and transform for the dirty rect. The bitmap | 84 // canvas with the correct size and transform for the dirty rect. The bitmap |
81 // will be automatically painted to the screen on destruction. | 85 // will be automatically painted to the screen on destruction. |
82 // | 86 // |
83 // You MUST call isEmpty before painting to determine if anything needs | 87 // You MUST call isEmpty before painting to determine if anything needs |
84 // painting. Sometimes the dirty rect can actually be empty, and this makes | 88 // painting. Sometimes the dirty rect can actually be empty, and this makes |
85 // the bitmap functions we call unhappy. The caller should not paint in this | 89 // the bitmap functions we call unhappy. The caller should not paint in this |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 | 182 |
179 // This will bring the canvas into the screen coordinate system for the | 183 // This will bring the canvas into the screen coordinate system for the |
180 // dirty rect | 184 // dirty rect |
181 translate(SkIntToScalar(-ps_.rcPaint.left), | 185 translate(SkIntToScalar(-ps_.rcPaint.left), |
182 SkIntToScalar(-ps_.rcPaint.top)); | 186 SkIntToScalar(-ps_.rcPaint.top)); |
183 } | 187 } |
184 | 188 |
185 // If true, this canvas was created for a BeginPaint. | 189 // If true, this canvas was created for a BeginPaint. |
186 const bool for_paint_; | 190 const bool for_paint_; |
187 | 191 |
188 DISALLOW_COPY_AND_ASSIGN(CanvasPaintT); | 192 // Disallow copy and assign. |
| 193 CanvasPaintT(const CanvasPaintT&); |
| 194 CanvasPaintT& operator=(const CanvasPaintT&); |
189 }; | 195 }; |
190 | 196 |
191 typedef CanvasPaintT<PlatformCanvasWin> PlatformCanvasWinPaint; | 197 typedef CanvasPaintT<PlatformCanvasWin> PlatformCanvasWinPaint; |
192 | 198 |
193 } // namespace gfx | 199 } // namespace gfx |
194 | 200 |
195 #endif // BASE_GFX_PLATFORM_CANVAS_WIN_H_ | 201 #endif // PlatformCanvasWin_h |
196 | 202 |
OLD | NEW |