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

Unified Diff: gm/beziereffects.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 | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | gm/bigrrectaaeffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/beziereffects.cpp
diff --git a/gm/beziereffects.cpp b/gm/beziereffects.cpp
index 1224c1a8bb578b67cb59b3ea31b2ea44f1a1ff3a..ae1c37fdf6031ecd5a987c97c6b0bf2bd2be2e85 100644
--- a/gm/beziereffects.cpp
+++ b/gm/beziereffects.cpp
@@ -34,10 +34,10 @@ public:
const char* name() const override { return "BezierCubicOrConicTestBatch"; }
- BezierCubicOrConicTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds,
+ BezierCubicOrConicTestBatch(sk_sp<GrGeometryProcessor> gp, const SkRect& bounds,
GrColor color, const SkScalar klmEqs[9], SkScalar sign)
: INHERITED(ClassID(), bounds, color)
- , fGeometryProcessor(SkRef(gp)) {
+ , fGeometryProcessor(std::move(gp)) {
for (int i = 0; i < 9; i++) {
fKlmEqs[i] = klmEqs[i];
}
@@ -67,12 +67,12 @@ private:
verts[v].fKLM[1] = eval_line(verts[v].fPosition, fKlmEqs + 3, fSign);
verts[v].fKLM[2] = eval_line(verts[v].fPosition, fKlmEqs + 6, 1.f);
}
- helper.recordDraw(target, fGeometryProcessor);
+ helper.recordDraw(target, fGeometryProcessor.get());
}
- SkScalar fKlmEqs[9];
- SkScalar fSign;
- SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
+ SkScalar fKlmEqs[9];
+ SkScalar fSign;
+ sk_sp<GrGeometryProcessor> fGeometryProcessor;
static const int kVertsPerCubic = 4;
static const int kIndicesPerCubic = 6;
@@ -135,10 +135,9 @@ protected:
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}
};
for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) {
- SkAutoTUnref<GrGeometryProcessor> gp;
+ sk_sp<GrGeometryProcessor> gp;
GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType;
- gp.reset(GrCubicEffect::Create(color, SkMatrix::I(), et,
- *context->caps()));
+ gp = GrCubicEffect::Make(color, SkMatrix::I(), et, *context->caps());
if (!gp) {
continue;
}
@@ -191,7 +190,7 @@ protected:
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setXPFactory(
- GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
+ GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
SkAutoTUnref<GrDrawBatch> batch(
new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, klmSigns[c]));
@@ -269,10 +268,10 @@ protected:
};
SkScalar weight = rand.nextRangeF(0.f, 2.f);
for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) {
- SkAutoTUnref<GrGeometryProcessor> gp;
+ sk_sp<GrGeometryProcessor> gp;
GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType;
- gp.reset(GrConicEffect::Create(color, SkMatrix::I(), et,
- *context->caps(), SkMatrix::I(), false));
+ gp = GrConicEffect::Make(color, SkMatrix::I(), et,
+ *context->caps(), SkMatrix::I(), false);
if (!gp) {
continue;
}
@@ -323,7 +322,7 @@ protected:
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setXPFactory(
- GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
+ GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
SkAutoTUnref<GrDrawBatch> batch(
new BezierCubicOrConicTestBatch(gp, bounds, color, klmEqs, 1.f));
@@ -387,11 +386,11 @@ public:
DEFINE_BATCH_CLASS_ID
const char* name() const override { return "BezierQuadTestBatch"; }
- BezierQuadTestBatch(const GrGeometryProcessor* gp, const SkRect& bounds, GrColor color,
+ BezierQuadTestBatch(sk_sp<GrGeometryProcessor> gp, const SkRect& bounds, GrColor color,
const GrPathUtils::QuadUVMatrix& devToUV)
: INHERITED(ClassID(), bounds, color)
, fDevToUV(devToUV)
- , fGeometryProcessor(SkRef(gp)) {
+ , fGeometryProcessor(std::move(gp)) {
}
private:
@@ -413,11 +412,11 @@ private:
verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom,
sizeof(Vertex));
fDevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts);
- helper.recordDraw(target, fGeometryProcessor);
+ helper.recordDraw(target, fGeometryProcessor.get());
}
- GrPathUtils::QuadUVMatrix fDevToUV;
- SkAutoTUnref<const GrGeometryProcessor> fGeometryProcessor;
+ GrPathUtils::QuadUVMatrix fDevToUV;
+ sk_sp<GrGeometryProcessor> fGeometryProcessor;
static const int kVertsPerCubic = 4;
static const int kIndicesPerCubic = 6;
@@ -479,10 +478,10 @@ protected:
{rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}
};
for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) {
- SkAutoTUnref<GrGeometryProcessor> gp;
+ sk_sp<GrGeometryProcessor> gp;
GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType;
- gp.reset(GrQuadEffect::Create(color, SkMatrix::I(), et,
- *context->caps(), SkMatrix::I(), false));
+ gp = GrQuadEffect::Make(color, SkMatrix::I(), et,
+ *context->caps(), SkMatrix::I(), false);
if (!gp) {
continue;
}
@@ -530,7 +529,7 @@ protected:
GrPipelineBuilder pipelineBuilder;
pipelineBuilder.setXPFactory(
- GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode))->unref();
+ GrPorterDuffXPFactory::Make(SkXfermode::kSrc_Mode));
GrPathUtils::QuadUVMatrix DevToUV(pts);
« no previous file with comments | « experimental/SkPerlinNoiseShader2/SkPerlinNoiseShader2.cpp ('k') | gm/bigrrectaaeffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698