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

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

Issue 1001503002: Implement support for mixed sampled render targets (Closed) Base URL: https://skia.googlesource.com/skia.git@mix1
Patch Set: Fix build error related to isMultisamped renaming Created 5 years, 6 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/GrPipelineBuilder.cpp ('k') | src/gpu/GrStencilAndCoverTextContext.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"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrResourceProvider* resourceProvider) 44 GrStencilAndCoverPathRenderer::GrStencilAndCoverPathRenderer(GrResourceProvider* resourceProvider)
45 : fResourceProvider(resourceProvider) { 45 : fResourceProvider(resourceProvider) {
46 } 46 }
47 47
48 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target, 48 bool GrStencilAndCoverPathRenderer::canDrawPath(const GrDrawTarget* target,
49 const GrPipelineBuilder* pipelin eBuilder, 49 const GrPipelineBuilder* pipelin eBuilder,
50 const SkMatrix& viewMatrix, 50 const SkMatrix& viewMatrix,
51 const SkPath& path, 51 const SkPath& path,
52 const GrStrokeInfo& stroke, 52 const GrStrokeInfo& stroke,
53 bool antiAlias) const { 53 bool antiAlias) const {
54 return !stroke.isHairlineStyle() && 54 if (stroke.isHairlineStyle()) {
55 !antiAlias && // doesn't do per-path AA, relies on the target having MSA A 55 return false;
56 pipelineBuilder->getStencil().isDisabled(); 56 }
57 if (!pipelineBuilder->getStencil().isDisabled()) {
58 return false;
59 }
60 if (antiAlias) {
61 return pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled() ;
62 } else {
63 return true; // doesn't do per-path AA, relies on the target having MSAA
64 }
57 } 65 }
58 66
59 GrPathRenderer::StencilSupport 67 GrPathRenderer::StencilSupport
60 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*, 68 GrStencilAndCoverPathRenderer::onGetStencilSupport(const GrDrawTarget*,
61 const GrPipelineBuilder*, 69 const GrPipelineBuilder*,
62 const SkPath&, 70 const SkPath&,
63 const GrStrokeInfo&) const { 71 const GrStrokeInfo&) const {
64 return GrPathRenderer::kStencilOnly_StencilSupport; 72 return GrPathRenderer::kStencilOnly_StencilSupport;
65 } 73 }
66 74
(...skipping 26 matching lines...) Expand all
93 target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.get FillType())); 101 target->stencilPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.get FillType()));
94 } 102 }
95 103
96 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target, 104 bool GrStencilAndCoverPathRenderer::onDrawPath(GrDrawTarget* target,
97 GrPipelineBuilder* pipelineBuilde r, 105 GrPipelineBuilder* pipelineBuilde r,
98 GrColor color, 106 GrColor color,
99 const SkMatrix& viewMatrix, 107 const SkMatrix& viewMatrix,
100 const SkPath& path, 108 const SkPath& path,
101 const GrStrokeInfo& stroke, 109 const GrStrokeInfo& stroke,
102 bool antiAlias) { 110 bool antiAlias) {
103 SkASSERT(!antiAlias);
104 SkASSERT(!stroke.isHairlineStyle()); 111 SkASSERT(!stroke.isHairlineStyle());
105 SkASSERT(pipelineBuilder->getStencil().isDisabled()); 112 SkASSERT(pipelineBuilder->getStencil().isDisabled());
106 113
114 if (antiAlias) {
115 SkASSERT(pipelineBuilder->getRenderTarget()->isStencilBufferMultisampled ());
116 pipelineBuilder->enableState(GrPipelineBuilder::kHWAntialias_Flag);
117 }
118
107 SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, stroke)); 119 SkAutoTUnref<GrPath> p(get_gr_path(fResourceProvider, path, stroke));
108 120
109 if (path.isInverseFillType()) { 121 if (path.isInverseFillType()) {
110 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass, 122 GR_STATIC_CONST_SAME_STENCIL(kInvertedStencilPass,
111 kZero_StencilOp, 123 kZero_StencilOp,
112 kZero_StencilOp, 124 kZero_StencilOp,
113 // We know our rect will hit pixels outside the clip and the user bi ts will be 0 125 // We know our rect will hit pixels outside the clip and the user bi ts will be 0
114 // outside the clip. So we can't just fill where the user bits are 0 . We also need to 126 // outside the clip. So we can't just fill where the user bits are 0 . We also need to
115 // check that the clip bit is set. 127 // check that the clip bit is set.
116 kEqualIfInClip_StencilFunc, 128 kEqualIfInClip_StencilFunc,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 0xffff); 165 0xffff);
154 166
155 pipelineBuilder->setStencil(kStencilPass); 167 pipelineBuilder->setStencil(kStencilPass);
156 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix)); 168 SkAutoTUnref<GrPathProcessor> pp(GrPathProcessor::Create(color, viewMatr ix));
157 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType())); 169 target->drawPath(pipelineBuilder, pp, p, convert_skpath_filltype(path.ge tFillType()));
158 } 170 }
159 171
160 pipelineBuilder->stencil()->setDisabled(); 172 pipelineBuilder->stencil()->setDisabled();
161 return true; 173 return true;
162 } 174 }
OLDNEW
« no previous file with comments | « src/gpu/GrPipelineBuilder.cpp ('k') | src/gpu/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698