OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef SkBitmapDevice_DEFINED | 9 #ifndef SkBitmapDevice_DEFINED |
10 #define SkBitmapDevice_DEFINED | 10 #define SkBitmapDevice_DEFINED |
11 | 11 |
12 #include "SkDevice.h" | 12 #include "SkDevice.h" |
13 | 13 |
14 /////////////////////////////////////////////////////////////////////////////// | 14 /////////////////////////////////////////////////////////////////////////////// |
15 class SK_API SkBitmapDevice : public SkBaseDevice { | 15 class SK_API SkBitmapDevice : public SkBaseDevice { |
16 public: | 16 public: |
17 SK_DECLARE_INST_COUNT(SkBitmapDevice) | 17 SK_DECLARE_INST_COUNT(SkBitmapDevice) |
18 | 18 |
19 /** | 19 /** |
20 * Construct a new device with the specified bitmap as its backend. It is | 20 * Construct a new device with the specified bitmap as its backend. It is |
21 * valid for the bitmap to have no pixels associated with it. In that case, | 21 * valid for the bitmap to have no pixels associated with it. In that case, |
22 * any drawing to this device will have no effect. | 22 * any drawing to this device will have no effect. |
23 */ | 23 */ |
24 SkBitmapDevice(const SkBitmap& bitmap); | 24 SkBitmapDevice(const SkBitmap& bitmap, const SkSurfaceProps* = NULL); |
25 | 25 |
26 /** | 26 /** |
27 * Construct a new device with the specified bitmap as its backend. It is | 27 * Construct a new device with the specified bitmap as its backend. It is |
28 * valid for the bitmap to have no pixels associated with it. In that case, | 28 * valid for the bitmap to have no pixels associated with it. In that case, |
29 * any drawing to this device will have no effect. | 29 * any drawing to this device will have no effect. |
30 */ | 30 */ |
31 SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& devicePrope
rties); | 31 SkBitmapDevice(const SkBitmap& bitmap, const SkDeviceProperties& devicePrope
rties); |
32 | 32 |
33 static SkBitmapDevice* Create(const SkImageInfo&, | 33 static SkBitmapDevice* Create(const SkImageInfo&, |
34 const SkDeviceProperties* = NULL); | 34 const SkDeviceProperties* = NULL); |
35 | 35 |
| 36 static SkBitmapDevice* Create(const SkBitmap&, const SkSurfaceProps* = NULL)
; |
| 37 |
36 virtual SkImageInfo imageInfo() const SK_OVERRIDE; | 38 virtual SkImageInfo imageInfo() const SK_OVERRIDE; |
37 | 39 |
38 protected: | 40 protected: |
39 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE; | 41 virtual bool filterTextFlags(const SkPaint& paint, TextFlags*) SK_OVERRIDE; |
40 | 42 |
41 /** Clears the entire device to the specified color (including alpha). | 43 /** Clears the entire device to the specified color (including alpha). |
42 * Ignores the clip. | 44 * Ignores the clip. |
43 */ | 45 */ |
44 virtual void clear(SkColor color) SK_OVERRIDE; | 46 virtual void clear(SkColor color) SK_OVERRIDE; |
45 | 47 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // any clip information. | 153 // any clip information. |
152 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE; | 154 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE; |
153 | 155 |
154 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; | 156 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; |
155 | 157 |
156 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; | 158 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; |
157 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; | 159 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; |
158 | 160 |
159 virtual SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE; | 161 virtual SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE; |
160 | 162 |
161 SkBitmap fBitmap; | 163 SkBitmap fBitmap; |
| 164 const SkSurfaceProps fProps; |
162 | 165 |
163 typedef SkBaseDevice INHERITED; | 166 typedef SkBaseDevice INHERITED; |
164 }; | 167 }; |
165 | 168 |
166 #endif // SkBitmapDevice_DEFINED | 169 #endif // SkBitmapDevice_DEFINED |
OLD | NEW |