aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrOvalRenderer.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@google.com>2014-12-10 14:12:22 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-10 14:12:22 -0800
commit8c0f615fdd41b8b8048bf398791bb2138c511826 (patch)
tree99c1df79b95ce740b028382680a9af5359663219 /src/gpu/GrOvalRenderer.cpp
parentc6bc58eded89b0c0a36b8e20e193c200f297a0da (diff)
Revert of Remove GP from drawstate, revision of invariant output for GP (patchset #9 id:160001 of https://codereview.chromium.org/791743003/)
Reason for revert: breaks mac Original issue's description: > Remove GP from drawstate, revision of invariant output for GP > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/c6bc58eded89b0c0a36b8e20e193c200f297a0da TBR=bsalomon@google.com,egdaniel@google.com,joshualitt@chromium.org NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/794843002
Diffstat (limited to 'src/gpu/GrOvalRenderer.cpp')
-rw-r--r--src/gpu/GrOvalRenderer.cpp43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp
index 22a18d2d10..eac6fb4a3a 100644
--- a/src/gpu/GrOvalRenderer.cpp
+++ b/src/gpu/GrOvalRenderer.cpp
@@ -144,8 +144,8 @@ private:
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 @@ private:
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 @@ private:
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 @@ void GrOvalRenderer::drawCircle(GrDrawTarget* target,
}
}
- 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 @@ void GrOvalRenderer::drawCircle(GrDrawTarget* target,
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 @@ bool GrOvalRenderer::drawEllipse(GrDrawTarget* target,
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 @@ bool GrOvalRenderer::drawEllipse(GrDrawTarget* target,
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 @@ bool GrOvalRenderer::drawDIEllipse(GrDrawTarget* target,
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 @@ bool GrOvalRenderer::drawDIEllipse(GrDrawTarget* target,
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 @@ bool GrOvalRenderer::drawRRect(GrDrawTarget* target,
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 @@ bool GrOvalRenderer::drawRRect(GrDrawTarget* target,
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 @@ bool GrOvalRenderer::drawRRect(GrDrawTarget* target,
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 @@ bool GrOvalRenderer::drawRRect(GrDrawTarget* target,
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);
}