aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrImageIDTextureAdjuster.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrImageIDTextureAdjuster.h')
-rw-r--r--src/gpu/GrImageIDTextureAdjuster.h27
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