| 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 |
| 124 * cover). It seems that what really matters is whether the dst is read for
color OR for |
| 125 * coverage. |
| 126 */ |
| 127 bool willColorBlendWithDst() const { return SkToBool(kWillColorBlendWithDst_
Flag & fFlags); } |
| 128 |
| 116 private: | 129 private: |
| 117 enum { | 130 enum { |
| 118 // If this is not set the primitive processor need not produce a color o
utput | 131 // If this is not set the primitive processor need not produce a color o
utput |
| 119 kReadsColor_Flag = 0x1, | 132 kReadsColor_Flag = 0x1, |
| 120 | 133 |
| 121 // If this is not set the primitive processor need not produce a coverag
e output | 134 // If this is not set the primitive processor need not produce a coverag
e output |
| 122 kReadsCoverage_Flag = 0x2, | 135 kReadsCoverage_Flag = 0x2, |
| 123 | 136 |
| 124 // If this is not set the primitive processor need not produce local coo
rdinates | 137 // If this is not set the primitive processor need not produce local coo
rdinates |
| 125 kReadsLocalCoords_Flag = 0x4, | 138 kReadsLocalCoords_Flag = 0x4, |
| 126 | 139 |
| 127 // If this flag is set then the primitive processor may produce color*co
verage as | 140 // 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). | 141 // its color output (and not output a separate coverage). |
| 129 kCanTweakAlphaForCoverage_Flag = 0x8, | 142 kCanTweakAlphaForCoverage_Flag = 0x8, |
| 130 | 143 |
| 131 // If this flag is set the GrPrimitiveProcessor must produce fOverrideCo
lor as its | 144 // If this flag is set the GrPrimitiveProcessor must produce fOverrideCo
lor as its |
| 132 // output color. If not set fOverrideColor is to be ignored. | 145 // output color. If not set fOverrideColor is to be ignored. |
| 133 kUseOverrideColor_Flag = 0x10, | 146 kUseOverrideColor_Flag = 0x10, |
| 147 |
| 148 kWillColorBlendWithDst_Flag = 0x20, |
| 134 }; | 149 }; |
| 135 | 150 |
| 136 uint32_t fFlags; | 151 uint32_t fFlags; |
| 137 GrColor fOverrideColor; | 152 GrColor fOverrideColor; |
| 138 | 153 |
| 139 friend class GrPipeline; // To initialize this | 154 friend class GrPipeline; // To initialize this |
| 140 }; | 155 }; |
| 141 | 156 |
| 142 /* | 157 /* |
| 143 * This enum is shared by GrPrimitiveProcessors and GrGLPrimitiveProcessors to c
oordinate shaders | 158 * 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 | 259 |
| 245 private: | 260 private: |
| 246 virtual bool hasExplicitLocalCoords() const = 0; | 261 virtual bool hasExplicitLocalCoords() const = 0; |
| 247 | 262 |
| 248 bool fIsPathRendering; | 263 bool fIsPathRendering; |
| 249 | 264 |
| 250 typedef GrProcessor INHERITED; | 265 typedef GrProcessor INHERITED; |
| 251 }; | 266 }; |
| 252 | 267 |
| 253 #endif | 268 #endif |
| OLD | NEW |