OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "GrMSAAPathRenderer.h" | 8 #include "GrMSAAPathRenderer.h" |
9 | 9 |
10 #include "GrAuditTrail.h" | 10 #include "GrAuditTrail.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 GrGLSLVertToFrag uv(kVec2f_GrSLType); | 141 GrGLSLVertToFrag uv(kVec2f_GrSLType); |
142 varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision); | 142 varyingHandler->addVarying("uv", &uv, kHigh_GrSLPrecision); |
143 vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qp.inUV()->fName); | 143 vsBuilder->codeAppendf("%s = %s;", uv.vsOut(), qp.inUV()->fName); |
144 | 144 |
145 // Setup position | 145 // Setup position |
146 this->setupPosition(vsBuilder, uniformHandler, gpArgs, qp.inPosition
()->fName, | 146 this->setupPosition(vsBuilder, uniformHandler, gpArgs, qp.inPosition
()->fName, |
147 qp.viewMatrix(), &fViewMatrixUniform); | 147 qp.viewMatrix(), &fViewMatrixUniform); |
148 | 148 |
149 // emit transforms | 149 // emit transforms |
150 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr
gs->fPositionVar, | 150 this->emitTransforms(vsBuilder, varyingHandler, uniformHandler, gpAr
gs->fPositionVar, |
151 qp.inPosition()->fName, SkMatrix::I(), | 151 qp.inPosition()->fName, SkMatrix::I(), args.fTr
ansformsIn, |
152 args.fFPCoordTransformHandler); | 152 args.fTransformsOut); |
153 | 153 |
154 GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder; | 154 GrGLSLPPFragmentBuilder* fsBuilder = args.fFragBuilder; |
155 fsBuilder->codeAppendf("if (%s.x * %s.x >= %s.y) discard;", uv.fsIn(
), uv.fsIn(), | 155 fsBuilder->codeAppendf("if (%s.x * %s.x >= %s.y) discard;", uv.fsIn(
), uv.fsIn(), |
156 uv.fsIn(
)); | 156 uv.fsIn(
)); |
157 fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputCoverage); | 157 fsBuilder->codeAppendf("%s = vec4(1.0);", args.fOutputCoverage); |
158 } | 158 } |
159 | 159 |
160 static inline void GenKey(const GrGeometryProcessor& gp, | 160 static inline void GenKey(const GrGeometryProcessor& gp, |
161 const GrGLSLCaps&, | 161 const GrGLSLCaps&, |
162 GrProcessorKeyBuilder* b) { | 162 GrProcessorKeyBuilder* b) { |
163 const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); | 163 const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); |
164 uint32_t key = 0; | 164 uint32_t key = 0; |
165 key |= qp.viewMatrix().hasPerspective() ? 0x1 : 0x0; | 165 key |= qp.viewMatrix().hasPerspective() ? 0x1 : 0x0; |
166 key |= qp.viewMatrix().isIdentity() ? 0x2: 0x0; | 166 key |= qp.viewMatrix().isIdentity() ? 0x2: 0x0; |
167 b->add32(key); | 167 b->add32(key); |
168 } | 168 } |
169 | 169 |
170 void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitivePro
cessor& gp, | 170 virtual void setData(const GrGLSLProgramDataManager& pdman, |
171 FPCoordTransformIter&& transformIter) override { | 171 const GrPrimitiveProcessor& gp) override { |
172 const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); | 172 const MSAAQuadProcessor& qp = gp.cast<MSAAQuadProcessor>(); |
173 if (!qp.viewMatrix().isIdentity()) { | 173 if (!qp.viewMatrix().isIdentity()) { |
174 float viewMatrix[3 * 3]; | 174 float viewMatrix[3 * 3]; |
175 GrGLSLGetMatrix<3>(viewMatrix, qp.viewMatrix()); | 175 GrGLSLGetMatrix<3>(viewMatrix, qp.viewMatrix()); |
176 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); | 176 pdman.setMatrix3f(fViewMatrixUniform, viewMatrix); |
177 } | 177 } |
178 this->setTransformDataHelper(SkMatrix::I(), pdman, &transformIter); | |
179 } | 178 } |
180 | 179 |
181 private: | 180 private: |
182 typedef GrGLSLGeometryProcessor INHERITED; | 181 typedef GrGLSLGeometryProcessor INHERITED; |
183 | 182 |
184 UniformHandle fViewMatrixUniform; | 183 UniformHandle fViewMatrixUniform; |
185 }; | 184 }; |
186 | 185 |
187 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, | 186 virtual void getGLSLProcessorKey(const GrGLSLCaps& caps, |
188 GrProcessorKeyBuilder* b) const override { | 187 GrProcessorKeyBuilder* b) const override { |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
707 | 706 |
708 GrPaint paint; | 707 GrPaint paint; |
709 paint.setXPFactory(GrDisableColorXPFactory::Make()); | 708 paint.setXPFactory(GrDisableColorXPFactory::Make()); |
710 paint.setAntiAlias(args.fIsAA); | 709 paint.setAntiAlias(args.fIsAA); |
711 | 710 |
712 this->internalDrawPath(args.fDrawContext, paint, GrUserStencilSettings::kUnu
sed, *args.fClip, | 711 this->internalDrawPath(args.fDrawContext, paint, GrUserStencilSettings::kUnu
sed, *args.fClip, |
713 *args.fViewMatrix, *args.fShape, true); | 712 *args.fViewMatrix, *args.fShape, true); |
714 } | 713 } |
715 | 714 |
716 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 715 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
OLD | NEW |