| OLD | NEW |
| 1 | 1 |
| 2 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 2 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 3 // Use of this source code is governed by a BSD-style license that can be | 3 // Use of this source code is governed by a BSD-style license that can be |
| 4 // found in the LICENSE file. | 4 // found in the LICENSE file. |
| 5 | 5 |
| 6 #ifndef SKIA_EXT_CANVAS_PAINT_MAC_H_ | 6 #ifndef SKIA_EXT_CANVAS_PAINT_MAC_H_ |
| 7 #define SKIA_EXT_CANVAS_PAINT_MAC_H_ | 7 #define SKIA_EXT_CANVAS_PAINT_MAC_H_ |
| 8 #pragma once | 8 #pragma once |
| 9 | 9 |
| 10 #include "skia/ext/platform_canvas.h" | 10 #include "skia/ext/platform_canvas.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 | 78 |
| 79 const NSRect& rectangle() const { | 79 const NSRect& rectangle() const { |
| 80 return rectangle_; | 80 return rectangle_; |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 void init(bool opaque) { | 84 void init(bool opaque) { |
| 85 if (!T::initialize(rectangle_.size.width, rectangle_.size.height, | 85 if (!T::initialize(rectangle_.size.width, rectangle_.size.height, |
| 86 opaque, NULL)) { | 86 opaque, NULL)) { |
| 87 // Cause a deliberate crash; | 87 // Cause a deliberate crash; |
| 88 *(char*) 0 = 0; | 88 *(volatile char*) 0 = 0; |
| 89 } | 89 } |
| 90 | 90 |
| 91 // Need to translate so that the dirty region appears at the origin of the | 91 // Need to translate so that the dirty region appears at the origin of the |
| 92 // surface. | 92 // surface. |
| 93 T::translate(-SkIntToScalar(rectangle_.origin.x), | 93 T::translate(-SkIntToScalar(rectangle_.origin.x), |
| 94 -SkIntToScalar(rectangle_.origin.y)); | 94 -SkIntToScalar(rectangle_.origin.y)); |
| 95 | 95 |
| 96 context_ = T::getTopPlatformDevice().GetBitmapContext(); | 96 context_ = T::getTopPlatformDevice().GetBitmapContext(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 CGContext* context_; | 99 CGContext* context_; |
| 100 NSRect rectangle_; | 100 NSRect rectangle_; |
| 101 // See description above setter. | 101 // See description above setter. |
| 102 bool composite_alpha_; | 102 bool composite_alpha_; |
| 103 | 103 |
| 104 // Disallow copy and assign. | 104 // Disallow copy and assign. |
| 105 CanvasPaintT(const CanvasPaintT&); | 105 CanvasPaintT(const CanvasPaintT&); |
| 106 CanvasPaintT& operator=(const CanvasPaintT&); | 106 CanvasPaintT& operator=(const CanvasPaintT&); |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; | 109 typedef CanvasPaintT<PlatformCanvas> PlatformCanvasPaint; |
| 110 | 110 |
| 111 } // namespace skia | 111 } // namespace skia |
| 112 | 112 |
| 113 | 113 |
| 114 #endif // SKIA_EXT_CANVAS_PAINT_MAC_H_ | 114 #endif // SKIA_EXT_CANVAS_PAINT_MAC_H_ |
| OLD | NEW |