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

Side by Side Diff: src/gpu/batches/GrAAConvexPathRenderer.cpp

Issue 1428543003: Create GLSL base class for ProgramDataManager (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add space Created 5 years, 1 month 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/GrPathProcessor.cpp ('k') | src/gpu/effects/GrBezierEffect.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 #include "GrAAConvexPathRenderer.h" 9 #include "GrAAConvexPathRenderer.h"
10 10
(...skipping 10 matching lines...) Expand all
21 #include "GrPipelineBuilder.h" 21 #include "GrPipelineBuilder.h"
22 #include "GrStrokeInfo.h" 22 #include "GrStrokeInfo.h"
23 #include "SkGeometry.h" 23 #include "SkGeometry.h"
24 #include "SkPathPriv.h" 24 #include "SkPathPriv.h"
25 #include "SkString.h" 25 #include "SkString.h"
26 #include "SkTraceEvent.h" 26 #include "SkTraceEvent.h"
27 #include "batches/GrVertexBatch.h" 27 #include "batches/GrVertexBatch.h"
28 #include "gl/GrGLProcessor.h" 28 #include "gl/GrGLProcessor.h"
29 #include "gl/GrGLGeometryProcessor.h" 29 #include "gl/GrGLGeometryProcessor.h"
30 #include "gl/builders/GrGLProgramBuilder.h" 30 #include "gl/builders/GrGLProgramBuilder.h"
31 #include "glsl/GrGLSLProgramDataManager.h"
31 32
32 GrAAConvexPathRenderer::GrAAConvexPathRenderer() { 33 GrAAConvexPathRenderer::GrAAConvexPathRenderer() {
33 } 34 }
34 35
35 struct Segment { 36 struct Segment {
36 enum { 37 enum {
37 // These enum values are assumed in member functions below. 38 // These enum values are assumed in member functions below.
38 kLine = 0, 39 kLine = 0,
39 kQuad = 1, 40 kQuad = 1,
40 } fType; 41 } fType;
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 static inline void GenKey(const GrGeometryProcessor& gp, 599 static inline void GenKey(const GrGeometryProcessor& gp,
599 const GrGLSLCaps&, 600 const GrGLSLCaps&,
600 GrProcessorKeyBuilder* b) { 601 GrProcessorKeyBuilder* b) {
601 const QuadEdgeEffect& qee = gp.cast<QuadEdgeEffect>(); 602 const QuadEdgeEffect& qee = gp.cast<QuadEdgeEffect>();
602 uint32_t key = 0; 603 uint32_t key = 0;
603 key |= qee.usesLocalCoords() && qee.localMatrix().hasPerspective() ? 0x1 : 0x0; 604 key |= qee.usesLocalCoords() && qee.localMatrix().hasPerspective() ? 0x1 : 0x0;
604 key |= qee.colorIgnored() ? 0x2 : 0x0; 605 key |= qee.colorIgnored() ? 0x2 : 0x0;
605 b->add32(key); 606 b->add32(key);
606 } 607 }
607 608
608 void setData(const GrGLProgramDataManager& pdman, const GrPrimitiveProce ssor& gp) override { 609 void setData(const GrGLSLProgramDataManager& pdman,
610 const GrPrimitiveProcessor& gp) override {
609 const QuadEdgeEffect& qe = gp.cast<QuadEdgeEffect>(); 611 const QuadEdgeEffect& qe = gp.cast<QuadEdgeEffect>();
610 if (qe.color() != fColor) { 612 if (qe.color() != fColor) {
611 GrGLfloat c[4]; 613 float c[4];
612 GrColorToRGBAFloat(qe.color(), c); 614 GrColorToRGBAFloat(qe.color(), c);
613 pdman.set4fv(fColorUniform, 1, c); 615 pdman.set4fv(fColorUniform, 1, c);
614 fColor = qe.color(); 616 fColor = qe.color();
615 } 617 }
616 } 618 }
617 619
618 void setTransformData(const GrPrimitiveProcessor& primProc, 620 void setTransformData(const GrPrimitiveProcessor& primProc,
619 const GrGLProgramDataManager& pdman, 621 const GrGLSLProgramDataManager& pdman,
620 int index, 622 int index,
621 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override { 623 const SkTArray<const GrCoordTransform*, true>& tra nsforms) override {
622 this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index, transforms); 624 this->setTransformDataHelper<QuadEdgeEffect>(primProc, pdman, index, transforms);
623 } 625 }
624 626
625 private: 627 private:
626 GrColor fColor; 628 GrColor fColor;
627 UniformHandle fColorUniform; 629 UniformHandle fColorUniform;
628 630
629 typedef GrGLGeometryProcessor INHERITED; 631 typedef GrGLGeometryProcessor INHERITED;
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) { 1008 DRAW_BATCH_TEST_DEFINE(AAConvexPathBatch) {
1007 AAConvexPathBatch::Geometry geometry; 1009 AAConvexPathBatch::Geometry geometry;
1008 geometry.fColor = GrRandomColor(random); 1010 geometry.fColor = GrRandomColor(random);
1009 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random); 1011 geometry.fViewMatrix = GrTest::TestMatrixInvertible(random);
1010 geometry.fPath = GrTest::TestPathConvex(random); 1012 geometry.fPath = GrTest::TestPathConvex(random);
1011 1013
1012 return AAConvexPathBatch::Create(geometry); 1014 return AAConvexPathBatch::Create(geometry);
1013 } 1015 }
1014 1016
1015 #endif 1017 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPathProcessor.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698