Line data Source code
1 : /*
2 : * Copyright 2016 Google Inc.
3 : *
4 : * Use of this source code is governed by a BSD-style license that can be
5 : * found in the LICENSE file.
6 : */
7 :
8 : #ifndef GrBitmapTextureMaker_DEFINED
9 : #define GrBitmapTextureMaker_DEFINED
10 :
11 : #include "GrTextureMaker.h"
12 :
13 : /** This class manages the conversion of SW-backed bitmaps to GrTextures. If the input bitmap is
14 : non-volatile the texture is cached using a key created from the pixels' image id and the
15 : subset of the pixelref specified by the bitmap. */
16 0 : class GrBitmapTextureMaker : public GrTextureMaker {
17 : public:
18 : GrBitmapTextureMaker(GrContext* context, const SkBitmap& bitmap);
19 :
20 : protected:
21 : sk_sp<GrTextureProxy> refOriginalTextureProxy(bool willBeMipped,
22 : SkColorSpace* dstColorSpace) override;
23 :
24 : void makeCopyKey(const CopyParams& copyParams, GrUniqueKey* copyKey,
25 : SkColorSpace* dstColorSpace) override;
26 :
27 : void didCacheCopy(const GrUniqueKey& copyKey) override;
28 :
29 : SkAlphaType alphaType() const override;
30 : sk_sp<SkColorSpace> getColorSpace(SkColorSpace* dstColorSpace) override;
31 :
32 : private:
33 : const SkBitmap fBitmap;
34 : GrUniqueKey fOriginalKey;
35 :
36 : typedef GrTextureMaker INHERITED;
37 : };
38 :
39 : #endif
|