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