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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 virtual void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcO
ptInfo& coveragePOI, | 226 virtual void getInvariantOutput(const GrProcOptInfo& colorPOI, const GrProcO
ptInfo& coveragePOI, |
227 InvariantOutput*) const = 0; | 227 InvariantOutput*) const = 0; |
228 | 228 |
229 /** | 229 /** |
230 * Determines whether multiplying the computed per-pixel color by the pixel'
s fractional | 230 * Determines whether multiplying the computed per-pixel color by the pixel'
s fractional |
231 * coverage before the blend will give the correct final destination color.
In general it | 231 * coverage before the blend will give the correct final destination color.
In general it |
232 * will not as coverage is applied after blending. | 232 * will not as coverage is applied after blending. |
233 */ | 233 */ |
234 virtual bool canTweakAlphaForCoverage() const = 0; | 234 virtual bool canTweakAlphaForCoverage() const = 0; |
235 | 235 |
236 bool willNeedDstCopy(const GrDrawTargetCaps& caps) const; | 236 bool willNeedDstCopy(const GrDrawTargetCaps& caps, const GrProcOptInfo& colo
rPOI, |
| 237 const GrProcOptInfo& coveragePOI) const; |
237 | 238 |
238 bool isEqual(const GrXPFactory& that) const { | 239 bool isEqual(const GrXPFactory& that) const { |
239 if (this->classID() != that.classID()) { | 240 if (this->classID() != that.classID()) { |
240 return false; | 241 return false; |
241 } | 242 } |
242 return this->onIsEqual(that); | 243 return this->onIsEqual(that); |
243 } | 244 } |
244 | 245 |
245 /** | 246 /** |
246 * Helper for down-casting to a GrXPFactory subclass | 247 * Helper for down-casting to a GrXPFactory subclass |
(...skipping 13 matching lines...) Expand all Loading... |
260 uint32_t fClassID; | 261 uint32_t fClassID; |
261 | 262 |
262 private: | 263 private: |
263 virtual GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI
, | 264 virtual GrXferProcessor* onCreateXferProcessor(const GrProcOptInfo& colorPOI
, |
264 const GrProcOptInfo& coverage
POI, | 265 const GrProcOptInfo& coverage
POI, |
265 const GrDeviceCoordTexture* d
stCopy) const = 0; | 266 const GrDeviceCoordTexture* d
stCopy) const = 0; |
266 /** | 267 /** |
267 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment | 268 * Returns true if the XP generated by this factory will explicitly read ds
t in the fragment |
268 * shader. | 269 * shader. |
269 */ | 270 */ |
270 virtual bool willReadDstColor() const = 0; | 271 virtual bool willReadDstColor(const GrProcOptInfo& colorPOI, |
| 272 const GrProcOptInfo& coveragePOI) const = 0; |
271 | 273 |
272 virtual bool onIsEqual(const GrXPFactory&) const = 0; | 274 virtual bool onIsEqual(const GrXPFactory&) const = 0; |
273 | 275 |
274 static uint32_t GenClassID() { | 276 static uint32_t GenClassID() { |
275 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The | 277 // fCurrXPFactoryID has been initialized to kIllegalXPFactoryID. The |
276 // atomic inc returns the old value not the incremented value. So we add | 278 // atomic inc returns the old value not the incremented value. So we add |
277 // 1 to the returned value. | 279 // 1 to the returned value. |
278 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; | 280 uint32_t id = static_cast<uint32_t>(sk_atomic_inc(&gCurrXPFClassID)) + 1
; |
279 if (!id) { | 281 if (!id) { |
280 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " | 282 SkFAIL("This should never wrap as it should only be called once for
each GrXPFactory " |
281 "subclass."); | 283 "subclass."); |
282 } | 284 } |
283 return id; | 285 return id; |
284 } | 286 } |
285 | 287 |
286 enum { | 288 enum { |
287 kIllegalXPFClassID = 0, | 289 kIllegalXPFClassID = 0, |
288 }; | 290 }; |
289 static int32_t gCurrXPFClassID; | 291 static int32_t gCurrXPFClassID; |
290 | 292 |
291 typedef GrProgramElement INHERITED; | 293 typedef GrProgramElement INHERITED; |
292 }; | 294 }; |
293 | 295 |
294 #endif | 296 #endif |
295 | 297 |
OLD | NEW |