Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrPrimitiveProcessor_DEFINED | 8 #ifndef GrPrimitiveProcessor_DEFINED |
| 9 #define GrPrimitiveProcessor_DEFINED | 9 #define GrPrimitiveProcessor_DEFINED |
| 10 | 10 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 if (SkToBool(kUseOverrideColor_Flag & fFlags)) { | 106 if (SkToBool(kUseOverrideColor_Flag & fFlags)) { |
| 107 SkASSERT(SkToBool(kReadsColor_Flag & fFlags)); | 107 SkASSERT(SkToBool(kReadsColor_Flag & fFlags)); |
| 108 if (overrideColor) { | 108 if (overrideColor) { |
| 109 *overrideColor = fOverrideColor; | 109 *overrideColor = fOverrideColor; |
| 110 } | 110 } |
| 111 return true; | 111 return true; |
| 112 } | 112 } |
| 113 return false; | 113 return false; |
| 114 } | 114 } |
| 115 | 115 |
| 116 /** | |
| 117 * Returns true if the pipeline's color output will be affected by the exist ing render target | |
| 118 * destination pixel values (meaning we need to be careful with overlapping draws). Note that we | |
| 119 * can conflate coverage and color, so the destination color may still bleed into pixels that | |
| 120 * have partial coverage, even if this function returns false. | |
| 121 * | |
| 122 * The above comment seems incorrect for the use case. This funciton is used to turn two | |
| 123 * overlapping draws into a single draw (really to stencil multiple paths an d do a single cover). | |
|
egdaniel
2015/08/13 13:45:28
100
bsalomon
2015/08/13 13:53:30
Done.
| |
| 124 * It seems that what really matters is whether the dst is read for color OR for coverage. | |
| 125 */ | |
| 126 bool willColorBlendWithDst() const { return SkToBool(kWillColorBlendWithDst_ Flag & fFlags); } | |
| 127 | |
| 116 private: | 128 private: |
| 117 enum { | 129 enum { |
| 118 // If this is not set the primitive processor need not produce a color o utput | 130 // If this is not set the primitive processor need not produce a color o utput |
| 119 kReadsColor_Flag = 0x1, | 131 kReadsColor_Flag = 0x1, |
| 120 | 132 |
| 121 // If this is not set the primitive processor need not produce a coverag e output | 133 // If this is not set the primitive processor need not produce a coverag e output |
| 122 kReadsCoverage_Flag = 0x2, | 134 kReadsCoverage_Flag = 0x2, |
| 123 | 135 |
| 124 // If this is not set the primitive processor need not produce local coo rdinates | 136 // If this is not set the primitive processor need not produce local coo rdinates |
| 125 kReadsLocalCoords_Flag = 0x4, | 137 kReadsLocalCoords_Flag = 0x4, |
| 126 | 138 |
| 127 // If this flag is set then the primitive processor may produce color*co verage as | 139 // If this flag is set then the primitive processor may produce color*co verage as |
| 128 // its color output (and not output a separate coverage). | 140 // its color output (and not output a separate coverage). |
| 129 kCanTweakAlphaForCoverage_Flag = 0x8, | 141 kCanTweakAlphaForCoverage_Flag = 0x8, |
| 130 | 142 |
| 131 // If this flag is set the GrPrimitiveProcessor must produce fOverrideCo lor as its | 143 // If this flag is set the GrPrimitiveProcessor must produce fOverrideCo lor as its |
| 132 // output color. If not set fOverrideColor is to be ignored. | 144 // output color. If not set fOverrideColor is to be ignored. |
| 133 kUseOverrideColor_Flag = 0x10, | 145 kUseOverrideColor_Flag = 0x10, |
| 146 | |
| 147 kWillColorBlendWithDst_Flag = 0x20, | |
| 134 }; | 148 }; |
| 135 | 149 |
| 136 uint32_t fFlags; | 150 uint32_t fFlags; |
| 137 GrColor fOverrideColor; | 151 GrColor fOverrideColor; |
| 138 | 152 |
| 139 friend class GrPipeline; // To initialize this | 153 friend class GrPipeline; // To initialize this |
| 140 }; | 154 }; |
| 141 | 155 |
| 142 /* | 156 /* |
| 143 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c oordinate shaders | 157 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c oordinate shaders |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 | 258 |
| 245 private: | 259 private: |
| 246 virtual bool hasExplicitLocalCoords() const = 0; | 260 virtual bool hasExplicitLocalCoords() const = 0; |
| 247 | 261 |
| 248 bool fIsPathRendering; | 262 bool fIsPathRendering; |
| 249 | 263 |
| 250 typedef GrProcessor INHERITED; | 264 typedef GrProcessor INHERITED; |
| 251 }; | 265 }; |
| 252 | 266 |
| 253 #endif | 267 #endif |
| OLD | NEW |