aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrPathProcessor.h
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-05-15 07:56:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-15 07:56:07 -0700
commite3ababe44315452cd33b96a18ce316ede09ff3c3 (patch)
treee7ba40200bc0ab12d3ad1bb2f013904599399638 /src/gpu/GrPathProcessor.h
parentc77f6af7c3ca08c94b882ccb2fbd61e6bae7ea42 (diff)
remove localmatrix from GrGeometryProcessor base class
Diffstat (limited to 'src/gpu/GrPathProcessor.h')
-rw-r--r--src/gpu/GrPathProcessor.h40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/gpu/GrPathProcessor.h b/src/gpu/GrPathProcessor.h
index 39b0b7afef..e34d0cefbe 100644
--- a/src/gpu/GrPathProcessor.h
+++ b/src/gpu/GrPathProcessor.h
@@ -37,8 +37,10 @@ public:
const char* name() const override { return "PathProcessor"; }
- const SkMatrix& viewMatrix() const { return fViewMatrix; }
GrColor color() const { return fColor; }
+ const SkMatrix& viewMatrix() const { return fViewMatrix; }
+ const SkMatrix& localMatrix() const { return fLocalMatrix; }
+
void getInvariantOutputColor(GrInitInvariantOutput* out) const override;
void getInvariantOutputCoverage(GrInitInvariantOutput* out) const override;
@@ -54,10 +56,44 @@ public:
private:
GrPathProcessor(GrColor color, const SkMatrix& viewMatrix, const SkMatrix& localMatrix);
+
+ /*
+ * CanCombineOutput will return true if two draws are 'batchable' from a color perspective.
+ * TODO is this really necessary?
+ */
+ static bool CanCombineOutput(GrGPInput left, GrColor lColor, GrGPInput right, GrColor rColor) {
+ if (left != right) {
+ return false;
+ }
+
+ if (kUniform_GrGPInput == left && lColor != rColor) {
+ return false;
+ }
+
+ return true;
+ }
+
+ static bool CanCombineLocalMatrices(const GrPrimitiveProcessor& l,
+ bool leftUsesLocalCoords,
+ const GrPrimitiveProcessor& r,
+ bool rightUsesLocalCoords) {
+ if (leftUsesLocalCoords != rightUsesLocalCoords) {
+ return false;
+ }
+
+ const GrPathProcessor& left = l.cast<GrPathProcessor>();
+ const GrPathProcessor& right = r.cast<GrPathProcessor>();
+ if (leftUsesLocalCoords && !left.localMatrix().cheapEqualTo(right.localMatrix())) {
+ return false;
+ }
+ return true;
+ }
+
bool hasExplicitLocalCoords() const override { return false; }
- const SkMatrix fViewMatrix;
GrColor fColor;
+ const SkMatrix fViewMatrix;
+ const SkMatrix fLocalMatrix;
typedef GrPrimitiveProcessor INHERITED;
};