2 * Copyright 2016 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #ifndef GrImageTextureMaker_DEFINED
9 #define GrImageTextureMaker_DEFINED
11 #include "GrTextureMaker.h"
14 class SkImageCacherator;
16 /** This class manages the conversion of generator-backed images to GrTextures. If the caching hint
17 is kAllow the image's ID is used for the cache key. */
18 class GrImageTextureMaker : public GrTextureMaker {
20 GrImageTextureMaker(GrContext* context, SkImageCacherator* cacher, const SkImage* client,
21 SkImage::CachingHint chint);
24 // TODO: consider overriding this, for the case where the underlying generator might be
25 // able to efficiently produce a "stretched" texture natively (e.g. picture-backed)
26 // GrTexture* generateTextureForParams(const CopyParams&) override;
28 GrTexture* refOriginalTexture(bool willBeMipped, SkColorSpace* dstColorSpace) override;
29 void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey,
30 SkColorSpace* dstColorSpace) override;
31 void didCacheCopy(const GrUniqueKey& copyKey) override;
33 SkAlphaType alphaType() const override;
34 sk_sp<SkColorSpace> getColorSpace(SkColorSpace* dstColorSpace) override;
37 SkImageCacherator* fCacher;
38 const SkImage* fClient;
39 GrUniqueKey fOriginalKey;
40 SkImage::CachingHint fCachingHint;
42 typedef GrTextureMaker INHERITED;