• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2018 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 GrYUVtoRGBEffect_DEFINED
9 #define GrYUVtoRGBEffect_DEFINED
10 
11 #include "include/core/SkYUVAInfo.h"
12 #include "src/core/SkYUVAInfoLocation.h"
13 #include "src/gpu/ganesh/GrFragmentProcessor.h"
14 #include "src/gpu/ganesh/GrProcessorUnitTest.h"
15 
16 class GrYUVATextureProxies;
17 
18 class GrYUVtoRGBEffect : public GrFragmentProcessor {
19 public:
20     static std::unique_ptr<GrFragmentProcessor> Make(const GrYUVATextureProxies& yuvaProxies,
21                                                      GrSamplerState samplerState,
22                                                      const GrCaps&,
23                                                      const SkMatrix& localMatrix = SkMatrix::I(),
24                                                      const SkRect* subset = nullptr,
25                                                      const SkRect* domain = nullptr);
26     std::unique_ptr<GrFragmentProcessor> clone() const override;
27 
name()28     const char* name() const override { return "YUVtoRGBEffect"; }
29 
30 private:
31     GrYUVtoRGBEffect(std::unique_ptr<GrFragmentProcessor> planeFPs[4],
32                      int numPlanes,
33                      const SkYUVAInfo::YUVALocations&,
34                      const bool snap[2],
35                      SkYUVColorSpace yuvColorSpace);
36 
37     GrYUVtoRGBEffect(const GrYUVtoRGBEffect& src);
38 
39 #if GR_TEST_UTILS
40     SkString onDumpInfo() const override;
41 #endif
42 
43     std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
44 
45     void onAddToKey(const GrShaderCaps&, skgpu::KeyBuilder*) const override;
46 
47     bool onIsEqual(const GrFragmentProcessor&) const override;
48 
49     GR_DECLARE_FRAGMENT_PROCESSOR_TEST
50 
51     SkYUVAInfo::YUVALocations   fLocations;
52     SkYUVColorSpace             fYUVColorSpace;
53     bool                        fSnap[2];
54 };
55 #endif
56