Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(476)

Side by Side Diff: src/gpu/GrClipMaskManager.cpp

Issue 759713002: Make all blending up to GrOptDrawState be handled by the xp/xp factory. (Closed) Base URL: https://skia.googlesource.com/skia.git@xferFactorySolo
Patch Set: rebase Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 scissorState->set(scissorSpaceIBounds); 326 scissorState->set(scissorSpaceIBounds);
326 this->setDrawStateStencil(drawState, ars); 327 this->setDrawStateStencil(drawState, ars);
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) {
336 // TODO: once we have a coverageDrawing XP this will all use that instead of PD
335 switch (op) { 337 switch (op) {
336 case SkRegion::kReplace_Op: 338 case SkRegion::kReplace_Op:
337 drawState->setBlendFunc(kOne_GrBlendCoeff, kZero_GrBlendCoeff); 339 drawState->setPorterDuffXPFactory(kOne_GrBlendCoeff, kZero_GrBlendCo eff);
338 break; 340 break;
339 case SkRegion::kIntersect_Op: 341 case SkRegion::kIntersect_Op:
340 drawState->setBlendFunc(kDC_GrBlendCoeff, kZero_GrBlendCoeff); 342 drawState->setPorterDuffXPFactory(kDC_GrBlendCoeff, kZero_GrBlendCoe ff);
341 break; 343 break;
342 case SkRegion::kUnion_Op: 344 case SkRegion::kUnion_Op:
343 drawState->setBlendFunc(kOne_GrBlendCoeff, kISC_GrBlendCoeff); 345 drawState->setPorterDuffXPFactory(kOne_GrBlendCoeff, kISC_GrBlendCoe ff);
344 break; 346 break;
345 case SkRegion::kXOR_Op: 347 case SkRegion::kXOR_Op:
346 drawState->setBlendFunc(kIDC_GrBlendCoeff, kISC_GrBlendCoeff); 348 drawState->setPorterDuffXPFactory(kIDC_GrBlendCoeff, kISC_GrBlendCoe ff);
347 break; 349 break;
348 case SkRegion::kDifference_Op: 350 case SkRegion::kDifference_Op:
349 drawState->setBlendFunc(kZero_GrBlendCoeff, kISC_GrBlendCoeff); 351 drawState->setPorterDuffXPFactory(kZero_GrBlendCoeff, kISC_GrBlendCo eff);
350 break; 352 break;
351 case SkRegion::kReverseDifference_Op: 353 case SkRegion::kReverseDifference_Op:
352 drawState->setBlendFunc(kIDC_GrBlendCoeff, kZero_GrBlendCoeff); 354 drawState->setPorterDuffXPFactory(kIDC_GrBlendCoeff, kZero_GrBlendCo eff);
353 break; 355 break;
354 default: 356 default:
355 SkASSERT(false); 357 SkASSERT(false);
356 break; 358 break;
357 } 359 }
358 } 360 }
359 } 361 }
360 362
361 //////////////////////////////////////////////////////////////////////////////// 363 ////////////////////////////////////////////////////////////////////////////////
362 bool GrClipMaskManager::drawElement(GrDrawState* drawState, 364 bool GrClipMaskManager::drawElement(GrDrawState* drawState,
(...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 } 1077 }
1076 1078
1077 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer, 1079 void GrClipMaskManager::adjustPathStencilParams(const GrStencilBuffer* stencilBu ffer,
1078 GrStencilSettings* settings) { 1080 GrStencilSettings* settings) {
1079 // TODO: dynamically attach a stencil buffer 1081 // TODO: dynamically attach a stencil buffer
1080 if (stencilBuffer) { 1082 if (stencilBuffer) {
1081 int stencilBits = stencilBuffer->bits(); 1083 int stencilBits = stencilBuffer->bits();
1082 this->adjustStencilParams(settings, fClipMode, stencilBits); 1084 this->adjustStencilParams(settings, fClipMode, stencilBits);
1083 } 1085 }
1084 } 1086 }
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698