Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrXferProcessor_DEFINED | 8 #ifndef GrXferProcessor_DEFINED |
| 9 #define GrXferProcessor_DEFINED | 9 #define GrXferProcessor_DEFINED |
| 10 | 10 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 118 * A caller who calls this function on a XP is required to honor the returne d OptFlags | 118 * A caller who calls this function on a XP is required to honor the returne d OptFlags |
| 119 * and color values for its draw. | 119 * and color values for its draw. |
| 120 */ | 120 */ |
| 121 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI, | 121 virtual OptFlags getOptimizations(const GrProcOptInfo& colorPOI, |
| 122 const GrProcOptInfo& coveragePOI, | 122 const GrProcOptInfo& coveragePOI, |
| 123 bool doesStencilWrite, | 123 bool doesStencilWrite, |
| 124 GrColor* overrideColor, | 124 GrColor* overrideColor, |
| 125 const GrDrawTargetCaps& caps) = 0; | 125 const GrDrawTargetCaps& caps) = 0; |
| 126 | 126 |
| 127 struct BlendInfo { | 127 struct BlendInfo { |
| 128 BlendInfo() : fWriteColor(true) {} | |
| 129 | |
| 130 GrBlendCoeff fSrcBlend; | 128 GrBlendCoeff fSrcBlend; |
| 131 GrBlendCoeff fDstBlend; | 129 GrBlendCoeff fDstBlend; |
| 132 GrColor fBlendConstant; | 130 GrColor fBlendConstant; |
| 133 bool fWriteColor; | 131 bool fWriteColor; |
| 134 }; | 132 }; |
| 135 | 133 |
| 136 virtual void getBlendInfo(BlendInfo* blendInfo) const = 0; | 134 void getBlendInfo(BlendInfo* blendInfo) const { |
| 135 blendInfo->fSrcBlend = kOne_GrBlendCoeff; | |
|
bsalomon
2015/04/22 13:42:56
My only suggestion is to move this code into a res
| |
| 136 blendInfo->fDstBlend = kZero_GrBlendCoeff; | |
| 137 blendInfo->fBlendConstant = 0; | |
| 138 blendInfo->fWriteColor = true; | |
| 139 this->onGetBlendInfo(blendInfo); | |
| 140 } | |
| 137 | 141 |
| 138 bool willReadDstColor() const { return fWillReadDstColor; } | 142 bool willReadDstColor() const { return fWillReadDstColor; } |
| 139 | 143 |
| 140 /** | 144 /** |
| 141 * Returns the texture to be used as the destination when reading the dst in the fragment | 145 * Returns the texture to be used as the destination when reading the dst in the fragment |
| 142 * shader. If the returned texture is NULL then the XP is either not reading the dst or we have | 146 * shader. If the returned texture is NULL then the XP is either not reading the dst or we have |
| 143 * extentions that support framebuffer fetching and thus don't need a copy o f the dst texture. | 147 * extentions that support framebuffer fetching and thus don't need a copy o f the dst texture. |
| 144 */ | 148 */ |
| 145 const GrTexture* getDstCopyTexture() const { return fDstCopy.getTexture(); } | 149 const GrTexture* getDstCopyTexture() const { return fDstCopy.getTexture(); } |
| 146 | 150 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willReadDstColor); | 191 GrXferProcessor(const GrDeviceCoordTexture* dstCopy, bool willReadDstColor); |
| 188 | 192 |
| 189 private: | 193 private: |
| 190 /** | 194 /** |
| 191 * Sets a unique key on the GrProcessorKeyBuilder that is directly associate d with this xfer | 195 * Sets a unique key on the GrProcessorKeyBuilder that is directly associate d with this xfer |
| 192 * processor's GL backend implementation. | 196 * processor's GL backend implementation. |
| 193 */ | 197 */ |
| 194 virtual void onGetGLProcessorKey(const GrGLCaps& caps, | 198 virtual void onGetGLProcessorKey(const GrGLCaps& caps, |
| 195 GrProcessorKeyBuilder* b) const = 0; | 199 GrProcessorKeyBuilder* b) const = 0; |
| 196 | 200 |
| 201 /** | |
| 202 * Retrieves the hardware blend state required by this Xfer processor. The B lendInfo struct | |
| 203 * comes initialized to default values, so the Xfer processor only needs to set the state it | |
| 204 * needs. It may not even need to override this method at all. | |
| 205 */ | |
| 206 virtual void onGetBlendInfo(BlendInfo*) const {} | |
| 207 | |
| 197 virtual bool onIsEqual(const GrXferProcessor&) const = 0; | 208 virtual bool onIsEqual(const GrXferProcessor&) const = 0; |
| 198 | 209 |
| 199 bool fWillReadDstColor; | 210 bool fWillReadDstColor; |
| 200 SkIPoint fDstCopyTextureOffset; | 211 SkIPoint fDstCopyTextureOffset; |
| 201 GrTextureAccess fDstCopy; | 212 GrTextureAccess fDstCopy; |
| 202 | 213 |
| 203 typedef GrFragmentProcessor INHERITED; | 214 typedef GrFragmentProcessor INHERITED; |
| 204 }; | 215 }; |
| 205 | 216 |
| 206 GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); | 217 GR_MAKE_BITFIELD_OPS(GrXferProcessor::OptFlags); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 enum { | 321 enum { |
| 311 kIllegalXPFClassID = 0, | 322 kIllegalXPFClassID = 0, |
| 312 }; | 323 }; |
| 313 static int32_t gCurrXPFClassID; | 324 static int32_t gCurrXPFClassID; |
| 314 | 325 |
| 315 typedef GrProgramElement INHERITED; | 326 typedef GrProgramElement INHERITED; |
| 316 }; | 327 }; |
| 317 | 328 |
| 318 #endif | 329 #endif |
| 319 | 330 |
| OLD | NEW |