OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "GrClipMaskManager.h" | 8 #include "GrClipMaskManager.h" |
9 #include "GrAAConvexPathRenderer.h" | 9 #include "GrAAConvexPathRenderer.h" |
10 #include "GrAAHairLinePathRenderer.h" | 10 #include "GrAAHairLinePathRenderer.h" |
11 #include "GrAARectRenderer.h" | 11 #include "GrAARectRenderer.h" |
12 #include "GrDrawTargetCaps.h" | 12 #include "GrDrawTargetCaps.h" |
13 #include "GrPaint.h" | 13 #include "GrPaint.h" |
14 #include "GrPathRenderer.h" | 14 #include "GrPathRenderer.h" |
15 #include "GrRenderTarget.h" | 15 #include "GrRenderTarget.h" |
16 #include "GrStencilBuffer.h" | 16 #include "GrStencilBuffer.h" |
17 #include "GrSWMaskHelper.h" | 17 #include "GrSWMaskHelper.h" |
18 #include "SkRasterClip.h" | 18 #include "SkRasterClip.h" |
19 #include "SkStrokeRec.h" | 19 #include "SkStrokeRec.h" |
20 #include "SkTLazy.h" | 20 #include "SkTLazy.h" |
21 #include "effects/GrConvexPolyEffect.h" | |
22 #include "effects/GrPorterDuffXferProcessor.h" | |
23 #include "effects/GrRRectEffect.h" | |
21 #include "effects/GrTextureDomain.h" | 24 #include "effects/GrTextureDomain.h" |
22 #include "effects/GrConvexPolyEffect.h" | |
23 #include "effects/GrRRectEffect.h" | |
24 | 25 |
25 #define GR_AA_CLIP 1 | 26 #define GR_AA_CLIP 1 |
26 typedef SkClipStack::Element Element; | 27 typedef SkClipStack::Element Element; |
27 | 28 |
28 //////////////////////////////////////////////////////////////////////////////// | 29 //////////////////////////////////////////////////////////////////////////////// |
29 namespace { | 30 namespace { |
30 // set up the draw state to enable the aa clipping mask. Besides setting up the | 31 // set up the draw state to enable the aa clipping mask. Besides setting up the |
31 // stage matrix this also alters the vertex layout | 32 // stage matrix this also alters the vertex layout |
32 void setup_drawstate_aaclip(const SkIRect &devBound, | 33 void setup_drawstate_aaclip(const SkIRect &devBound, |
33 GrDrawState* drawState, | 34 GrDrawState* drawState, |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 return true; | 328 return true; |
328 } | 329 } |
329 | 330 |
330 namespace { | 331 namespace { |
331 //////////////////////////////////////////////////////////////////////////////// | 332 //////////////////////////////////////////////////////////////////////////////// |
332 // set up the OpenGL blend function to perform the specified | 333 // set up the OpenGL blend function to perform the specified |
333 // boolean operation for alpha clip mask creation | 334 // boolean operation for alpha clip mask creation |
334 void setup_boolean_blendcoeffs(SkRegion::Op op, GrDrawState* drawState) { | 335 void setup_boolean_blendcoeffs(SkRegion::Op op, GrDrawState* drawState) { |
335 switch (op) { | 336 switch (op) { |
336 case SkRegion::kReplace_Op: | 337 case SkRegion::kReplace_Op: |
337 drawState->setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff); | 338 drawState->setPorterDuffXPFactory(kOne_GrBlendCoeff, kZero_GrBlendCo eff); |
bsalomon
2014/12/08 15:38:51
Just FYI, these will all be coverage drawing xp in
egdaniel
2014/12/08 16:24:01
Okay. Added todo to annotate this fact.
| |
338 break; | 339 break; |
339 case SkRegion::kIntersect_Op: | 340 case SkRegion::kIntersect_Op: |
340 drawState->setBlendFunc(kDC_GrBlendCoeff, kZero_GrBlendCoeff); | 341 drawState->setPorterDuffXPFactory(kDC_GrBlendCoeff, kZero_GrBlendCoe ff); |
341 break; | 342 break; |
342 case SkRegion::kUnion_Op: | 343 case SkRegion::kUnion_Op: |
343 drawState->setBlendFunc(kOne_GrBlendCoeff, kISC_GrBlendCoeff); | 344 drawState->setPorterDuffXPFactory(kOne_GrBlendCoeff, kISC_GrBlendCoe ff); |
344 break; | 345 break; |
345 case SkRegion::kXOR_Op: | 346 case SkRegion::kXOR_Op: |
346 drawState->setBlendFunc(kIDC_GrBlendCoeff, kISC_GrBlendCoeff); | 347 drawState->setPorterDuffXPFactory(kIDC_GrBlendCoeff, kISC_GrBlendCoe ff); |
347 break; | 348 break; |
348 case SkRegion::kDifference_Op: | 349 case SkRegion::kDifference_Op: |
349 drawState->setBlendFunc(kZero_GrBlendCoeff, kISC_GrBlendCoeff); | 350 drawState->setPorterDuffXPFactory(kZero_GrBlendCoeff, kISC_GrBlendCo eff); |
350 break; | 351 break; |
351 case SkRegion::kReverseDifference_Op: | 352 case SkRegion::kReverseDifference_Op: |
352 drawState->setBlendFunc(kIDC_GrBlendCoeff, kZero_GrBlendCoeff); | 353 drawState->setPorterDuffXPFactory(kIDC_GrBlendCoeff, kZero_GrBlendCo eff); |
353 break; | 354 break; |
354 default: | 355 default: |
355 SkASSERT(false); | 356 SkASSERT(false); |
356 break; | 357 break; |
357 } | 358 } |
358 } | 359 } |
359 } | 360 } |
360 | 361 |
361 //////////////////////////////////////////////////////////////////////////////// | 362 //////////////////////////////////////////////////////////////////////////////// |
362 bool GrClipMaskManager::drawElement(GrDrawState* drawState, | 363 bool GrClipMaskManager::drawElement(GrDrawState* drawState, |
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1075 } | 1076 } |
1076 | 1077 |
1077 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer, | 1078 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer, |
1078 GrStencilSettings* settings) { | 1079 GrStencilSettings* settings) { |
1079 // TODO: dynamically attach a stencil buffer | 1080 // TODO: dynamically attach a stencil buffer |
1080 if (stencilBuffer) { | 1081 if (stencilBuffer) { |
1081 int stencilBits = stencilBuffer->bits(); | 1082 int stencilBits = stencilBuffer->bits(); |
1082 this->adjustStencilParams(settings, fClipMode, stencilBits); | 1083 this->adjustStencilParams(settings, fClipMode, stencilBits); |
1083 } | 1084 } |
1084 } | 1085 } |
OLD | NEW |