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

Unified Diff: src/gpu/GrOvalRenderer.cpp

Issue 2253903002: Minor cleanup of GP classes in GrOvalRenderer (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix whitespace Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOvalRenderer.cpp
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 89e35a1d707d49160005db46d0d289b66fc7bfad..77ad7c6e2d31debee48db9930a7e31c0b89b3b94 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -85,15 +85,21 @@ public:
bool implementsDistanceVector() const override { return true; };
- const Attribute* inPosition() const { return fInPosition; }
- const Attribute* inColor() const { return fInColor; }
- const Attribute* inCircleEdge() const { return fInCircleEdge; }
const SkMatrix& localMatrix() const { return fLocalMatrix; }
bsalomon 2016/08/17 15:02:39 This localMatrix getter is still needed by a templ
virtual ~CircleGeometryProcessor() {}
const char* name() const override { return "CircleEdge"; }
+ void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
+ GLSLProcessor::GenKey(*this, caps, b);
+ }
+
+ GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override {
+ return new GLSLProcessor();
+ }
+
+private:
class GLSLProcessor : public GrGLSLGeometryProcessor {
public:
GLSLProcessor() {}
@@ -109,22 +115,22 @@ public:
GrGLSLVertToFrag v(kVec4f_GrSLType);
varyingHandler->addVarying("CircleEdge", &v);
- vertBuilder->codeAppendf("%s = %s;", v.vsOut(), cgp.inCircleEdge()->fName);
+ vertBuilder->codeAppendf("%s = %s;", v.vsOut(), cgp.fInCircleEdge->fName);
GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
// setup pass through color
- varyingHandler->addPassThroughAttribute(cgp.inColor(), args.fOutputColor);
+ varyingHandler->addPassThroughAttribute(cgp.fInColor, args.fOutputColor);
// Setup position
- this->setupPosition(vertBuilder, gpArgs, cgp.inPosition()->fName);
+ this->setupPosition(vertBuilder, gpArgs, cgp.fInPosition->fName);
// emit transforms
this->emitTransforms(vertBuilder,
varyingHandler,
uniformHandler,
gpArgs->fPositionVar,
- cgp.inPosition()->fName,
- cgp.localMatrix(),
+ cgp.fInPosition->fName,
+ cgp.fLocalMatrix,
args.fTransformsIn,
args.fTransformsOut);
@@ -155,7 +161,7 @@ public:
GrProcessorKeyBuilder* b) {
const CircleGeometryProcessor& cgp = gp.cast<CircleGeometryProcessor>();
uint16_t key = cgp.fStroke ? 0x1 : 0x0;
- key |= cgp.localMatrix().hasPerspective() ? 0x2 : 0x0;
+ key |= cgp.fLocalMatrix.hasPerspective() ? 0x2 : 0x0;
b->add32(key);
}
@@ -175,15 +181,6 @@ public:
typedef GrGLSLGeometryProcessor INHERITED;
};
- void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
- GLSLProcessor::GenKey(*this, caps, b);
- }
-
- GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override {
- return new GLSLProcessor();
- }
-
-private:
SkMatrix fLocalMatrix;
const Attribute* fInPosition;
const Attribute* fInColor;
@@ -230,12 +227,17 @@ public:
const char* name() const override { return "EllipseEdge"; }
- const Attribute* inPosition() const { return fInPosition; }
- const Attribute* inColor() const { return fInColor; }
- const Attribute* inEllipseOffset() const { return fInEllipseOffset; }
- const Attribute* inEllipseRadii() const { return fInEllipseRadii; }
const SkMatrix& localMatrix() const { return fLocalMatrix; }
+ void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
+ GLSLProcessor::GenKey(*this, caps, b);
+ }
+
+ GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override {
+ return new GLSLProcessor();
+ }
+
+private:
class GLSLProcessor : public GrGLSLGeometryProcessor {
public:
GLSLProcessor() {}
@@ -252,27 +254,27 @@ public:
GrGLSLVertToFrag ellipseOffsets(kVec2f_GrSLType);
varyingHandler->addVarying("EllipseOffsets", &ellipseOffsets);
vertBuilder->codeAppendf("%s = %s;", ellipseOffsets.vsOut(),
- egp.inEllipseOffset()->fName);
+ egp.fInEllipseOffset->fName);
GrGLSLVertToFrag ellipseRadii(kVec4f_GrSLType);
varyingHandler->addVarying("EllipseRadii", &ellipseRadii);
vertBuilder->codeAppendf("%s = %s;", ellipseRadii.vsOut(),
- egp.inEllipseRadii()->fName);
+ egp.fInEllipseRadii->fName);
GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
// setup pass through color
- varyingHandler->addPassThroughAttribute(egp.inColor(), args.fOutputColor);
+ varyingHandler->addPassThroughAttribute(egp.fInColor, args.fOutputColor);
// Setup position
- this->setupPosition(vertBuilder, gpArgs, egp.inPosition()->fName);
+ this->setupPosition(vertBuilder, gpArgs, egp.fInPosition->fName);
// emit transforms
this->emitTransforms(vertBuilder,
varyingHandler,
uniformHandler,
gpArgs->fPositionVar,
- egp.inPosition()->fName,
- egp.localMatrix(),
+ egp.fInPosition->fName,
+ egp.fLocalMatrix,
args.fTransformsIn,
args.fTransformsOut);
@@ -307,7 +309,7 @@ public:
GrProcessorKeyBuilder* b) {
const EllipseGeometryProcessor& egp = gp.cast<EllipseGeometryProcessor>();
uint16_t key = egp.fStroke ? 0x1 : 0x0;
- key |= egp.localMatrix().hasPerspective() ? 0x2 : 0x0;
+ key |= egp.fLocalMatrix.hasPerspective() ? 0x2 : 0x0;
b->add32(key);
}
@@ -326,15 +328,6 @@ public:
typedef GrGLSLGeometryProcessor INHERITED;
};
- void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
- GLSLProcessor::GenKey(*this, caps, b);
- }
-
- GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override {
- return new GLSLProcessor();
- }
-
-private:
const Attribute* fInPosition;
const Attribute* fInColor;
const Attribute* fInEllipseOffset;
@@ -387,12 +380,15 @@ public:
const char* name() const override { return "DIEllipseEdge"; }
- const Attribute* inPosition() const { return fInPosition; }
- const Attribute* inColor() const { return fInColor; }
- const Attribute* inEllipseOffsets0() const { return fInEllipseOffsets0; }
- const Attribute* inEllipseOffsets1() const { return fInEllipseOffsets1; }
- const SkMatrix& viewMatrix() const { return fViewMatrix; }
+ void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
+ GLSLProcessor::GenKey(*this, caps, b);
+ }
+
+ GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override {
+ return new GLSLProcessor();
+ }
+private:
class GLSLProcessor : public GrGLSLGeometryProcessor {
public:
GLSLProcessor()
@@ -410,22 +406,22 @@ public:
GrGLSLVertToFrag offsets0(kVec2f_GrSLType);
varyingHandler->addVarying("EllipseOffsets0", &offsets0);
vertBuilder->codeAppendf("%s = %s;", offsets0.vsOut(),
- diegp.inEllipseOffsets0()->fName);
+ diegp.fInEllipseOffsets0->fName);
GrGLSLVertToFrag offsets1(kVec2f_GrSLType);
varyingHandler->addVarying("EllipseOffsets1", &offsets1);
vertBuilder->codeAppendf("%s = %s;", offsets1.vsOut(),
- diegp.inEllipseOffsets1()->fName);
+ diegp.fInEllipseOffsets1->fName);
GrGLSLPPFragmentBuilder* fragBuilder = args.fFragBuilder;
- varyingHandler->addPassThroughAttribute(diegp.inColor(), args.fOutputColor);
+ varyingHandler->addPassThroughAttribute(diegp.fInColor, args.fOutputColor);
// Setup position
this->setupPosition(vertBuilder,
uniformHandler,
gpArgs,
- diegp.inPosition()->fName,
- diegp.viewMatrix(),
+ diegp.fInPosition->fName,
+ diegp.fViewMatrix,
&fViewMatrixUniform);
// emit transforms
@@ -433,7 +429,7 @@ public:
varyingHandler,
uniformHandler,
gpArgs->fPositionVar,
- diegp.inPosition()->fName,
+ diegp.fInPosition->fName,
args.fTransformsIn,
args.fTransformsOut);
@@ -483,7 +479,7 @@ public:
GrProcessorKeyBuilder* b) {
const DIEllipseGeometryProcessor& diegp = gp.cast<DIEllipseGeometryProcessor>();
uint16_t key = static_cast<uint16_t>(diegp.fStyle);
- key |= ComputePosKey(diegp.viewMatrix()) << 10;
+ key |= ComputePosKey(diegp.fViewMatrix) << 10;
b->add32(key);
}
@@ -491,8 +487,8 @@ public:
const GrPrimitiveProcessor& gp) override {
const DIEllipseGeometryProcessor& diegp = gp.cast<DIEllipseGeometryProcessor>();
- if (!diegp.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(diegp.viewMatrix())) {
- fViewMatrix = diegp.viewMatrix();
+ if (!diegp.fViewMatrix.isIdentity() && !fViewMatrix.cheapEqualTo(diegp.fViewMatrix)) {
+ fViewMatrix = diegp.fViewMatrix;
float viewMatrix[3 * 3];
GrGLSLGetMatrix<3>(viewMatrix, fViewMatrix);
pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
@@ -506,15 +502,6 @@ public:
typedef GrGLSLGeometryProcessor INHERITED;
};
- void getGLSLProcessorKey(const GrGLSLCaps& caps, GrProcessorKeyBuilder* b) const override {
- GLSLProcessor::GenKey(*this, caps, b);
- }
-
- GrGLSLPrimitiveProcessor* createGLSLInstance(const GrGLSLCaps&) const override {
- return new GLSLProcessor();
- }
-
-private:
const Attribute* fInPosition;
const Attribute* fInColor;
const Attribute* fInEllipseOffsets0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698