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

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

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: more windows fix 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/effects/GrConvolutionEffect.h ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.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 b59b2a6e5cecba57c2625c0633eeaad01df22852..1641d272fcc1f607009f081a23083b5f27989628 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -335,7 +335,7 @@ bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target, GrDrawState
devIntervals[0] = lineLength;
}
- const GrGeometryProcessor* gp;
+ SkAutoTUnref<const GrGeometryProcessor> gp;
bool fullDash = devIntervals[1] > 0.f || useAA;
if (fullDash) {
SkPathEffect::DashInfo devInfo;
@@ -347,14 +347,12 @@ bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target, GrDrawState
bool isRoundCap = SkPaint::kRound_Cap == cap;
GrDashingEffect::DashCap capType = isRoundCap ? GrDashingEffect::kRound_DashCap :
GrDashingEffect::kNonRound_DashCap;
- gp = GrDashingEffect::Create(color, edgeType, devInfo, strokeWidth, capType);
+ gp.reset(GrDashingEffect::Create(color, edgeType, devInfo, strokeWidth, capType));
} else {
// Set up the vertex data for the line and start/end dashes
- gp = GrDefaultGeoProcFactory::Create(color, GrDefaultGeoProcFactory::kPosition_GPType);
+ gp.reset(GrDefaultGeoProcFactory::Create(color, GrDefaultGeoProcFactory::kPosition_GPType));
}
- drawState->setGeometryProcessor(gp)->unref();
-
int totalRectCnt = 0;
totalRectCnt += !lineDone ? 1 : 0;
@@ -435,7 +433,7 @@ bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target, GrDrawState
}
target->setIndexSourceToBuffer(gpu->getContext()->getQuadIndexBuffer());
- target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, totalRectCnt, 4, 6);
+ target->drawIndexedInstances(drawState, gp, kTriangles_GrPrimitiveType, totalRectCnt, 4, 6);
target->resetIndexSource();
return true;
}
@@ -489,7 +487,7 @@ private:
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
- virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
+ virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_OVERRIDE;
GrPrimitiveEdgeType fEdgeType;
const GrAttribute* fInPosition;
@@ -614,8 +612,8 @@ GrGeometryProcessor* DashingCircleEffect::Create(GrColor color,
DashingCircleEffect::~DashingCircleEffect() {}
-void DashingCircleEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- inout->mulByUnknownAlpha();
+void DashingCircleEffect::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
+ out->setUnknownSingleComponent();
}
void DashingCircleEffect::getGLProcessorKey(const GrBatchTracker& bt,
@@ -719,7 +717,7 @@ private:
virtual bool onIsEqual(const GrGeometryProcessor& other) const SK_OVERRIDE;
- virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE;
+ virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput*) const SK_OVERRIDE;
GrPrimitiveEdgeType fEdgeType;
const GrAttribute* fInPosition;
@@ -857,8 +855,8 @@ GrGeometryProcessor* DashingLineEffect::Create(GrColor color,
DashingLineEffect::~DashingLineEffect() {}
-void DashingLineEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
- inout->mulByUnknownAlpha();
+void DashingLineEffect::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
+ out->setUnknownSingleComponent();
}
void DashingLineEffect::getGLProcessorKey(const GrBatchTracker& bt,
« no previous file with comments | « src/gpu/effects/GrConvolutionEffect.h ('k') | src/gpu/effects/GrDistanceFieldTextureEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698