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

Unified Diff: src/gpu/GrOvalRenderer.cpp

Issue 1151693005: Remove uniform view matrix from GrGLPrimitiveProcessor base class (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 5 years, 7 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 | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | 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 5c231bdeae03cad2712551ed4224f7f48c9429d1..112c344913e1b85d1c31aa75065435ed8078cd4f 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -434,7 +434,7 @@ public:
public:
GLProcessor(const GrGeometryProcessor&,
const GrBatchTracker&)
- : fColor(GrColor_ILLEGAL) {}
+ : fViewMatrix(SkMatrix::InvalidMatrix()), fColor(GrColor_ILLEGAL) {}
void onEmitCode(EmitArgs& args, GrGPArgs* gpArgs) override{
const DIEllipseEdgeEffect& ee = args.fGP.cast<DIEllipseEdgeEffect>();
@@ -460,7 +460,8 @@ public:
}
// Setup position
- this->setupPosition(pb, gpArgs, ee.inPosition()->fName, ee.viewMatrix());
+ this->setupPosition(pb, gpArgs, ee.inPosition()->fName, ee.viewMatrix(),
+ &fViewMatrixUniform);
// emit transforms
this->emitTransforms(args.fPB, gpArgs->fPositionVar, ee.inPosition()->fName,
@@ -522,7 +523,13 @@ public:
const GrPrimitiveProcessor& gp,
const GrBatchTracker& bt) override {
const DIEllipseEdgeEffect& dee = gp.cast<DIEllipseEdgeEffect>();
- this->setUniformViewMatrix(pdman, dee.viewMatrix());
+
+ if (!dee.viewMatrix().isIdentity() && !fViewMatrix.cheapEqualTo(dee.viewMatrix())) {
+ fViewMatrix = dee.viewMatrix();
+ GrGLfloat viewMatrix[3 * 3];
+ GrGLGetMatrix<3>(viewMatrix, fViewMatrix);
+ pdman.setMatrix3f(fViewMatrixUniform, viewMatrix);
+ }
if (dee.color() != fColor) {
GrGLfloat c[4];
@@ -533,8 +540,10 @@ public:
}
private:
+ SkMatrix fViewMatrix;
GrColor fColor;
UniformHandle fColorUniform;
+ UniformHandle fViewMatrixUniform;
typedef GrGLGeometryProcessor INHERITED;
};
« no previous file with comments | « src/gpu/GrDefaultGeoProcFactory.cpp ('k') | src/gpu/effects/GrBezierEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698