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

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

Issue 22850006: Replace uses of GrAssert by SkASSERT. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years, 4 months 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrStencil.h ('k') | src/gpu/GrStencilBuffer.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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "GrStencilAndCoverPathRenderer.h" 10 #include "GrStencilAndCoverPathRenderer.h"
11 #include "GrContext.h" 11 #include "GrContext.h"
12 #include "GrDrawTargetCaps.h" 12 #include "GrDrawTargetCaps.h"
13 #include "GrGpu.h" 13 #include "GrGpu.h"
14 #include "GrPath.h" 14 #include "GrPath.h"
15 #include "SkStrokeRec.h" 15 #include "SkStrokeRec.h"
16 16
17 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) { 17 GrPathRenderer* GrStencilAndCoverPathRenderer::Create(GrContext* context) {
18 GrAssert(NULL != context); 18 SkASSERT(NULL != context);
19 GrAssert(NULL != context->getGpu()); 19 SkASSERT(NULL != context->getGpu());
20 if (context->getGpu()->caps()->pathStencilingSupport()) { 20 if (context->getGpu()->caps()->pathStencilingSupport()) {
21 return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (context->getGpu())); 21 return SkNEW_ARGS(GrStencilAndCoverPathRenderer, (context->getGpu()));
22 } else { 22 } else {
23 return NULL; 23 return NULL;
24 } 24 }
25 } 25 }
26 26
27 GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrGpu* gpu) { 27 GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrGpu* gpu) {
28 GrAssert(gpu->caps()->pathStencilingSupport()); 28 SkASSERT(gpu->caps()->pathStencilingSupport());
29 fGpu = gpu; 29 fGpu = gpu;
30 gpu->ref(); 30 gpu->ref();
31 } 31 }
32 32
33 GrStencilAndCoverPathRenderer::~GrStencilAndCoverPathRenderer() { 33 GrStencilAndCoverPathRenderer::~GrStencilAndCoverPathRenderer() {
34 fGpu->unref(); 34 fGpu->unref();
35 } 35 }
36 36
37 bool GrStencilAndCoverPathRenderer::canDrawPath(const SkPath& path, 37 bool GrStencilAndCoverPathRenderer::canDrawPath(const SkPath& path,
38 const SkStrokeRec& stroke, 38 const SkStrokeRec& stroke,
39 const GrDrawTarget* target, 39 const GrDrawTarget* target,
40 bool antiAlias) const { 40 bool antiAlias) const {
41 return stroke.isFillStyle() && 41 return stroke.isFillStyle() &&
42 !antiAlias && // doesn't do per-path AA, relies on the target having MSAA 42 !antiAlias && // doesn't do per-path AA, relies on the target having MSAA
43 target->getDrawState().getStencil().isDisabled(); 43 target->getDrawState().getStencil().isDisabled();
44 } 44 }
45 45
46 GrPathRenderer::StencilSupport GrStencilAndCoverPathRenderer::onGetStencilSuppor t( 46 GrPathRenderer::StencilSupport GrStencilAndCoverPathRenderer::onGetStencilSuppor t(
47 const SkPath&, 47 const SkPath&,
48 const SkStrokeRec& , 48 const SkStrokeRec& ,
49 const GrDrawTarget*) con st { 49 const GrDrawTarget*) con st {
50 return GrPathRenderer::kStencilOnly_StencilSupport; 50 return GrPathRenderer::kStencilOnly_StencilSupport;
51 } 51 }
52 52
53 void GrStencilAndCoverPathRenderer::onStencilPath(const SkPath& path, 53 void GrStencilAndCoverPathRenderer::onStencilPath(const SkPath& path,
54 const SkStrokeRec& stroke, 54 const SkStrokeRec& stroke,
55 GrDrawTarget* target) { 55 GrDrawTarget* target) {
56 GrAssert(!path.isInverseFillType()); 56 SkASSERT(!path.isInverseFillType());
57 SkAutoTUnref<GrPath> p(fGpu->createPath(path)); 57 SkAutoTUnref<GrPath> p(fGpu->createPath(path));
58 target->stencilPath(p, stroke, path.getFillType()); 58 target->stencilPath(p, stroke, path.getFillType());
59 } 59 }
60 60
61 bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path, 61 bool GrStencilAndCoverPathRenderer::onDrawPath(const SkPath& path,
62 const SkStrokeRec& stroke, 62 const SkStrokeRec& stroke,
63 GrDrawTarget* target, 63 GrDrawTarget* target,
64 bool antiAlias) { 64 bool antiAlias) {
65 GrAssert(!antiAlias); 65 SkASSERT(!antiAlias);
66 GrAssert(!stroke.isHairlineStyle()); 66 SkASSERT(!stroke.isHairlineStyle());
67 67
68 GrDrawState* drawState = target->drawState(); 68 GrDrawState* drawState = target->drawState();
69 GrAssert(drawState->getStencil().isDisabled()); 69 SkASSERT(drawState->getStencil().isDisabled());
70 70
71 SkAutoTUnref<GrPath> p(fGpu->createPath(path)); 71 SkAutoTUnref<GrPath> p(fGpu->createPath(path));
72 72
73 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(path. getFillType()); 73 SkPath::FillType nonInvertedFill = SkPath::ConvertToNonInverseFillType(path. getFillType());
74 target->stencilPath(p, stroke, nonInvertedFill); 74 target->stencilPath(p, stroke, nonInvertedFill);
75 75
76 // TODO: Use built in cover operation rather than a rect draw. This will req uire making our 76 // TODO: Use built in cover operation rather than a rect draw. This will req uire making our
77 // fragment shaders be able to eat varyings generated by a matrix. 77 // fragment shaders be able to eat varyings generated by a matrix.
78 78
79 // fill the path, zero out the stencil 79 // fill the path, zero out the stencil
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 avmr.setIdentity(drawState); 114 avmr.setIdentity(drawState);
115 bloat = 0; 115 bloat = 0;
116 } 116 }
117 *drawState->stencil() = kInvertedStencilPass; 117 *drawState->stencil() = kInvertedStencilPass;
118 } 118 }
119 bounds.outset(bloat, bloat); 119 bounds.outset(bloat, bloat);
120 target->drawSimpleRect(bounds, NULL); 120 target->drawSimpleRect(bounds, NULL);
121 target->drawState()->stencil()->setDisabled(); 121 target->drawState()->stencil()->setDisabled();
122 return true; 122 return true;
123 } 123 }
OLDNEW
« no previous file with comments | « src/gpu/GrStencil.h ('k') | src/gpu/GrStencilBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698