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 SKIA_EXT_CANVAS_PAINT_WIN_H_ | 5 #ifndef SKIA_EXT_CANVAS_PAINT_WIN_H_ |
6 #define SKIA_EXT_CANVAS_PAINT_WIN_H_ | 6 #define SKIA_EXT_CANVAS_PAINT_WIN_H_ |
7 | 7 |
8 #include "skia/ext/canvas_paint_common.h" | 8 #include "skia/ext/canvas_paint_common.h" |
9 #include "skia/ext/platform_canvas.h" | 9 #include "skia/ext/platform_canvas.h" |
10 | 10 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 void init(bool opaque) { | 104 void init(bool opaque) { |
105 PlatformCanvas* canvas = GetPlatformCanvas(this); | 105 PlatformCanvas* canvas = GetPlatformCanvas(this); |
106 // FIXME(brettw) for ClearType, we probably want to expand the bounds of | 106 // FIXME(brettw) for ClearType, we probably want to expand the bounds of |
107 // painting by one pixel so that the boundaries will be correct (ClearType | 107 // painting by one pixel so that the boundaries will be correct (ClearType |
108 // text can depend on the adjacent pixel). Then we would paint just the | 108 // text can depend on the adjacent pixel). Then we would paint just the |
109 // inset pixels to the screen. | 109 // inset pixels to the screen. |
110 const int width = ps_.rcPaint.right - ps_.rcPaint.left; | 110 const int width = ps_.rcPaint.right - ps_.rcPaint.left; |
111 const int height = ps_.rcPaint.bottom - ps_.rcPaint.top; | 111 const int height = ps_.rcPaint.bottom - ps_.rcPaint.top; |
112 if (!canvas->initialize(width, height, opaque, NULL)) { | 112 if (!canvas->initialize(width, height, opaque, NULL)) { |
113 // Cause a deliberate crash; | 113 // Cause a deliberate crash; |
114 *(char*) 0 = 0; | 114 __debugbreak(); |
| 115 _exit(1); |
115 } | 116 } |
116 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); | 117 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); |
117 | 118 |
118 // This will bring the canvas into the screen coordinate system for the | 119 // This will bring the canvas into the screen coordinate system for the |
119 // dirty rect | 120 // dirty rect |
120 canvas->translate(SkIntToScalar(-ps_.rcPaint.left), | 121 canvas->translate(SkIntToScalar(-ps_.rcPaint.left), |
121 SkIntToScalar(-ps_.rcPaint.top)); | 122 SkIntToScalar(-ps_.rcPaint.top)); |
122 } | 123 } |
123 | 124 |
124 // If true, this canvas was created for a BeginPaint. | 125 // If true, this canvas was created for a BeginPaint. |
125 const bool for_paint_; | 126 const bool for_paint_; |
126 | 127 |
127 // Disallow copy and assign. | 128 // Disallow copy and assign. |
128 CanvasPaintT(const CanvasPaintT&); | 129 CanvasPaintT(const CanvasPaintT&); |
129 CanvasPaintT& operator=(const CanvasPaintT&); | 130 CanvasPaintT& operator=(const CanvasPaintT&); |
130 }; | 131 }; |
131 | 132 |
132 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; | 133 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; |
133 | 134 |
134 } // namespace skia | 135 } // namespace skia |
135 | 136 |
136 #endif // SKIA_EXT_CANVAS_PAINT_WIN_H_ | 137 #endif // SKIA_EXT_CANVAS_PAINT_WIN_H_ |
OLD | NEW |