Chromium Code Reviews| Index: src/core/SkSpecialImage.h |
| diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h |
| index 38225482fbd5f76d291c76a8609db29e0859f5d5..551824a3bce7448678e369f17857ca78b1b3f46c 100644 |
| --- a/src/core/SkSpecialImage.h |
| +++ b/src/core/SkSpecialImage.h |
| @@ -8,8 +8,13 @@ |
| #ifndef SkSpecialImage_DEFINED |
| #define SkSpecialImage_DEFINED |
| +#include "SkNextID.h" |
| #include "SkRefCnt.h" |
| +// remove these two when internal_getProxy goes away |
| +#include "SkImageFilter.h" |
| +#include "SkDevice.h" |
| + |
| class GrTexture; |
| class SkBitmap; |
| class SkCanvas; |
| @@ -18,6 +23,10 @@ struct SkImageInfo; |
| class SkPaint; |
| class SkSpecialSurface; |
| +enum { |
| + kNeedNewImageUniqueID_SpecialImage = 0 |
| +}; |
| + |
| /** |
| * This is a restricted form of SkImage solely intended for internal use. It |
| * differs from SkImage in that: |
| @@ -33,6 +42,9 @@ class SkSpecialImage : public SkRefCnt { |
| public: |
| int width() const { return fSubset.width(); } |
| int height() const { return fSubset.height(); } |
| + uint32_t uniqueID() const { return fUniqueID; } |
| + virtual bool isOpaque() const { return false; } |
| + virtual size_t getSize() const = 0; |
| /** |
| * Draw this SpecialImage into the canvas. |
| @@ -41,15 +53,31 @@ public: |
| static SkSpecialImage* NewFromImage(const SkIRect& subset, const SkImage*); |
| static SkSpecialImage* NewFromRaster(const SkIRect& subset, const SkBitmap&); |
| - static SkSpecialImage* NewFromGpu(const SkIRect& subset, GrTexture*); |
| + static SkSpecialImage* NewFromGpu(const SkIRect& subset, |
| + uint32_t uniqueID, |
|
Stephen White
2016/02/17 17:00:02
Out of curiosity, are we going to need this unique
robertphillips
2016/02/17 19:10:28
I believe it will go away when there are only SkIm
|
| + GrTexture*, |
| + SkAlphaType at = kPremul_SkAlphaType); |
| /** |
| * Create a new surface with a backend that is compatible with this image. |
| */ |
| SkSpecialSurface* newSurface(const SkImageInfo&) const; |
| + // These three internal methods will go away |
| + bool internal_getBM(SkBitmap* result); |
| + static SkSpecialImage* internal_fromBM(const SkBitmap&); |
| + SkImageFilter::Proxy* internal_getProxy(); |
| + |
| protected: |
| - SkSpecialImage(const SkIRect& subset) : fSubset(subset) { } |
| + SkSpecialImage(const SkIRect& subset, uint32_t uniqueID) |
| + : fSubset(subset) |
| + , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::ImageID() |
| + : uniqueID) |
| + , fProxy(nullptr) { |
| + } |
| + ~SkSpecialImage() override { |
| + delete fProxy; |
| + } |
| // The following 3 are for testing and shouldn't be used. |
| friend class TestingSpecialImageAccess; |
| @@ -75,7 +103,12 @@ protected: |
| GrTexture* peekTexture() const; |
| private: |
| - const SkIRect fSubset; |
| + const SkIRect fSubset; |
| + const uint32_t fUniqueID; |
| + |
| + // TODO: remove these two ASAP |
| + SkImageFilter::Proxy* fProxy; |
| + SkAutoTUnref<SkBaseDevice> fDevice; |
| typedef SkRefCnt INHERITED; |
| }; |