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