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_WIN_H_ | 5 #ifndef SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ | 6 #define SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "skia/ext/platform_device.h" | 10 #include "skia/ext/platform_device.h" |
| 11 #include "skia/ext/refptr.h" |
11 | 12 |
12 namespace skia { | 13 namespace skia { |
13 | 14 |
14 // A device is basically a wrapper around SkBitmap that provides a surface for | 15 // A device is basically a wrapper around SkBitmap that provides a surface for |
15 // SkCanvas to draw into. Our device provides a surface Windows can also write | 16 // SkCanvas to draw into. Our device provides a surface Windows can also write |
16 // to. BitmapPlatformDevice creates a bitmap using CreateDIBSection() in a | 17 // to. BitmapPlatformDevice creates a bitmap using CreateDIBSection() in a |
17 // format that Skia supports and can then use this to draw ClearType into, etc. | 18 // format that Skia supports and can then use this to draw ClearType into, etc. |
18 // This pixel data is provided to the bitmap that the device contains so that it | 19 // This pixel data is provided to the bitmap that the device contains so that it |
19 // can be shared. | 20 // can be shared. |
20 // | 21 // |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, | 73 virtual SkDevice* onCreateCompatibleDevice(SkBitmap::Config, int width, |
73 int height, bool isOpaque, | 74 int height, bool isOpaque, |
74 Usage usage) OVERRIDE; | 75 Usage usage) OVERRIDE; |
75 | 76 |
76 private: | 77 private: |
77 // Reference counted data that can be shared between multiple devices. This | 78 // Reference counted data that can be shared between multiple devices. This |
78 // allows copy constructors and operator= for devices to work properly. The | 79 // allows copy constructors and operator= for devices to work properly. The |
79 // bitmaps used by the base device class are already refcounted and copyable. | 80 // bitmaps used by the base device class are already refcounted and copyable. |
80 class BitmapPlatformDeviceData; | 81 class BitmapPlatformDeviceData; |
81 | 82 |
82 // Private constructor. The data should already be ref'ed for us. | 83 // Private constructor. |
83 BitmapPlatformDevice(BitmapPlatformDeviceData* data, | 84 BitmapPlatformDevice(const skia::RefPtr<BitmapPlatformDeviceData>& data, |
84 const SkBitmap& bitmap); | 85 const SkBitmap& bitmap); |
85 | 86 |
86 // Data associated with this device, guaranteed non-null. We hold a reference | 87 // Data associated with this device, guaranteed non-null. |
87 // to this object. | 88 skia::RefPtr<BitmapPlatformDeviceData> data_; |
88 BitmapPlatformDeviceData* data_; | |
89 | 89 |
90 #ifdef SK_DEBUG | 90 #ifdef SK_DEBUG |
91 int begin_paint_count_; | 91 int begin_paint_count_; |
92 #endif | 92 #endif |
93 | 93 |
94 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); | 94 DISALLOW_COPY_AND_ASSIGN(BitmapPlatformDevice); |
95 }; | 95 }; |
96 | 96 |
97 } // namespace skia | 97 } // namespace skia |
98 | 98 |
99 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ | 99 #endif // SKIA_EXT_BITMAP_PLATFORM_DEVICE_WIN_H_ |
OLD | NEW |