aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrGeometryProcessor.h
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2014-12-29 15:10:07 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-29 15:10:07 -0800
commit8059eb9f6e24ed609393fbda4ad71edea03ac258 (patch)
treec9a8e1881739206f49a5319bf1077a5900b42db1 /src/gpu/GrGeometryProcessor.h
parent4f662e62cd44e302ef689fabdb2c0ae8d9471b02 (diff)
Move ViewMatrix off of drawstate
Diffstat (limited to 'src/gpu/GrGeometryProcessor.h')
-rw-r--r--src/gpu/GrGeometryProcessor.h26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/gpu/GrGeometryProcessor.h b/src/gpu/GrGeometryProcessor.h
index fb2300ed67..d88f3e632a 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;