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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "skia/ext/canvas_paint_common.h" | 9 #include "skia/ext/canvas_paint_common.h" |
10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 } | 102 } |
103 | 103 |
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 CHECK(canvas->initialize(width, height, opaque, NULL)); | 112 if (!canvas->initialize(width, height, opaque, NULL)) { |
| 113 // Cause a deliberate crash; |
| 114 *(char*) 0 = 0; |
| 115 } |
113 | 116 |
114 // This will bring the canvas into the screen coordinate system for the | 117 // This will bring the canvas into the screen coordinate system for the |
115 // dirty rect | 118 // dirty rect |
116 canvas->translate(SkIntToScalar(-ps_.rcPaint.left), | 119 canvas->translate(SkIntToScalar(-ps_.rcPaint.left), |
117 SkIntToScalar(-ps_.rcPaint.top)); | 120 SkIntToScalar(-ps_.rcPaint.top)); |
118 } | 121 } |
119 | 122 |
120 // If true, this canvas was created for a BeginPaint. | 123 // If true, this canvas was created for a BeginPaint. |
121 const bool for_paint_; | 124 const bool for_paint_; |
122 | 125 |
123 // Disallow copy and assign. | 126 // Disallow copy and assign. |
124 CanvasPaintT(const CanvasPaintT&); | 127 CanvasPaintT(const CanvasPaintT&); |
125 CanvasPaintT& operator=(const CanvasPaintT&); | 128 CanvasPaintT& operator=(const CanvasPaintT&); |
126 }; | 129 }; |
127 | 130 |
128 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; | 131 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; |
129 | 132 |
130 } // namespace skia | 133 } // namespace skia |
131 | 134 |
132 #endif // SKIA_EXT_CANVAS_PAINT_WIN_H_ | 135 #endif // SKIA_EXT_CANVAS_PAINT_WIN_H_ |
OLD | NEW |