Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1920)

Side by Side Diff: src/gpu/effects/GrCustomXfermodePriv.h

Issue 860383007: Move GrXferProcessor subclasses into cpp files (Closed) Base URL: https://skia.googlesource.com/skia.git@playDstCpy
Patch Set: Rebase Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/effects/GrCustomXfermode.cpp ('k') | src/gpu/effects/GrDisableColorXP.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 GrCustomXP : public GrXferProcessor {
60 public:
61 static GrXferProcessor* Create(SkXfermode::Mode mode, const GrDeviceCoordTex ture* dstCopy,
62 bool willReadDstColor) {
63 if (!GrCustomXfermode::IsSupportedMode(mode)) {
64 return NULL;
65 } else {
66 return SkNEW_ARGS(GrCustomXP, (mode, dstCopy, willReadDstColor));
67 }
68 }
69
70 ~GrCustomXP() SK_OVERRIDE {};
71
72 const char* name() const SK_OVERRIDE { return "Custom Xfermode"; }
73
74 GrGLXferProcessor* createGLInstance() const SK_OVERRIDE;
75
76 bool hasSecondaryOutput() const SK_OVERRIDE { return false; }
77
78 GrXferProcessor::OptFlags getOptimizations(const GrProcOptInfo& colorPOI,
79 const GrProcOptInfo& coveragePOI,
80 bool doesStencilWrite,
81 GrColor* overrideColor,
82 const GrDrawTargetCaps& caps) SK_ OVERRIDE;
83
84 void getBlendInfo(GrXferProcessor::BlendInfo* blendInfo) const SK_OVERRIDE {
85 blendInfo->fSrcBlend = kOne_GrBlendCoeff;
86 blendInfo->fDstBlend = kZero_GrBlendCoeff;
87 blendInfo->fBlendConstant = 0;
88 }
89
90 SkXfermode::Mode mode() const { return fMode; }
91
92 private:
93 GrCustomXP(SkXfermode::Mode mode, const GrDeviceCoordTexture* dstCopy, bool willReadDstColor);
94
95 void onGetGLProcessorKey(const GrGLCaps& caps, GrProcessorKeyBuilder* b) con st SK_OVERRIDE;
96
97 bool onIsEqual(const GrXferProcessor& xpBase) const SK_OVERRIDE;
98
99 SkXfermode::Mode fMode;
100
101 typedef GrXferProcessor INHERITED;
102 };
103
104 ///////////////////////////////////////////////////////////////////////////////
105
106 class GrCustomXPFactory : public GrXPFactory { 59 class GrCustomXPFactory : public GrXPFactory {
107 public: 60 public:
108 GrCustomXPFactory(SkXfermode::Mode mode); 61 GrCustomXPFactory(SkXfermode::Mode mode);
109 62
110 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE { 63 bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlags) const SK_OVERRIDE {
111 return true; 64 return true;
112 } 65 }
113 66
114 bool canApplyCoverage(const GrProcOptInfo& colorPOI, 67 bool canApplyCoverage(const GrProcOptInfo& colorPOI,
115 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE { 68 const GrProcOptInfo& coveragePOI) const SK_OVERRIDE {
116 return true; 69 return true;
117 } 70 }
118 71
119 bool canTweakAlphaForCoverage() const SK_OVERRIDE { 72 bool canTweakAlphaForCoverage() const SK_OVERRIDE {
120 return false; 73 return false;
121 } 74 }
122 75
123 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI, 76 void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcOptInfo& coveragePOI,
124 GrXPFactory::InvariantOutput*) const SK_OVERRIDE; 77 GrXPFactory::InvariantOutput*) const SK_OVERRIDE;
125 78
126 private: 79 private:
127 GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI, 80 GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI,
128 const GrProcOptInfo& coveragePOI, 81 const GrProcOptInfo& coveragePOI,
129 const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE { 82 const GrDeviceCoordTexture* dstCopy) const SK_OVERRIDE;
130 return GrCustomXP::Create(fMode, dstCopy, this->willReadDstColor());
131 }
132 83
133 bool willReadDstColor() const SK_OVERRIDE { return true; } 84 bool willReadDstColor() const SK_OVERRIDE { return true; }
134 85
135 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE { 86 bool onIsEqual(const GrXPFactory& xpfBase) const SK_OVERRIDE {
136 const GrCustomXPFactory& xpf = xpfBase.cast<GrCustomXPFactory>(); 87 const GrCustomXPFactory& xpf = xpfBase.cast<GrCustomXPFactory>();
137 return fMode == xpf.fMode; 88 return fMode == xpf.fMode;
138 } 89 }
139 90
140 GR_DECLARE_XP_FACTORY_TEST; 91 GR_DECLARE_XP_FACTORY_TEST;
141 92
142 SkXfermode::Mode fMode; 93 SkXfermode::Mode fMode;
143 94
144 typedef GrXPFactory INHERITED; 95 typedef GrXPFactory INHERITED;
145 }; 96 };
146 #endif 97 #endif
147 98
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCustomXfermode.cpp ('k') | src/gpu/effects/GrDisableColorXP.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698