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

Unified Diff: src/gpu/GrGeometryProcessor.h

Issue 815553003: Move ViewMatrix off of drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@remove-fragment-stage
Patch Set: more cleaning Created 6 years 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/GrDrawTarget.cpp ('k') | src/gpu/GrGeometryProcessor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrGeometryProcessor.h
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index fb2300ed67454aa8f1337e7ccc9c4b25df95c953..d88f3e632aaaedd1882cb6501810fc0070c612da 100644
--- a/src/gpu/GrGeometryProcessor.h
+++ b/src/gpu/GrGeometryProcessor.h
@@ -92,6 +92,7 @@ class GrPrimitiveProcessor : public GrProcessor {
public:
// TODO let the PrimProc itself set this in its setData call, this should really live on the
// bundle of primitive data
+ const SkMatrix& viewMatrix() const { return fViewMatrix; }
const SkMatrix& localMatrix() const { return fLocalMatrix; }
/*
@@ -135,7 +136,9 @@ public:
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const = 0;
protected:
- GrPrimitiveProcessor(const SkMatrix& localMatrix) : fLocalMatrix(localMatrix) {}
+ GrPrimitiveProcessor(const SkMatrix& viewMatrix, const SkMatrix& localMatrix)
+ : fViewMatrix(viewMatrix)
+ , fLocalMatrix(localMatrix) {}
/*
* CanCombineOutput will return true if two draws are 'batchable' from a color perspective.
@@ -168,6 +171,7 @@ protected:
}
private:
+ SkMatrix fViewMatrix;
SkMatrix fLocalMatrix;
typedef GrProcessor INHERITED;
@@ -185,9 +189,10 @@ public:
// TODO the Hint can be handled in a much more clean way when we have deferred geometry or
// atleast bundles
GrGeometryProcessor(GrColor color,
- bool opaqueVertexColors = false,
- const SkMatrix& localMatrix = SkMatrix::I())
- : INHERITED(localMatrix)
+ const SkMatrix& viewMatrix = SkMatrix::I(),
+ const SkMatrix& localMatrix = SkMatrix::I(),
+ bool opaqueVertexColors = false)
+ : INHERITED(viewMatrix, localMatrix)
, fVertexStride(0)
, fColor(color)
, fOpaqueVertexColors(opaqueVertexColors)
@@ -237,6 +242,11 @@ public:
return false;
}
+ // TODO let the GPs decide this
+ if (!this->viewMatrix().cheapEqualTo(that.viewMatrix())) {
+ return false;
+ }
+
// TODO remove the hint
const GrGeometryProcessor& other = that.cast<GrGeometryProcessor>();
if (fHasVertexColor && fOpaqueVertexColors != other.fOpaqueVertexColors) {
@@ -342,8 +352,10 @@ private:
*/
class GrPathProcessor : public GrPrimitiveProcessor {
public:
- static GrPathProcessor* Create(GrColor color, const SkMatrix& localMatrix = SkMatrix::I()) {
- return SkNEW_ARGS(GrPathProcessor, (color, localMatrix));
+ static GrPathProcessor* Create(GrColor color,
+ const SkMatrix& viewMatrix = SkMatrix::I(),
+ const SkMatrix& localMatrix = SkMatrix::I()) {
+ return SkNEW_ARGS(GrPathProcessor, (color, viewMatrix, localMatrix));
}
void initBatchTracker(GrBatchTracker*, const InitBT&) const SK_OVERRIDE;
@@ -366,7 +378,7 @@ public:
virtual GrGLGeometryProcessor* createGLInstance(const GrBatchTracker& bt) const SK_OVERRIDE;
private:
- GrPathProcessor(GrColor color, const SkMatrix& localMatrix);
+ GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
GrColor fColor;
typedef GrPrimitiveProcessor INHERITED;
« no previous file with comments | « src/gpu/GrDrawTarget.cpp ('k') | src/gpu/GrGeometryProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698