| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 */ | 23 */ |
| 24 SkBitmapDevice(const SkBitmap& bitmap); | 24 SkBitmapDevice(const SkBitmap& bitmap); |
| 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 #ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG | |
| 34 /** | |
| 35 * Create a new raster device and have the pixels be automatically | |
| 36 * allocated. The rowBytes of the device will be computed automatically | |
| 37 * based on the config and the width. | |
| 38 * | |
| 39 * @param config The desired config for the pixels. If the request cannot | |
| 40 * be met, the closest matching support config will be used
. | |
| 41 * @param width width (in pixels) of the device | |
| 42 * @param height height (in pixels) of the device | |
| 43 * @param isOpaque Set to true if it is known that all of the pixels will | |
| 44 * be drawn to opaquely. Used as an accelerator when drawin
g | |
| 45 * these pixels to another device. | |
| 46 */ | |
| 47 SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque
= false); | |
| 48 | |
| 49 /** | |
| 50 * Create a new raster device and have the pixels be automatically | |
| 51 * allocated. The rowBytes of the device will be computed automatically | |
| 52 * based on the config and the width. | |
| 53 * | |
| 54 * @param config The desired config for the pixels. If the request cannot | |
| 55 * be met, the closest matching support config will be used
. | |
| 56 * @param width width (in pixels) of the device | |
| 57 * @param height height (in pixels) of the device | |
| 58 * @param isOpaque Set to true if it is known that all of the pixels will | |
| 59 * be drawn to opaquely. Used as an accelerator when drawin
g | |
| 60 * these pixels to another device. | |
| 61 * @param deviceProperties Properties which affect compositing. | |
| 62 */ | |
| 63 SkBitmapDevice(SkBitmap::Config config, int width, int height, bool isOpaque
, | |
| 64 const SkDeviceProperties& deviceProperties); | |
| 65 #endif | |
| 66 static SkBitmapDevice* Create(const SkImageInfo&, | 33 static SkBitmapDevice* Create(const SkImageInfo&, |
| 67 const SkDeviceProperties* = NULL); | 34 const SkDeviceProperties* = NULL); |
| 68 | 35 |
| 69 /** Return the width of the device (in pixels). | 36 /** Return the width of the device (in pixels). |
| 70 */ | 37 */ |
| 71 virtual int width() const SK_OVERRIDE { return fBitmap.width(); } | 38 virtual int width() const SK_OVERRIDE { return fBitmap.width(); } |
| 72 /** Return the height of the device (in pixels). | 39 /** Return the height of the device (in pixels). |
| 73 */ | 40 */ |
| 74 virtual int height() const SK_OVERRIDE { return fBitmap.height(); } | 41 virtual int height() const SK_OVERRIDE { return fBitmap.height(); } |
| 75 | 42 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 friend class SkDeviceFilteredPaint; | 200 friend class SkDeviceFilteredPaint; |
| 234 friend class SkDeviceImageFilterProxy; | 201 friend class SkDeviceImageFilterProxy; |
| 235 | 202 |
| 236 friend class SkSurface_Raster; | 203 friend class SkSurface_Raster; |
| 237 | 204 |
| 238 // used to change the backend's pixels (and possibly config/rowbytes) | 205 // used to change the backend's pixels (and possibly config/rowbytes) |
| 239 // but cannot change the width/height, so there should be no change to | 206 // but cannot change the width/height, so there should be no change to |
| 240 // any clip information. | 207 // any clip information. |
| 241 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE; | 208 virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) SK_OVERRI
DE; |
| 242 | 209 |
| 243 #ifdef SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG | |
| 244 // in support of legacy constructors | |
| 245 void init(SkBitmap::Config config, int width, int height, bool isOpaque); | |
| 246 #endif | |
| 247 | |
| 248 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; | 210 virtual SkBaseDevice* onCreateDevice(const SkImageInfo&, Usage) SK_OVERRIDE; |
| 249 | 211 |
| 250 /** Causes any deferred drawing to the device to be completed. | 212 /** Causes any deferred drawing to the device to be completed. |
| 251 */ | 213 */ |
| 252 virtual void flush() SK_OVERRIDE {} | 214 virtual void flush() SK_OVERRIDE {} |
| 253 | 215 |
| 254 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; | 216 virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; |
| 255 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; | 217 virtual const void* peekPixels(SkImageInfo*, size_t* rowBytes) SK_OVERRIDE; |
| 256 | 218 |
| 257 SkBitmap fBitmap; | 219 SkBitmap fBitmap; |
| 258 | 220 |
| 259 typedef SkBaseDevice INHERITED; | 221 typedef SkBaseDevice INHERITED; |
| 260 }; | 222 }; |
| 261 | 223 |
| 262 #endif // SkBitmapDevice_DEFINED | 224 #endif // SkBitmapDevice_DEFINED |
| OLD | NEW |