OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 BASE_GFX_PLATFORM_CANVAS_MAC_H__ | 5 #ifndef PlatformCanvasMac_h |
6 #define BASE_GFX_PLATFORM_CANVAS_MAC_H__ | 6 #define PlatformCanvasMac_h |
7 | 7 |
8 #include "base/gfx/platform_device_mac.h" | 8 #include "PlatformDeviceMac.h" |
9 #include "base/basictypes.h" | |
10 | 9 |
11 #import "SkCanvas.h" | 10 #include "SkCanvas.h" |
12 | 11 |
13 namespace gfx { | 12 namespace gfx { |
14 | 13 |
15 // This class is a specialization of the regular SkCanvas that is designed to | 14 // This class is a specialization of the regular SkCanvas that is designed to |
16 // work with a gfx::PlatformDevice to manage platform-specific drawing. It | 15 // work with a gfx::PlatformDevice to manage platform-specific drawing. It |
17 // allows using both Skia operations and platform-specific operations. | 16 // allows using both Skia operations and platform-specific operations. |
18 class PlatformCanvasMac : public SkCanvas { | 17 class PlatformCanvasMac : public SkCanvas { |
19 public: | 18 public: |
20 // Set is_opaque if you are going to erase the bitmap and not use | 19 // Set is_opaque if you are going to erase the bitmap and not use |
21 // tranparency: this will enable some optimizations. The shared_section | 20 // tranparency: this will enable some optimizations. The shared_section |
(...skipping 16 matching lines...) Loading... |
38 virtual CGContextRef beginPlatformPaint(); | 37 virtual CGContextRef beginPlatformPaint(); |
39 virtual void endPlatformPaint(); | 38 virtual void endPlatformPaint(); |
40 | 39 |
41 // Returns the platform device pointer of the topmost rect with a non-empty | 40 // Returns the platform device pointer of the topmost rect with a non-empty |
42 // clip. In practice, this is usually either the top layer or nothing, since | 41 // clip. In practice, this is usually either the top layer or nothing, since |
43 // we usually set the clip to new layers when we make them. | 42 // we usually set the clip to new layers when we make them. |
44 // | 43 // |
45 // If there is no layer that is not all clipped out, this will return a | 44 // If there is no layer that is not all clipped out, this will return a |
46 // dummy device so callers do not have to check. If you are concerned about | 45 // dummy device so callers do not have to check. If you are concerned about |
47 // performance, check the clip before doing any painting. | 46 // performance, check the clip before doing any painting. |
48 // | 47 // |
49 // This is different than SkCanvas' getDevice, because that returns the | 48 // This is different than SkCanvas' getDevice, because that returns the |
50 // bottommost device. | 49 // bottommost device. |
51 // | 50 // |
52 // Danger: the resulting device should not be saved. It will be invalidated | 51 // Danger: the resulting device should not be saved. It will be invalidated |
53 // by the next call to save() or restore(). | 52 // by the next call to save() or restore(). |
54 PlatformDeviceMac& getTopPlatformDevice() const; | 53 PlatformDeviceMac& getTopPlatformDevice() const; |
55 | 54 |
56 // Allow callers to see the non-virtual function even though we have an | 55 // Allow callers to see the non-virtual function even though we have an |
57 // override of a virtual one. | 56 // override of a virtual one. |
58 using SkCanvas::clipRect; | 57 using SkCanvas::clipRect; |
(...skipping 12 matching lines...) Loading... |
71 | 70 |
72 private: | 71 private: |
73 // Unimplemented. This is to try to prevent people from calling this function | 72 // Unimplemented. This is to try to prevent people from calling this function |
74 // on SkCanvas. SkCanvas' version is not virtual, so we can't prevent this | 73 // on SkCanvas. SkCanvas' version is not virtual, so we can't prevent this |
75 // 100%, but hopefully this will make people notice and not use the function. | 74 // 100%, but hopefully this will make people notice and not use the function. |
76 // Calling SkCanvas' version will create a new device which is not compatible | 75 // Calling SkCanvas' version will create a new device which is not compatible |
77 // with us and we will crash if somebody tries to draw into it with | 76 // with us and we will crash if somebody tries to draw into it with |
78 // CoreGraphics. | 77 // CoreGraphics. |
79 SkDevice* setBitmapDevice(const SkBitmap& bitmap); | 78 SkDevice* setBitmapDevice(const SkBitmap& bitmap); |
80 | 79 |
81 DISALLOW_COPY_AND_ASSIGN(PlatformCanvasMac); | 80 // Disallow copy and assign. |
| 81 PlatformCanvasMac(const PlatformCanvasMac&); |
| 82 PlatformCanvasMac& operator=(const PlatformCanvasMac&); |
82 }; | 83 }; |
83 | 84 |
84 } // namespace gfx | 85 } // namespace gfx |
85 | 86 |
86 #endif // BASE_GFX_PLATFORM_CANVAS_MAC_H__ | 87 #endif // PlatformCanvasMac_h |
87 | 88 |
OLD | NEW |