• 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 private:
30     GrYUVtoRGBEffect(std::unique_ptr<GrFragmentProcessor> planeFPs[4],
31                      int numPlanes,
32                      const SkYUVAInfo::YUVALocations&,
33                      const bool snap[2],
34                      SkYUVColorSpace yuvColorSpace);
35 
36     GrYUVtoRGBEffect(const GrYUVtoRGBEffect& src);
37 
38 #if GR_TEST_UTILS
39     SkString onDumpInfo() const override;
40 #endif
41 
42     std::unique_ptr<ProgramImpl> onMakeProgramImpl() const override;
43 
44     void onAddToKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override;
45 
46     bool onIsEqual(const GrFragmentProcessor&) const override;
47 
48     GR_DECLARE_FRAGMENT_PROCESSOR_TEST
49 
50     SkYUVAInfo::YUVALocations   fLocations;
51     SkYUVColorSpace             fYUVColorSpace;
52     bool                        fSnap[2];
53 };
54 #endif
55