OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrCustomXfermodePriv_DEFINED | 8 #ifndef GrCustomXfermodePriv_DEFINED |
9 #define GrCustomXfermodePriv_DEFINED | 9 #define GrCustomXfermodePriv_DEFINED |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 class GrTexture; | 22 class GrTexture; |
23 | 23 |
24 /////////////////////////////////////////////////////////////////////////////// | 24 /////////////////////////////////////////////////////////////////////////////// |
25 // Fragment Processor | 25 // Fragment Processor |
26 /////////////////////////////////////////////////////////////////////////////// | 26 /////////////////////////////////////////////////////////////////////////////// |
27 | 27 |
28 class GrCustomXferFP : public GrFragmentProcessor { | 28 class GrCustomXferFP : public GrFragmentProcessor { |
29 public: | 29 public: |
30 GrCustomXferFP(SkXfermode::Mode mode, GrTexture* background); | 30 GrCustomXferFP(SkXfermode::Mode mode, GrTexture* background); |
31 | 31 |
32 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const
SK_OVERRIDE; | 32 void getGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) const
override; |
33 | 33 |
34 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 34 GrGLFragmentProcessor* createGLInstance() const override; |
35 | 35 |
36 const char* name() const SK_OVERRIDE { return "Custom Xfermode"; } | 36 const char* name() const override { return "Custom Xfermode"; } |
37 | 37 |
38 SkXfermode::Mode mode() const { return fMode; } | 38 SkXfermode::Mode mode() const { return fMode; } |
39 const GrTextureAccess& backgroundAccess() const { return fBackgroundAccess;
} | 39 const GrTextureAccess& backgroundAccess() const { return fBackgroundAccess;
} |
40 | 40 |
41 private: | 41 private: |
42 bool onIsEqual(const GrFragmentProcessor& other) const SK_OVERRIDE; | 42 bool onIsEqual(const GrFragmentProcessor& other) const override; |
43 | 43 |
44 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; | 44 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
45 | 45 |
46 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 46 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
47 | 47 |
48 SkXfermode::Mode fMode; | 48 SkXfermode::Mode fMode; |
49 GrCoordTransform fBackgroundTransform; | 49 GrCoordTransform fBackgroundTransform; |
50 GrTextureAccess fBackgroundAccess; | 50 GrTextureAccess fBackgroundAccess; |
51 | 51 |
52 typedef GrFragmentProcessor INHERITED; | 52 typedef GrFragmentProcessor INHERITED; |
53 }; | 53 }; |
54 | 54 |
55 /////////////////////////////////////////////////////////////////////////////// | 55 /////////////////////////////////////////////////////////////////////////////// |
56 // Xfer Processor | 56 // Xfer Processor |
57 /////////////////////////////////////////////////////////////////////////////// | 57 /////////////////////////////////////////////////////////////////////////////// |
58 | 58 |
59 class GrCustomXPFactory : public GrXPFactory { | 59 class GrCustomXPFactory : public GrXPFactory { |
60 public: | 60 public: |
61 GrCustomXPFactory(SkXfermode::Mode mode); | 61 GrCustomXPFactory(SkXfermode::Mode mode); |
62 | 62 |
63 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
SK_OVERRIDE { | 63 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const
override { |
64 return true; | 64 return true; |
65 } | 65 } |
66 | 66 |
67 bool canTweakAlphaForCoverage() const SK_OVERRIDE { | 67 bool canTweakAlphaForCoverage() const override { |
68 return false; | 68 return false; |
69 } | 69 } |
70 | 70 |
71 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, | 71 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo&
coveragePOI, |
72 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; | 72 GrXPFactory::InvariantOutput*) const override; |
73 | 73 |
74 private: | 74 private: |
75 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, | 75 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, |
76 const GrProcOptInfo& colorPOI, | 76 const GrProcOptInfo& colorPOI, |
77 const GrProcOptInfo& coveragePOI, | 77 const GrProcOptInfo& coveragePOI, |
78 const GrDeviceCoordTexture* dstCopy)
const SK_OVERRIDE; | 78 const GrDeviceCoordTexture* dstCopy)
const override; |
79 | 79 |
80 bool willReadDstColor(const GrDrawTargetCaps& caps, | 80 bool willReadDstColor(const GrDrawTargetCaps& caps, |
81 const GrProcOptInfo& colorPOI, | 81 const GrProcOptInfo& colorPOI, |
82 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { | 82 const GrProcOptInfo& coveragePOI) const override { |
83 return true; | 83 return true; |
84 } | 84 } |
85 | 85 |
86 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { | 86 bool onIsEqual(const GrXPFactory& xpfBase) const override { |
87 const GrCustomXPFactory& xpf = xpfBase.cast<GrCustomXPFactory>(); | 87 const GrCustomXPFactory& xpf = xpfBase.cast<GrCustomXPFactory>(); |
88 return fMode == xpf.fMode; | 88 return fMode == xpf.fMode; |
89 } | 89 } |
90 | 90 |
91 GR_DECLARE_XP_FACTORY_TEST; | 91 GR_DECLARE_XP_FACTORY_TEST; |
92 | 92 |
93 SkXfermode::Mode fMode; | 93 SkXfermode::Mode fMode; |
94 | 94 |
95 typedef GrXPFactory INHERITED; | 95 typedef GrXPFactory INHERITED; |
96 }; | 96 }; |
97 #endif | 97 #endif |
98 | 98 |
OLD | NEW |