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

Unified Diff: src/gpu/GrOvalRenderer.cpp

Issue 794843002: Revert of Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: 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/GrOptDrawState.cpp ('k') | src/gpu/GrProcOptInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOvalRenderer.cpp
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 22a18d2d10489814079f4d929a4add781aa9e072..eac6fb4a3af5b2b3a3cb1ffba7659548ed4d7be4 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -144,8 +144,8 @@
return cee.fStroke == fStroke;
}
- virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE {
- out->setUnknownSingleComponent();
+ virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE {
+ inout->mulByUnknownAlpha();
}
const GrAttribute* fInPosition;
@@ -290,8 +290,8 @@
return eee.fStroke == fStroke;
}
- virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE {
- out->setUnknownSingleComponent();
+ virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE {
+ inout->mulByUnknownAlpha();
}
const GrAttribute* fInPosition;
@@ -455,8 +455,8 @@
return eee.fMode == fMode;
}
- virtual void onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const SK_OVERRIDE {
- out->setUnknownSingleComponent();
+ virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE {
+ inout->mulByUnknownAlpha();
}
const GrAttribute* fInPosition;
@@ -562,8 +562,8 @@
}
}
- SkAutoTUnref<GrGeometryProcessor> gp(
- CircleEdgeEffect::Create(color, isStrokeOnly && innerRadius > 0));
+ GrGeometryProcessor* gp = CircleEdgeEffect::Create(color, isStrokeOnly && innerRadius > 0);
+ drawState->setGeometryProcessor(gp)->unref();
GrDrawTarget::AutoReleaseGeometry geo(target, 4, gp->getVertexStride(), 0);
SkASSERT(gp->getVertexStride() == sizeof(CircleVertex));
@@ -609,7 +609,7 @@
verts[3].fInnerRadius = innerRadius;
target->setIndexSourceToBuffer(context->getGpu()->getQuadIndexBuffer());
- target->drawIndexedInstances(drawState, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
+ target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
target->resetIndexSource();
}
@@ -689,8 +689,11 @@
return false;
}
- SkAutoTUnref<GrGeometryProcessor> gp(
- EllipseEdgeEffect::Create(color, isStrokeOnly && innerXRadius > 0 && innerYRadius > 0));
+ GrGeometryProcessor* gp = EllipseEdgeEffect::Create(color,
+ isStrokeOnly &&
+ innerXRadius > 0 && innerYRadius > 0);
+
+ drawState->setGeometryProcessor(gp)->unref();
GrDrawTarget::AutoReleaseGeometry geo(target, 4, gp->getVertexStride(), 0);
SkASSERT(gp->getVertexStride() == sizeof(EllipseVertex));
@@ -741,7 +744,7 @@
verts[3].fInnerRadii = SkPoint::Make(xInnerRadRecip, yInnerRadRecip);
target->setIndexSourceToBuffer(context->getGpu()->getQuadIndexBuffer());
- target->drawIndexedInstances(drawState, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
+ target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
target->resetIndexSource();
return true;
@@ -806,7 +809,9 @@
SkScalar innerRatioX = SkScalarDiv(xRadius, innerXRadius);
SkScalar innerRatioY = SkScalarDiv(yRadius, innerYRadius);
- SkAutoTUnref<GrGeometryProcessor> gp(DIEllipseEdgeEffect::Create(color, mode));
+ GrGeometryProcessor* gp = DIEllipseEdgeEffect::Create(color, mode);
+
+ drawState->setGeometryProcessor(gp)->unref();
GrDrawTarget::AutoReleaseGeometry geo(target, 4, gp->getVertexStride(), 0);
SkASSERT(gp->getVertexStride() == sizeof(DIEllipseVertex));
@@ -852,7 +857,7 @@
verts[3].fInnerOffset = SkPoint::Make(innerRatioX + offsetDx, -innerRatioY - offsetDy);
target->setIndexSourceToBuffer(context->getGpu()->getQuadIndexBuffer());
- target->drawIndexedInstances(drawState, gp, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
+ target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, 1, 4, 6, &bounds);
target->resetIndexSource();
return true;
@@ -1072,7 +1077,8 @@
isStrokeOnly = (isStrokeOnly && innerRadius >= 0);
- SkAutoTUnref<GrGeometryProcessor> effect(CircleEdgeEffect::Create(color, isStrokeOnly));
+ GrGeometryProcessor* effect = CircleEdgeEffect::Create(color, isStrokeOnly);
+ drawState->setGeometryProcessor(effect)->unref();
GrDrawTarget::AutoReleaseGeometry geo(target, 16, effect->getVertexStride(), 0);
SkASSERT(effect->getVertexStride() == sizeof(CircleVertex));
@@ -1134,7 +1140,7 @@
int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 :
SK_ARRAY_COUNT(gRRectIndices);
target->setIndexSourceToBuffer(indexBuffer);
- target->drawIndexedInstances(drawState, effect, kTriangles_GrPrimitiveType, 1, 16, indexCnt,
+ target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, 1, 16, indexCnt,
&bounds);
// otherwise we use the ellipse renderer
@@ -1173,7 +1179,8 @@
isStrokeOnly = (isStrokeOnly && innerXRadius >= 0 && innerYRadius >= 0);
- SkAutoTUnref<GrGeometryProcessor> effect(EllipseEdgeEffect::Create(color, isStrokeOnly));
+ GrGeometryProcessor* effect = EllipseEdgeEffect::Create(color, isStrokeOnly);
+ drawState->setGeometryProcessor(effect)->unref();
GrDrawTarget::AutoReleaseGeometry geo(target, 16, effect->getVertexStride(), 0);
SkASSERT(effect->getVertexStride() == sizeof(EllipseVertex));
@@ -1240,7 +1247,7 @@
int indexCnt = isStrokeOnly ? SK_ARRAY_COUNT(gRRectIndices) - 6 :
SK_ARRAY_COUNT(gRRectIndices);
target->setIndexSourceToBuffer(indexBuffer);
- target->drawIndexedInstances(drawState, effect, kTriangles_GrPrimitiveType, 1, 16, indexCnt,
+ target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, 1, 16, indexCnt,
&bounds);
}
« no previous file with comments | « src/gpu/GrOptDrawState.cpp ('k') | src/gpu/GrProcOptInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698