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

Unified Diff: src/gpu/effects/GrDashingEffect.cpp

Issue 1110993002: Revert of removing equality / compute invariant loops from GrGeometryProcessors (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup1
Patch Set: Created 5 years, 8 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/effects/GrBitmapTextGeoProc.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDashingEffect.cpp
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 46a987ba39110f96e7b674f961627ca88dd4d517..b6dbbd6e0ed19f877ca6c3c5b391e7334fe0923d 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -783,6 +783,8 @@
DashAAMode aaMode,
const SkMatrix& localMatrix);
+ virtual ~DashingCircleEffect();
+
const char* name() const override { return "DashingCircleEffect"; }
const Attribute* inPosition() const { return fInPosition; }
@@ -802,8 +804,16 @@
void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
+ bool onCanMakeEqual(const GrBatchTracker&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&) const override;
+
private:
DashingCircleEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix);
+
+ bool onIsEqual(const GrGeometryProcessor& other) const override;
+
+ void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
DashAAMode fAAMode;
const Attribute* fInPosition;
@@ -933,6 +943,12 @@
return SkNEW_ARGS(DashingCircleEffect, (color, aaMode, localMatrix));
}
+DashingCircleEffect::~DashingCircleEffect() {}
+
+void DashingCircleEffect::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
+ out->setUnknownSingleComponent();
+}
+
void DashingCircleEffect::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLCaps& caps,
GrProcessorKeyBuilder* b) const {
@@ -955,10 +971,26 @@
kVec2f_GrVertexAttribType));
}
+bool DashingCircleEffect::onIsEqual(const GrGeometryProcessor& other) const {
+ const DashingCircleEffect& dce = other.cast<DashingCircleEffect>();
+ return fAAMode == dce.fAAMode;
+}
+
void DashingCircleEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
DashingCircleBatchTracker* local = bt->cast<DashingCircleBatchTracker>();
local->fInputColorType = GetColorInputType(&local->fColor, this->color(), init, false);
local->fUsesLocalCoords = init.fUsesLocalCoords;
+}
+
+bool DashingCircleEffect::onCanMakeEqual(const GrBatchTracker& m,
+ const GrGeometryProcessor& that,
+ const GrBatchTracker& t) const {
+ const DashingCircleBatchTracker& mine = m.cast<DashingCircleBatchTracker>();
+ const DashingCircleBatchTracker& theirs = t.cast<DashingCircleBatchTracker>();
+ return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
+ that, theirs.fUsesLocalCoords) &&
+ CanCombineOutput(mine.fInputColorType, mine.fColor,
+ theirs.fInputColorType, theirs.fColor);
}
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect);
@@ -999,6 +1031,8 @@
DashAAMode aaMode,
const SkMatrix& localMatrix);
+ virtual ~DashingLineEffect();
+
const char* name() const override { return "DashingEffect"; }
const Attribute* inPosition() const { return fInPosition; }
@@ -1018,8 +1052,16 @@
void initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const override;
+ bool onCanMakeEqual(const GrBatchTracker&,
+ const GrGeometryProcessor&,
+ const GrBatchTracker&) const override;
+
private:
DashingLineEffect(GrColor, DashAAMode aaMode, const SkMatrix& localMatrix);
+
+ bool onIsEqual(const GrGeometryProcessor& other) const override;
+
+ void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const override;
DashAAMode fAAMode;
const Attribute* fInPosition;
@@ -1161,6 +1203,12 @@
return SkNEW_ARGS(DashingLineEffect, (color, aaMode, localMatrix));
}
+DashingLineEffect::~DashingLineEffect() {}
+
+void DashingLineEffect::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
+ out->setUnknownSingleComponent();
+}
+
void DashingLineEffect::getGLProcessorKey(const GrBatchTracker& bt,
const GrGLCaps& caps,
GrProcessorKeyBuilder* b) const {
@@ -1182,10 +1230,26 @@
fInRectParams = &this->addVertexAttrib(Attribute("inRect", kVec4f_GrVertexAttribType));
}
+bool DashingLineEffect::onIsEqual(const GrGeometryProcessor& other) const {
+ const DashingLineEffect& de = other.cast<DashingLineEffect>();
+ return fAAMode == de.fAAMode;
+}
+
void DashingLineEffect::initBatchTracker(GrBatchTracker* bt, const GrPipelineInfo& init) const {
DashingLineBatchTracker* local = bt->cast<DashingLineBatchTracker>();
local->fInputColorType = GetColorInputType(&local->fColor, this->color(), init, false);
local->fUsesLocalCoords = init.fUsesLocalCoords;
+}
+
+bool DashingLineEffect::onCanMakeEqual(const GrBatchTracker& m,
+ const GrGeometryProcessor& that,
+ const GrBatchTracker& t) const {
+ const DashingLineBatchTracker& mine = m.cast<DashingLineBatchTracker>();
+ const DashingLineBatchTracker& theirs = t.cast<DashingLineBatchTracker>();
+ return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
+ that, theirs.fUsesLocalCoords) &&
+ CanCombineOutput(mine.fInputColorType, mine.fColor,
+ theirs.fInputColorType, theirs.fColor);
}
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect);
« no previous file with comments | « src/gpu/effects/GrBitmapTextGeoProc.cpp ('k') | src/gpu/effects/GrDistanceFieldGeoProc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698