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 SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ | 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ | 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "skia/ext/platform_device_mac.h" | 9 #include "skia/ext/platform_device_mac.h" |
10 | 10 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // the resulting CoreGraphics drawing state will be unpredictable. | 54 // the resulting CoreGraphics drawing state will be unpredictable. |
55 // | 55 // |
56 // Copy constucting and "=" is designed for saving the device or passing it | 56 // Copy constucting and "=" is designed for saving the device or passing it |
57 // around to another routine willing to deal with the bitmap data directly. | 57 // around to another routine willing to deal with the bitmap data directly. |
58 BitmapPlatformDevice(const BitmapPlatformDevice& other); | 58 BitmapPlatformDevice(const BitmapPlatformDevice& other); |
59 virtual ~BitmapPlatformDevice(); | 59 virtual ~BitmapPlatformDevice(); |
60 | 60 |
61 // See warning for copy constructor above. | 61 // See warning for copy constructor above. |
62 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); | 62 BitmapPlatformDevice& operator=(const BitmapPlatformDevice& other); |
63 | 63 |
| 64 // PlatformDevice overrides |
64 virtual CGContextRef GetBitmapContext(); | 65 virtual CGContextRef GetBitmapContext(); |
| 66 virtual void DrawToNativeContext(CGContextRef context, int x, int y, |
| 67 const CGRect* src_rect); |
| 68 virtual void MakeOpaque(int x, int y, int width, int height); |
| 69 virtual bool IsVectorial(); |
| 70 |
| 71 // SkDevice overrides |
65 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, | 72 virtual void setMatrixClip(const SkMatrix& transform, const SkRegion& region, |
66 const SkClipStack&); | 73 const SkClipStack&); |
67 | 74 |
68 virtual void DrawToContext(CGContextRef context, int x, int y, | |
69 const CGRect* src_rect); | |
70 virtual void makeOpaque(int x, int y, int width, int height); | |
71 virtual bool IsVectorial(); | |
72 | |
73 // Returns the color value at the specified location. This does not | |
74 // consider any transforms that may be set on the device. | |
75 SkColor getColorAt(int x, int y); | |
76 | |
77 protected: | 75 protected: |
78 // Reference counted data that can be shared between multiple devices. This | 76 // Reference counted data that can be shared between multiple devices. This |
79 // allows copy constructors and operator= for devices to work properly. The | 77 // allows copy constructors and operator= for devices to work properly. The |
80 // bitmaps used by the base device class are already refcounted and copyable. | 78 // bitmaps used by the base device class are already refcounted and copyable. |
81 class BitmapPlatformDeviceData; | 79 class BitmapPlatformDeviceData; |
82 | 80 |
83 BitmapPlatformDevice(BitmapPlatformDeviceData* data, | 81 BitmapPlatformDevice(BitmapPlatformDeviceData* data, |
84 const SkBitmap& bitmap); | 82 const SkBitmap& bitmap); |
85 | 83 |
86 // Flushes the CoreGraphics context so that the pixel data can be accessed | 84 // Flushes the CoreGraphics context so that the pixel data can be accessed |
87 // directly by Skia. Overridden from SkDevice, this is called when Skia | 85 // directly by Skia. Overridden from SkDevice, this is called when Skia |
88 // starts accessing pixel data. | 86 // starts accessing pixel data. |
89 virtual void onAccessBitmap(SkBitmap*); | 87 virtual void onAccessBitmap(SkBitmap*); |
90 | 88 |
91 // Override SkDevice. | 89 // Override SkDevice. |
92 virtual SkDeviceFactory* onNewDeviceFactory(); | 90 virtual SkDeviceFactory* onNewDeviceFactory(); |
93 | 91 |
94 // Data associated with this device, guaranteed non-null. We hold a reference | 92 // Data associated with this device, guaranteed non-null. We hold a reference |
95 // to this object. | 93 // to this object. |
96 BitmapPlatformDeviceData* data_; | 94 BitmapPlatformDeviceData* data_; |
97 }; | 95 }; |
98 | 96 |
99 } // namespace skia | 97 } // namespace skia |
100 | 98 |
101 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ | 99 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
OLD | NEW |