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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/gpu/GrStrokeInfo.h » ('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 SkASSERT(NULL != context); 18 SkASSERT(context);
19 SkASSERT(NULL != context->getGpu()); 19 SkASSERT(context->getGpu());
20 if (context->getGpu()->caps()->pathRenderingSupport()) { 20 if (context->getGpu()->caps()->pathRenderingSupport()) {
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 SkASSERT(gpu->caps()->pathRenderingSupport()); 28 SkASSERT(gpu->caps()->pathRenderingSupport());
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.isHairlineStyle() && 41 return !stroke.isHairlineStyle() &&
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 NULL != target->getDrawState().getRenderTarget()->getStencilBuffer() && 43 target->getDrawState().getRenderTarget()->getStencilBuffer() &&
44 target->getDrawState().getStencil().isDisabled(); 44 target->getDrawState().getStencil().isDisabled();
45 } 45 }
46 46
47 GrPathRenderer::StencilSupport GrStencilAndCoverPathRenderer::onGetStencilSuppor t( 47 GrPathRenderer::StencilSupport GrStencilAndCoverPathRenderer::onGetStencilSuppor t(
48 const SkPath&, 48 const SkPath&,
49 const SkStrokeRec& , 49 const SkStrokeRec& ,
50 const GrDrawTarget*) con st { 50 const GrDrawTarget*) con st {
51 return GrPathRenderer::kStencilOnly_StencilSupport; 51 return GrPathRenderer::kStencilOnly_StencilSupport;
52 } 52 }
53 53
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 0xffff); 94 0xffff);
95 95
96 *drawState->stencil() = kStencilPass; 96 *drawState->stencil() = kStencilPass;
97 } 97 }
98 98
99 target->drawPath(p, path.getFillType()); 99 target->drawPath(p, path.getFillType());
100 100
101 target->drawState()->stencil()->setDisabled(); 101 target->drawState()->stencil()->setDisabled();
102 return true; 102 return true;
103 } 103 }
OLDNEW
« no previous file with comments | « src/gpu/GrSWMaskHelper.cpp ('k') | src/gpu/GrStrokeInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698