Chromium Code Reviews| Index: src/core/SkSpecialImage.h |
| diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h |
| index 38225482fbd5f76d291c76a8609db29e0859f5d5..b26fbf9f92f46cfe32a9c5aee5dc410177523a4a 100644 |
| --- a/src/core/SkSpecialImage.h |
| +++ b/src/core/SkSpecialImage.h |
| @@ -8,8 +8,12 @@ |
| #ifndef SkSpecialImage_DEFINED |
| #define SkSpecialImage_DEFINED |
| +#include "SkNextID.h" |
| #include "SkRefCnt.h" |
| +// remove this when internal_getProxy goes away |
|
Stephen White
2016/02/17 21:44:03
Nit: log a bug for switching all image filters to
robertphillips
2016/02/18 13:18:39
Done.
|
| +#include "SkImageFilter.h" |
| + |
| class GrTexture; |
| class SkBitmap; |
| class SkCanvas; |
| @@ -18,6 +22,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 +41,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. |
| @@ -40,16 +51,32 @@ public: |
| void draw(SkCanvas*, SkScalar x, SkScalar y, const SkPaint*) const; |
| 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* NewFromRaster(SkImageFilter::Proxy*, |
| + const SkIRect& subset, |
| + const SkBitmap&); |
| + static SkSpecialImage* NewFromGpu(SkImageFilter::Proxy*, |
| + const SkIRect& subset, |
| + uint32_t uniqueID, |
| + 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 |
|
Stephen White
2016/02/17 21:44:02
Nit: reference above bug?
robertphillips
2016/02/18 13:18:39
Done.
|
| + bool internal_getBM(SkBitmap* result); |
| + static SkSpecialImage* internal_fromBM(SkImageFilter::Proxy*, const SkBitmap&); |
| + SkImageFilter::Proxy* internal_getProxy(); |
| + |
| protected: |
| - SkSpecialImage(const SkIRect& subset) : fSubset(subset) { } |
| + SkSpecialImage(SkImageFilter::Proxy* proxy, const SkIRect& subset, uint32_t uniqueID) |
| + : fSubset(subset) |
| + , fUniqueID(kNeedNewImageUniqueID_SpecialImage == uniqueID ? SkNextID::ImageID() |
| + : uniqueID) |
| + , fProxy(proxy) { |
| + } |
| // The following 3 are for testing and shouldn't be used. |
| friend class TestingSpecialImageAccess; |
| @@ -74,8 +101,14 @@ protected: |
| */ |
| GrTexture* peekTexture() const; |
| + SkImageFilter::Proxy* proxy() const { return fProxy; } |
| + |
| private: |
| - const SkIRect fSubset; |
| + const SkIRect fSubset; |
| + const uint32_t fUniqueID; |
| + |
| + // TODO: remove this ASAP |
|
Stephen White
2016/02/17 21:44:03
Same here? (reference a switch-all-filters bug).
robertphillips
2016/02/18 13:18:39
Done.
|
| + SkImageFilter::Proxy* fProxy; |
| typedef SkRefCnt INHERITED; |
| }; |