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 GrImageTextureMaker_DEFINED |
9 | #define GrImageTextureMaker_DEFINED |
10 | |
11 | #include "include/core/SkImage.h" |
12 | #include "src/gpu/GrTextureMaker.h" |
13 | #include "src/gpu/SkGr.h" |
14 | |
15 | class SkImage_Lazy; |
16 | class SkImage_GpuYUVA; |
17 | |
18 | /** This class manages the conversion of generator-backed images to GrTextures. If the caching hint |
19 | is kAllow the image's ID is used for the cache key. */ |
20 | class GrImageTextureMaker final : public GrTextureMaker { |
21 | public: |
22 | GrImageTextureMaker(GrRecordingContext*, const SkImage* client, GrImageTexGenPolicy); |
23 | |
24 | private: |
25 | GrSurfaceProxyView refOriginalTextureProxyView(GrMipmapped) override; |
26 | |
27 | const SkImage_Lazy* fImage; |
28 | GrImageTexGenPolicy fTexGenPolicy; |
29 | |
30 | typedef GrTextureMaker INHERITED; |
31 | }; |
32 | |
33 | /** This class manages the conversion of generator-backed YUVA images to GrTextures. */ |
34 | class GrYUVAImageTextureMaker final : public GrTextureMaker { |
35 | public: |
36 | GrYUVAImageTextureMaker(GrRecordingContext* context, const SkImage* client); |
37 | |
38 | std::unique_ptr<GrFragmentProcessor> createFragmentProcessor(const SkMatrix& textureMatrix, |
39 | const SkRect* subset, |
40 | const SkRect* domain, |
41 | GrSamplerState) override; |
42 | |
43 | std::unique_ptr<GrFragmentProcessor> createBicubicFragmentProcessor( |
44 | const SkMatrix& textureMatrix, |
45 | const SkRect* subset, |
46 | const SkRect* domain, |
47 | GrSamplerState::WrapMode wrapX, |
48 | GrSamplerState::WrapMode wrapY) override; |
49 | |
50 | bool isPlanar() const override { return true; } |
51 | |
52 | private: |
53 | GrSurfaceProxyView refOriginalTextureProxyView(GrMipmapped) override; |
54 | |
55 | const SkImage_GpuYUVA* fImage; |
56 | |
57 | typedef GrTextureMaker INHERITED; |
58 | }; |
59 | |
60 | #endif |
61 | |