Chromium Code Reviews| 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 NOTREACHED(); |
|
Stephen White
2012/09/26 14:48:27
I've never really looked at NOTREACHED() before, b
| |
| 115 } | 115 } |
| 116 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); | 116 canvas->clear(SkColorSetARGB(0, 0, 0, 0)); |
| 117 | 117 |
| 118 // This will bring the canvas into the screen coordinate system for the | 118 // This will bring the canvas into the screen coordinate system for the |
| 119 // dirty rect | 119 // dirty rect |
| 120 canvas->translate(SkIntToScalar(-ps_.rcPaint.left), | 120 canvas->translate(SkIntToScalar(-ps_.rcPaint.left), |
| 121 SkIntToScalar(-ps_.rcPaint.top)); | 121 SkIntToScalar(-ps_.rcPaint.top)); |
| 122 } | 122 } |
| 123 | 123 |
| 124 // If true, this canvas was created for a BeginPaint. | 124 // If true, this canvas was created for a BeginPaint. |
| 125 const bool for_paint_; | 125 const bool for_paint_; |
| 126 | 126 |
| 127 // Disallow copy and assign. | 127 // Disallow copy and assign. |
| 128 CanvasPaintT(const CanvasPaintT&); | 128 CanvasPaintT(const CanvasPaintT&); |
| 129 CanvasPaintT& operator=(const CanvasPaintT&); | 129 CanvasPaintT& operator=(const CanvasPaintT&); |
| 130 }; | 130 }; |
| 131 | 131 |
| 132 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; | 132 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; |
| 133 | 133 |
| 134 } // namespace skia | 134 } // namespace skia |
| 135 | 135 |
| 136 #endif // SKIA_EXT_CANVAS_PAINT_WIN_H_ | 136 #endif // SKIA_EXT_CANVAS_PAINT_WIN_H_ |
| OLD | NEW |