OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "GrOvalRenderer.h" | 8 #include "GrOvalRenderer.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType, | 78 fInPosition = &this->addVertexAttrib(Attribute("inPosition", kVec2f_GrVe
rtexAttribType, |
79 kHigh_GrSLPrecision)); | 79 kHigh_GrSLPrecision)); |
80 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA
ttribType)); | 80 fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexA
ttribType)); |
81 fInCircleEdge = &this->addVertexAttrib(Attribute("inCircleEdge", | 81 fInCircleEdge = &this->addVertexAttrib(Attribute("inCircleEdge", |
82 kVec4f_GrVertexAttribTy
pe)); | 82 kVec4f_GrVertexAttribTy
pe)); |
83 fStroke = stroke; | 83 fStroke = stroke; |
84 } | 84 } |
85 | 85 |
86 bool implementsDistanceVector() const override { return true; }; | 86 bool implementsDistanceVector() const override { return true; }; |
87 | 87 |
88 const SkMatrix& localMatrix() const { return fLocalMatrix; } | |
89 | |
90 virtual ~CircleGeometryProcessor() {} | 88 virtual ~CircleGeometryProcessor() {} |
91 | 89 |
92 const char* name() const override { return "CircleEdge"; } | 90 const char* name() const override { return "CircleEdge"; } |
93 | 91 |
94 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override { | 92 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override { |
95 GLSLProcessor::GenKey(*this, caps, b); | 93 GLSLProcessor::GenKey(*this, caps, b); |
96 } | 94 } |
97 | 95 |
98 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri
de { | 96 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri
de { |
99 return new GLSLProcessor(); | 97 return new GLSLProcessor(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 164 } |
167 | 165 |
168 void setData(const GrGLSLProgramDataManager& pdman, | 166 void setData(const GrGLSLProgramDataManager& pdman, |
169 const GrPrimitiveProcessor& gp) override { | 167 const GrPrimitiveProcessor& gp) override { |
170 } | 168 } |
171 | 169 |
172 void setTransformData(const GrPrimitiveProcessor& primProc, | 170 void setTransformData(const GrPrimitiveProcessor& primProc, |
173 const GrGLSLProgramDataManager& pdman, | 171 const GrGLSLProgramDataManager& pdman, |
174 int index, | 172 int index, |
175 const SkTArray<const GrCoordTransform*, true>& tra
nsforms) override { | 173 const SkTArray<const GrCoordTransform*, true>& tra
nsforms) override { |
176 this->setTransformDataHelper<CircleGeometryProcessor>(primProc, pdma
n, index, | 174 this->setTransformDataHelper(primProc.cast<CircleGeometryProcessor>(
).fLocalMatrix, |
177 transforms); | 175 pdman, index, transforms); |
178 } | 176 } |
179 | 177 |
180 private: | 178 private: |
181 typedef GrGLSLGeometryProcessor INHERITED; | 179 typedef GrGLSLGeometryProcessor INHERITED; |
182 }; | 180 }; |
183 | 181 |
184 SkMatrix fLocalMatrix; | 182 SkMatrix fLocalMatrix; |
185 const Attribute* fInPosition; | 183 const Attribute* fInPosition; |
186 const Attribute* fInColor; | 184 const Attribute* fInColor; |
187 const Attribute* fInCircleEdge; | 185 const Attribute* fInCircleEdge; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 kVec2f_GrVertexAttri
bType)); | 218 kVec2f_GrVertexAttri
bType)); |
221 fInEllipseRadii = &this->addVertexAttrib(Attribute("inEllipseRadii", | 219 fInEllipseRadii = &this->addVertexAttrib(Attribute("inEllipseRadii", |
222 kVec4f_GrVertexAttrib
Type)); | 220 kVec4f_GrVertexAttrib
Type)); |
223 fStroke = stroke; | 221 fStroke = stroke; |
224 } | 222 } |
225 | 223 |
226 virtual ~EllipseGeometryProcessor() {} | 224 virtual ~EllipseGeometryProcessor() {} |
227 | 225 |
228 const char* name() const override { return "EllipseEdge"; } | 226 const char* name() const override { return "EllipseEdge"; } |
229 | 227 |
230 const SkMatrix& localMatrix() const { return fLocalMatrix; } | |
231 | |
232 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override { | 228 void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) c
onst override { |
233 GLSLProcessor::GenKey(*this, caps, b); | 229 GLSLProcessor::GenKey(*this, caps, b); |
234 } | 230 } |
235 | 231 |
236 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri
de { | 232 GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const overri
de { |
237 return new GLSLProcessor(); | 233 return new GLSLProcessor(); |
238 } | 234 } |
239 | 235 |
240 private: | 236 private: |
241 class GLSLProcessor : public GrGLSLGeometryProcessor { | 237 class GLSLProcessor : public GrGLSLGeometryProcessor { |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 b->add32(key); | 309 b->add32(key); |
314 } | 310 } |
315 | 311 |
316 void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitivePro
cessor& gp) override { | 312 void setData(const GrGLSLProgramDataManager& pdman, const GrPrimitivePro
cessor& gp) override { |
317 } | 313 } |
318 | 314 |
319 void setTransformData(const GrPrimitiveProcessor& primProc, | 315 void setTransformData(const GrPrimitiveProcessor& primProc, |
320 const GrGLSLProgramDataManager& pdman, | 316 const GrGLSLProgramDataManager& pdman, |
321 int index, | 317 int index, |
322 const SkTArray<const GrCoordTransform*, true>& tra
nsforms) override { | 318 const SkTArray<const GrCoordTransform*, true>& tra
nsforms) override { |
323 this->setTransformDataHelper<EllipseGeometryProcessor>(primProc, pdm
an, index, | 319 this->setTransformDataHelper(primProc.cast<EllipseGeometryProcessor>
().fLocalMatrix, |
324 transforms); | 320 pdman, index, transforms); |
325 } | 321 } |
326 | 322 |
327 private: | 323 private: |
328 typedef GrGLSLGeometryProcessor INHERITED; | 324 typedef GrGLSLGeometryProcessor INHERITED; |
329 }; | 325 }; |
330 | 326 |
331 const Attribute* fInPosition; | 327 const Attribute* fInPosition; |
332 const Attribute* fInColor; | 328 const Attribute* fInColor; |
333 const Attribute* fInEllipseOffset; | 329 const Attribute* fInEllipseOffset; |
334 const Attribute* fInEllipseRadii; | 330 const Attribute* fInEllipseRadii; |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1693 } | 1689 } |
1694 | 1690 |
1695 DRAW_BATCH_TEST_DEFINE(RRectBatch) { | 1691 DRAW_BATCH_TEST_DEFINE(RRectBatch) { |
1696 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); | 1692 SkMatrix viewMatrix = GrTest::TestMatrixRectStaysRect(random); |
1697 GrColor color = GrRandomColor(random); | 1693 GrColor color = GrRandomColor(random); |
1698 const SkRRect& rrect = GrTest::TestRRectSimple(random); | 1694 const SkRRect& rrect = GrTest::TestRRectSimple(random); |
1699 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); | 1695 return create_rrect_batch(color, viewMatrix, rrect, GrTest::TestStrokeRec(ra
ndom)); |
1700 } | 1696 } |
1701 | 1697 |
1702 #endif | 1698 #endif |
OLD | NEW |