| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef SkDevice_DEFINED | 8 #ifndef SkDevice_DEFINED |
| 9 #define SkDevice_DEFINED | 9 #define SkDevice_DEFINED |
| 10 | 10 |
| 11 #include "SkRefCnt.h" | 11 #include "SkRefCnt.h" |
| 12 #include "SkBitmap.h" | 12 #include "SkBitmap.h" |
| 13 #include "SkCanvas.h" | 13 #include "SkCanvas.h" |
| 14 #include "SkColor.h" | 14 #include "SkColor.h" |
| 15 #include "SkImageFilter.h" | 15 #include "SkImageFilter.h" |
| 16 #include "SkSurfaceProps.h" |
| 16 | 17 |
| 17 class SkClipStack; | 18 class SkClipStack; |
| 18 class SkDraw; | 19 class SkDraw; |
| 19 class SkDrawFilter; | 20 class SkDrawFilter; |
| 20 struct SkIRect; | 21 struct SkIRect; |
| 21 class SkMatrix; | 22 class SkMatrix; |
| 22 class SkMetaData; | 23 class SkMetaData; |
| 23 class SkRegion; | 24 class SkRegion; |
| 24 struct SkDeviceProperties; | |
| 25 class GrRenderTarget; | 25 class GrRenderTarget; |
| 26 | 26 |
| 27 class SK_API SkBaseDevice : public SkRefCnt { | 27 class SK_API SkBaseDevice : public SkRefCnt { |
| 28 public: | 28 public: |
| 29 SK_DECLARE_INST_COUNT(SkBaseDevice) | 29 SK_DECLARE_INST_COUNT(SkBaseDevice) |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * Construct a new device. | 32 * Construct a new device. |
| 33 */ | 33 */ |
| 34 SkBaseDevice(); | 34 SkBaseDevice(); |
| 35 explicit SkBaseDevice(const SkDeviceProperties&); | 35 explicit SkBaseDevice(const SkSurfaceProps&); |
| 36 virtual ~SkBaseDevice(); | 36 virtual ~SkBaseDevice(); |
| 37 | 37 |
| 38 SkMetaData& getMetaData(); | 38 SkMetaData& getMetaData(); |
| 39 | 39 |
| 40 /** | 40 /** |
| 41 * Return ImageInfo for this device. If the canvas is not backed by pixels | 41 * Return ImageInfo for this device. If the canvas is not backed by pixels |
| 42 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. | 42 * (cpu or gpu), then the info's ColorType will be kUnknown_SkColorType. |
| 43 */ | 43 */ |
| 44 virtual SkImageInfo imageInfo() const; | 44 virtual SkImageInfo imageInfo() const; |
| 45 | 45 |
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y); | 308 virtual bool onWritePixels(const SkImageInfo&, const void*, size_t, int x, i
nt y); |
| 309 | 309 |
| 310 virtual bool onAccessPixels(SkPixmap*) { return false; } | 310 virtual bool onAccessPixels(SkPixmap*) { return false; } |
| 311 | 311 |
| 312 /** | 312 /** |
| 313 * Leaky properties are those which the device should be applying but it is
n't. | 313 * Leaky properties are those which the device should be applying but it is
n't. |
| 314 * These properties will be applied by the draw, when and as it can. | 314 * These properties will be applied by the draw, when and as it can. |
| 315 * If the device does handle a property, that property should be set to the
identity value | 315 * If the device does handle a property, that property should be set to the
identity value |
| 316 * for that property, effectively making it non-leaky. | 316 * for that property, effectively making it non-leaky. |
| 317 */ | 317 */ |
| 318 const SkDeviceProperties& getLeakyProperties() const { | 318 const SkSurfaceProps& getLeakyProperties() const { |
| 319 return *fLeakyProperties; | 319 return fLeakyProperties; |
| 320 } | 320 } |
| 321 | 321 |
| 322 /** | 322 /** |
| 323 * PRIVATE / EXPERIMENTAL -- do not call | 323 * PRIVATE / EXPERIMENTAL -- do not call |
| 324 * This entry point gives the backend an opportunity to take over the rende
ring | 324 * This entry point gives the backend an opportunity to take over the rende
ring |
| 325 * of 'picture'. If optimization data is available (due to an earlier | 325 * of 'picture'. If optimization data is available (due to an earlier |
| 326 * 'optimize' call) this entry point should make use of it and return true | 326 * 'optimize' call) this entry point should make use of it and return true |
| 327 * if all rendering has been done. If false is returned, SkCanvas will | 327 * if all rendering has been done. If false is returned, SkCanvas will |
| 328 * perform its own rendering pass. It is acceptable for the backend | 328 * perform its own rendering pass. It is acceptable for the backend |
| 329 * to perform some device-specific warm up tasks and then let SkCanvas | 329 * to perform some device-specific warm up tasks and then let SkCanvas |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 void setOrigin(int x, int y) { fOrigin.set(x, y); } | 392 void setOrigin(int x, int y) { fOrigin.set(x, y); } |
| 393 | 393 |
| 394 /** Causes any deferred drawing to the device to be completed. | 394 /** Causes any deferred drawing to the device to be completed. |
| 395 */ | 395 */ |
| 396 virtual void flush() {} | 396 virtual void flush() {} |
| 397 | 397 |
| 398 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } | 398 virtual SkImageFilter::Cache* getImageFilterCache() { return NULL; } |
| 399 | 399 |
| 400 SkIPoint fOrigin; | 400 SkIPoint fOrigin; |
| 401 SkMetaData* fMetaData; | 401 SkMetaData* fMetaData; |
| 402 SkDeviceProperties* fLeakyProperties; // will always exist. | 402 SkSurfaceProps fLeakyProperties; |
| 403 | 403 |
| 404 #ifdef SK_DEBUG | 404 #ifdef SK_DEBUG |
| 405 bool fAttachedToCanvas; | 405 bool fAttachedToCanvas; |
| 406 #endif | 406 #endif |
| 407 | 407 |
| 408 typedef SkRefCnt INHERITED; | 408 typedef SkRefCnt INHERITED; |
| 409 }; | 409 }; |
| 410 | 410 |
| 411 #endif | 411 #endif |
| OLD | NEW |