OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "skia/ext/platform_device.h" | 12 #include "skia/ext/platform_device.h" |
13 | 13 |
14 namespace skia { | 14 namespace skia { |
15 | 15 |
16 // A device is basically a wrapper around SkBitmap that provides a surface for | 16 // A device is basically a wrapper around SkBitmap that provides a surface for |
17 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also | 17 // SkCanvas to draw into. Our device provides a surface CoreGraphics can also |
18 // write to. BitmapPlatformDevice creates a bitmap using | 18 // write to. BitmapPlatformDevice creates a bitmap using |
19 // CGCreateBitmapContext() in a format that Skia supports and can then use this | 19 // CGCreateBitmapContext() in a format that Skia supports and can then use this |
20 // to draw text into, etc. This pixel data is provided to the bitmap that the | 20 // to draw text into, etc. This pixel data is provided to the bitmap that the |
21 // device contains so that it can be shared. | 21 // device contains so that it can be shared. |
22 // | 22 // |
23 // The device owns the pixel data, when the device goes away, the pixel data | 23 // The device owns the pixel data, when the device goes away, the pixel data |
24 // also becomes invalid. THIS IS DIFFERENT THAN NORMAL SKIA which uses | 24 // also becomes invalid. THIS IS DIFFERENT THAN NORMAL SKIA which uses |
25 // reference counting for the pixel data. In normal Skia, you could assign | 25 // reference counting for the pixel data. In normal Skia, you could assign |
26 // another bitmap to this device's bitmap and everything will work properly. | 26 // another bitmap to this device's bitmap and everything will work properly. |
27 // For us, that other bitmap will become invalid as soon as the device becomes | 27 // For us, that other bitmap will become invalid as soon as the device becomes |
28 // invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE | 28 // invalid, which may lead to subtle bugs. Therefore, DO NOT ASSIGN THE |
29 // DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead. | 29 // DEVICE'S PIXEL DATA TO ANOTHER BITMAP, make sure you copy instead. |
30 class SK_API BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice { | 30 class BitmapPlatformDevice : public SkBitmapDevice, public PlatformDevice { |
f(malita)
2016/08/30 17:41:23
I think we need to keep these exported, otherwise
tomhudson
2016/08/30 17:48:48
Done.
I'm guessing we do symbolic linking with un
| |
31 public: | 31 public: |
32 // Creates a BitmapPlatformDevice instance. |is_opaque| should be set if the | 32 // Creates a BitmapPlatformDevice instance. |is_opaque| should be set if the |
33 // caller knows the bitmap will be completely opaque and allows some | 33 // caller knows the bitmap will be completely opaque and allows some |
34 // optimizations. | 34 // optimizations. |
35 // |context| may be NULL. If |context| is NULL, then the bitmap backing store | 35 // |context| may be NULL. If |context| is NULL, then the bitmap backing store |
36 // is not initialized. | 36 // is not initialized. |
37 static BitmapPlatformDevice* Create(CGContextRef context, | 37 static BitmapPlatformDevice* Create(CGContextRef context, |
38 int width, int height, | 38 int width, int height, |
39 bool is_opaque, bool do_clear = false); | 39 bool is_opaque, bool do_clear = false); |
40 | 40 |
(...skipping 24 matching lines...) Expand all Loading... | |
65 | 65 |
66 // Lazily-created graphics context used to draw into the bitmap. | 66 // Lazily-created graphics context used to draw into the bitmap. |
67 CGContextRef bitmap_context_; | 67 CGContextRef bitmap_context_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); | 69 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); |
70 }; | 70 }; |
71 | 71 |
72 } // namespace skia | 72 } // namespace skia |
73 | 73 |
74 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ | 74 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_MAC_H_ |
OLD | NEW |