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

Unified Diff: src/gpu/batches/GrAAConvexPathRenderer.cpp

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/SkGrPriv.h ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAAConvexPathRenderer.cpp
diff --git a/src/gpu/batches/GrAAConvexPathRenderer.cpp b/src/gpu/batches/GrAAConvexPathRenderer.cpp
index e875f1c3ec296c6fde341d35acd5df0d76f0b69f..390162ede2f24acf0d08640601e0f0de29aa419f 100644
--- a/src/gpu/batches/GrAAConvexPathRenderer.cpp
+++ b/src/gpu/batches/GrAAConvexPathRenderer.cpp
@@ -526,9 +526,9 @@ static void create_vertices(const SegmentArray& segments,
class QuadEdgeEffect : public GrGeometryProcessor {
public:
- static GrGeometryProcessor* Create(GrColor color, const SkMatrix& localMatrix,
- bool usesLocalCoords) {
- return new QuadEdgeEffect(color, localMatrix, usesLocalCoords);
+ static sk_sp<GrGeometryProcessor> Make(GrColor color, const SkMatrix& localMatrix,
+ bool usesLocalCoords) {
+ return sk_sp<GrGeometryProcessor>(new QuadEdgeEffect(color, localMatrix, usesLocalCoords));
}
virtual ~QuadEdgeEffect() {}
@@ -669,12 +669,12 @@ private:
GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect);
-const GrGeometryProcessor* QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
+sk_sp<GrGeometryProcessor> QuadEdgeEffect::TestCreate(GrProcessorTestData* d) {
// Doesn't work without derivative instructions.
return d->fCaps->shaderCaps()->shaderDerivativeSupport() ?
- QuadEdgeEffect::Create(GrRandomColor(d->fRandom),
- GrTest::TestMatrix(d->fRandom),
- d->fRandom->nextBool()) : nullptr;
+ QuadEdgeEffect::Make(GrRandomColor(d->fRandom),
+ GrTest::TestMatrix(d->fRandom),
+ d->fRandom->nextBool()) : nullptr;
}
///////////////////////////////////////////////////////////////////////////////
@@ -718,7 +718,7 @@ static void extract_verts(const GrAAConvexTessellator& tess,
}
}
-static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage,
+static sk_sp<GrGeometryProcessor> create_fill_gp(bool tweakAlphaForCoverage,
const SkMatrix& viewMatrix,
bool usesLocalCoords,
bool coverageIgnored) {
@@ -737,7 +737,7 @@ static const GrGeometryProcessor* create_fill_gp(bool tweakAlphaForCoverage,
Coverage coverage(coverageType);
LocalCoords localCoords(usesLocalCoords ? LocalCoords::kUsePosition_Type :
LocalCoords::kUnused_Type);
- return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
+ return MakeForDeviceSpace(color, coverage, localCoords, viewMatrix);
}
class AAConvexPathBatch : public GrVertexBatch {
@@ -782,10 +782,10 @@ private:
bool canTweakAlphaForCoverage = this->canTweakAlphaForCoverage();
// Setup GrGeometryProcessor
- SkAutoTUnref<const GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaForCoverage,
- this->viewMatrix(),
- this->usesLocalCoords(),
- this->coverageIgnored()));
+ sk_sp<GrGeometryProcessor> gp(create_fill_gp(canTweakAlphaForCoverage,
+ this->viewMatrix(),
+ this->usesLocalCoords(),
+ this->coverageIgnored()));
if (!gp) {
SkDebugf("Could not create GrGeometryProcessor\n");
return;
@@ -836,7 +836,7 @@ private:
vertexBuffer, indexBuffer,
firstVertex, firstIndex,
tess.numPts(), tess.numIndices());
- target->draw(gp, mesh);
+ target->draw(gp.get(), mesh);
}
}
@@ -857,8 +857,8 @@ private:
}
// Setup GrGeometryProcessor
- SkAutoTUnref<GrGeometryProcessor> quadProcessor(
- QuadEdgeEffect::Create(this->color(), invert, this->usesLocalCoords()));
+ sk_sp<GrGeometryProcessor> quadProcessor(
+ QuadEdgeEffect::Make(this->color(), invert, this->usesLocalCoords()));
// TODO generate all segments for all paths and use one vertex buffer
for (int i = 0; i < instanceCount; i++) {
@@ -924,7 +924,7 @@ private:
const Draw& draw = draws[j];
mesh.initIndexed(kTriangles_GrPrimitiveType, vertexBuffer, indexBuffer,
firstVertex, firstIndex, draw.fVertexCnt, draw.fIndexCnt);
- target->draw(quadProcessor, mesh);
+ target->draw(quadProcessor.get(), mesh);
firstVertex += draw.fVertexCnt;
firstIndex += draw.fIndexCnt;
}
« no previous file with comments | « src/gpu/SkGrPriv.h ('k') | src/gpu/batches/GrAADistanceFieldPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698