blob: e742b903cfc483f6ac3f164252fc1226109969b1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrImageTextureMaker_DEFINED
#define GrImageTextureMaker_DEFINED
#include "GrTextureMaker.h"
#include "SkImage.h"
class SkImageCacherator;
/** 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(bool willBeMipped, SkColorSpace* dstColorSpace) override;
void makeCopyKey(const CopyParams& stretch, GrUniqueKey* paramsCopyKey,
SkColorSpace* dstColorSpace) override;
void didCacheCopy(const GrUniqueKey& copyKey) override;
SkAlphaType alphaType() const override;
sk_sp<SkColorSpace> getColorSpace(SkColorSpace* dstColorSpace) override;
private:
SkImageCacherator* fCacher;
const SkImage* fClient;
GrUniqueKey fOriginalKey;
SkImage::CachingHint fCachingHint;
typedef GrTextureMaker INHERITED;
};
#endif
|