diff options
author | 2015-12-08 10:53:43 -0800 | |
---|---|---|
committer | 2015-12-08 10:53:44 -0800 | |
commit | 1cf6f9b6b51bcf09d93142ba40d6c331c21f50a6 (patch) | |
tree | bf57f918562a5fdeb0b700a1be381e4c4c2c3a3f /src/gpu/GrImageIDTextureAdjuster.h | |
parent | 1f6a1bd969db92daa5fa60517d6b8fc6eef8cb61 (diff) |
Stop wrapping images backed by generators as bitmaps in SkGpuDevice (except when tiling)
Review URL: https://codereview.chromium.org/1510903002
Diffstat (limited to 'src/gpu/GrImageIDTextureAdjuster.h')
-rw-r--r-- | src/gpu/GrImageIDTextureAdjuster.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gpu/GrImageIDTextureAdjuster.h b/src/gpu/GrImageIDTextureAdjuster.h index a20902ed58..d8510feeaa 100644 --- a/src/gpu/GrImageIDTextureAdjuster.h +++ b/src/gpu/GrImageIDTextureAdjuster.h @@ -9,9 +9,11 @@ #define GrImageIDTextureAdjuster_DEFINED #include "GrTextureParamsAdjuster.h" +#include "SkImage.h" class SkBitmap; class SkImage_Base; +class SkImageCacherator; /** Implementation for texture-backed SkBitmaps. The bitmap must stay in scope and unmodified while this object exists. */ @@ -66,4 +68,29 @@ private: typedef GrTextureMaker INHERITED; }; +/** This class manages the conversion of generator-backed images to GrTextures. If the caching hint + is kAllow the image's ID is used for the cache key. */ +class GrImageTextureMaker : public GrTextureMaker { +public: + GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher, const SkImage* client, + SkImage::CachingHint chint); + +protected: + // TODO: consider overriding this, for the case where the underlying generator might be + // able to efficiently produce a "stretched" texture natively (e.g. picture-backed) + // GrTexture* generateTextureForParams(const CopyParams&) override; + + GrTexture* refOriginalTexture() override; + void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey) override; + void didCacheCopy(const GrUniqueKey& copyKey) override; + +private: + SkImageCacherator* fCacher; + const SkImage* fClient; + GrUniqueKey fOriginalKey; + SkImage::CachingHint fCachingHint; + + typedef GrTextureMaker INHERITED; +}; + #endif |