aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-08-11 09:40:37 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-08-11 14:13:26 +0000
commitaff329b8e9b239bca1d93b13a914fbef45ccf7fe (patch)
tree06ba42a557c6695f145bcf4956c981fc87af55ff /tests
parente2cbd0451832ec71d1b498e0f64d02b7d096b2b7 (diff)
Make GrFragmentProcessor be non-refcounted and use std::unique_ptr.
Change-Id: I985e54a071338e99292a5aa2f42c92bc115b4008 Reviewed-on: https://skia-review.googlesource.com/32760 Commit-Queue: Brian Salomon <bsalomon@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/GLProgramsTest.cpp37
-rw-r--r--tests/ImageStorageTest.cpp22
-rw-r--r--tests/IntTextureTest.cpp8
-rw-r--r--tests/OnFlushCallbackTest.cpp6
-rw-r--r--tests/ProcessorTest.cpp64
-rw-r--r--tests/RectangleTextureTest.cpp5
-rw-r--r--tests/SkSLFPTest.cpp22
-rw-r--r--tests/TessellatingPathRendererTests.cpp11
8 files changed, 88 insertions, 87 deletions
diff --git a/tests/GLProgramsTest.cpp b/tests/GLProgramsTest.cpp
index 891d1cca46..aaf97b6315 100644
--- a/tests/GLProgramsTest.cpp
+++ b/tests/GLProgramsTest.cpp
@@ -65,8 +65,8 @@ private:
class BigKeyProcessor : public GrFragmentProcessor {
public:
- static sk_sp<GrFragmentProcessor> Make() {
- return sk_sp<GrFragmentProcessor>(new BigKeyProcessor);
+ static std::unique_ptr<GrFragmentProcessor> Make() {
+ return std::unique_ptr<GrFragmentProcessor>(new BigKeyProcessor);
}
const char* name() const override { return "Big Ole Key"; }
@@ -75,7 +75,7 @@ public:
return new GLBigKeyProcessor;
}
- sk_sp<GrFragmentProcessor> clone() const override { return Make(); }
+ std::unique_ptr<GrFragmentProcessor> clone() const override { return Make(); }
private:
BigKeyProcessor() : INHERITED(kNone_OptimizationFlags) { this->initClassID<BigKeyProcessor>(); }
@@ -93,7 +93,7 @@ private:
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(BigKeyProcessor);
#if GR_TEST_UTILS
-sk_sp<GrFragmentProcessor> BigKeyProcessor::TestCreate(GrProcessorTestData*) {
+std::unique_ptr<GrFragmentProcessor> BigKeyProcessor::TestCreate(GrProcessorTestData*) {
return BigKeyProcessor::Make();
}
#endif
@@ -102,15 +102,15 @@ sk_sp<GrFragmentProcessor> BigKeyProcessor::TestCreate(GrProcessorTestData*) {
class BlockInputFragmentProcessor : public GrFragmentProcessor {
public:
- static sk_sp<GrFragmentProcessor> Make(sk_sp<GrFragmentProcessor> fp) {
- return sk_sp<GrFragmentProcessor>(new BlockInputFragmentProcessor(fp));
+ static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> fp) {
+ return std::unique_ptr<GrFragmentProcessor>(new BlockInputFragmentProcessor(std::move(fp)));
}
const char* name() const override { return "Block Input"; }
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return new GLFP; }
- sk_sp<GrFragmentProcessor> clone() const override {
+ std::unique_ptr<GrFragmentProcessor> clone() const override {
return Make(this->childProcessor(0).clone());
}
@@ -125,7 +125,7 @@ private:
typedef GrGLSLFragmentProcessor INHERITED;
};
- BlockInputFragmentProcessor(sk_sp<GrFragmentProcessor> child)
+ BlockInputFragmentProcessor(std::unique_ptr<GrFragmentProcessor> child)
: INHERITED(kNone_OptimizationFlags) {
this->initClassID<BlockInputFragmentProcessor>();
this->registerChildProcessor(std::move(child));
@@ -169,8 +169,8 @@ static void set_random_xpf(GrPaint* paint, GrProcessorTestData* d) {
paint->setXPFactory(GrXPFactoryTestFactory::Get(d));
}
-static sk_sp<GrFragmentProcessor> create_random_proc_tree(GrProcessorTestData* d,
- int minLevels, int maxLevels) {
+static std::unique_ptr<GrFragmentProcessor> create_random_proc_tree(GrProcessorTestData* d,
+ int minLevels, int maxLevels) {
SkASSERT(1 <= minLevels);
SkASSERT(minLevels <= maxLevels);
@@ -181,7 +181,7 @@ static sk_sp<GrFragmentProcessor> create_random_proc_tree(GrProcessorTestData* d
if (1 == minLevels) {
bool terminate = (1 == maxLevels) || (d->fRandom->nextF() < terminateProbability);
if (terminate) {
- sk_sp<GrFragmentProcessor> fp;
+ std::unique_ptr<GrFragmentProcessor> fp;
while (true) {
fp = GrFragmentProcessorTestFactory::Make(d);
SkASSERT(fp);
@@ -198,11 +198,11 @@ static sk_sp<GrFragmentProcessor> create_random_proc_tree(GrProcessorTestData* d
if (minLevels > 1) {
--minLevels;
}
- sk_sp<GrFragmentProcessor> minLevelsChild(create_random_proc_tree(d, minLevels, maxLevels - 1));
- sk_sp<GrFragmentProcessor> otherChild(create_random_proc_tree(d, 1, maxLevels - 1));
+ auto minLevelsChild = create_random_proc_tree(d, minLevels, maxLevels - 1);
+ std::unique_ptr<GrFragmentProcessor> otherChild(create_random_proc_tree(d, 1, maxLevels - 1));
SkBlendMode mode = static_cast<SkBlendMode>(d->fRandom->nextRangeU(0,
(int)SkBlendMode::kLastMode));
- sk_sp<GrFragmentProcessor> fp;
+ std::unique_ptr<GrFragmentProcessor> fp;
if (d->fRandom->nextF() < 0.5f) {
fp = GrXfermodeFragmentProcessor::MakeFromTwoProcessors(std::move(minLevelsChild),
std::move(otherChild), mode);
@@ -222,7 +222,7 @@ static void set_random_color_coverage_stages(GrPaint* paint,
// Randomly choose to either create a linear pipeline of procs or create one proc tree
const float procTreeProbability = 0.5f;
if (d->fRandom->nextF() < procTreeProbability) {
- sk_sp<GrFragmentProcessor> fp(create_random_proc_tree(d, 2, maxTreeLevels));
+ std::unique_ptr<GrFragmentProcessor> fp(create_random_proc_tree(d, 2, maxTreeLevels));
if (fp) {
paint->addColorFragmentProcessor(std::move(fp));
}
@@ -231,7 +231,7 @@ static void set_random_color_coverage_stages(GrPaint* paint,
int numColorProcs = d->fRandom->nextULessThan(numProcs + 1);
for (int s = 0; s < numProcs;) {
- sk_sp<GrFragmentProcessor> fp(GrFragmentProcessorTestFactory::Make(d));
+ std::unique_ptr<GrFragmentProcessor> fp(GrFragmentProcessorTestFactory::Make(d));
SkASSERT(fp);
// finally add the stage to the correct pipeline in the drawstate
@@ -330,9 +330,8 @@ bool GrDrawingManager::ProgramUnitTest(GrContext* context, int maxStages, int ma
GrPaint paint;
paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
- sk_sp<GrFragmentProcessor> fp(GrFragmentProcessorTestFactory::MakeIdx(i, &ptd));
- sk_sp<GrFragmentProcessor> blockFP(
- BlockInputFragmentProcessor::Make(std::move(fp)));
+ auto fp = GrFragmentProcessorTestFactory::MakeIdx(i, &ptd);
+ auto blockFP = BlockInputFragmentProcessor::Make(std::move(fp));
paint.addColorFragmentProcessor(std::move(blockFP));
GrDrawRandomOp(&random, renderTargetContext.get(), std::move(paint));
drawingManager->flush(nullptr);
diff --git a/tests/ImageStorageTest.cpp b/tests/ImageStorageTest.cpp
index 589f69471f..6d5cab09ec 100644
--- a/tests/ImageStorageTest.cpp
+++ b/tests/ImageStorageTest.cpp
@@ -19,16 +19,16 @@
DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
class TestFP : public GrFragmentProcessor {
public:
- static sk_sp<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
- GrSLMemoryModel mm,
- GrSLRestrict restrict) {
- return sk_sp<GrFragmentProcessor>(new TestFP(std::move(proxy), mm, restrict));
+ static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
+ GrSLMemoryModel mm,
+ GrSLRestrict restrict) {
+ return std::unique_ptr<GrFragmentProcessor>(new TestFP(std::move(proxy), mm, restrict));
}
const char* name() const override { return "Image Load Test FP"; }
- sk_sp<GrFragmentProcessor> clone() const override {
- return sk_sp<GrFragmentProcessor>(new TestFP(*this));
+ std::unique_ptr<GrFragmentProcessor> clone() const override {
+ return std::unique_ptr<GrFragmentProcessor>(new TestFP(*this));
}
private:
@@ -146,12 +146,14 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(ImageStorageLoad, reporter, ctxInfo) {
context->makeDeferredRenderTargetContext(SkBackingFit::kExact, kS, kS,
kRGBA_8888_GrPixelConfig, nullptr);
// We make a clone to test that copying GrFragmentProcessor::ImageStorageAccess
- // copying works.
- auto testFP = TestFP::Make(imageStorageTexture, mm, restrict);
- for (auto fp : {testFP, testFP->clone()}) {
+ // works.
+ std::unique_ptr<GrFragmentProcessor> fps[2];
+ fps[0] = TestFP::Make(imageStorageTexture, mm, restrict);
+ fps[1] = fps[0]->clone();
+ for (auto& fp : fps) {
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- paint.addColorFragmentProcessor(fp);
+ paint.addColorFragmentProcessor(std::move(fp));
rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I());
std::unique_ptr<uint32_t[]> readData(new uint32_t[kS * kS]);
SkImageInfo info = SkImageInfo::Make(kS, kS, kRGBA_8888_SkColorType,
diff --git a/tests/IntTextureTest.cpp b/tests/IntTextureTest.cpp
index ccdc304976..35019b8937 100644
--- a/tests/IntTextureTest.cpp
+++ b/tests/IntTextureTest.cpp
@@ -258,10 +258,8 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
};
for (auto filter : kNamedFilters) {
- sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(sContext->asTextureProxyRef(),
- nullptr,
- SkMatrix::I(),
- filter.fMode));
+ auto fp = GrSimpleTextureEffect::Make(sContext->asTextureProxyRef(), nullptr, SkMatrix::I(),
+ filter.fMode);
REPORTER_ASSERT(reporter, fp);
if (!fp) {
return;
@@ -269,7 +267,7 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(IntTexture, reporter, ctxInfo) {
rtContext->clear(nullptr, 0xDDAABBCC, true);
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
- paint.addColorFragmentProcessor(fp);
+ paint.addColorFragmentProcessor(std::move(fp));
rtContext->drawPaint(GrNoClip(), std::move(paint), SkMatrix::I());
SkImageInfo readInfo = SkImageInfo::Make(kS, kS, kRGBA_8888_SkColorType,
kPremul_SkAlphaType);
diff --git a/tests/OnFlushCallbackTest.cpp b/tests/OnFlushCallbackTest.cpp
index 388f770150..b26dd68a19 100644
--- a/tests/OnFlushCallbackTest.cpp
+++ b/tests/OnFlushCallbackTest.cpp
@@ -442,8 +442,7 @@ static sk_sp<GrTextureProxy> make_upstream_image(GrContext* context, AtlasObject
// TODO: here is the blocker for deferring creation of the atlas. The TextureSamplers
// created here currently require a hard GrTexture.
- sk_sp<GrFragmentProcessor> fp = GrSimpleTextureEffect::Make(fakeAtlas,
- nullptr, SkMatrix::I());
+ auto fp = GrSimpleTextureEffect::Make(fakeAtlas, nullptr, SkMatrix::I());
GrPaint paint;
paint.addColorFragmentProcessor(std::move(fp));
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
@@ -576,8 +575,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(OnFlushCallbackTest, reporter, ctxInfo) {
SkMatrix t = SkMatrix::MakeTrans(-i*3*kDrawnTileSize, 0);
GrPaint paint;
- sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(std::move(proxies[i]),
- nullptr, t));
+ auto fp = GrSimpleTextureEffect::Make(std::move(proxies[i]), nullptr, t);
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
diff --git a/tests/ProcessorTest.cpp b/tests/ProcessorTest.cpp
index 4cc7780d06..161192e487 100644
--- a/tests/ProcessorTest.cpp
+++ b/tests/ProcessorTest.cpp
@@ -27,7 +27,7 @@ public:
DEFINE_OP_CLASS_ID
const char* name() const override { return "TestOp"; }
- static std::unique_ptr<GrDrawOp> Make(sk_sp<GrFragmentProcessor> fp) {
+ static std::unique_ptr<GrDrawOp> Make(std::unique_ptr<GrFragmentProcessor> fp) {
return std::unique_ptr<GrDrawOp>(new TestOp(std::move(fp)));
}
@@ -42,7 +42,8 @@ public:
}
private:
- TestOp(sk_sp<GrFragmentProcessor> fp) : INHERITED(ClassID()), fProcessors(std::move(fp)) {
+ TestOp(std::unique_ptr<GrFragmentProcessor> fp)
+ : INHERITED(ClassID()), fProcessors(std::move(fp)) {
this->setBounds(SkRect::MakeWH(100, 100), HasAABloat::kNo, IsZeroArea::kNo);
}
@@ -66,13 +67,13 @@ public:
sk_sp<GrTextureProxy> fProxy;
GrIOType fIOType;
};
- static sk_sp<GrFragmentProcessor> Make(sk_sp<GrFragmentProcessor> child) {
- return sk_sp<GrFragmentProcessor>(new TestFP(std::move(child)));
+ static std::unique_ptr<GrFragmentProcessor> Make(std::unique_ptr<GrFragmentProcessor> child) {
+ return std::unique_ptr<GrFragmentProcessor>(new TestFP(std::move(child)));
}
- static sk_sp<GrFragmentProcessor> Make(const SkTArray<sk_sp<GrTextureProxy>>& proxies,
- const SkTArray<sk_sp<GrBuffer>>& buffers,
- const SkTArray<Image>& images) {
- return sk_sp<GrFragmentProcessor>(new TestFP(proxies, buffers, images));
+ static std::unique_ptr<GrFragmentProcessor> Make(const SkTArray<sk_sp<GrTextureProxy>>& proxies,
+ const SkTArray<sk_sp<GrBuffer>>& buffers,
+ const SkTArray<Image>& images) {
+ return std::unique_ptr<GrFragmentProcessor>(new TestFP(proxies, buffers, images));
}
const char* name() const override { return "test"; }
@@ -83,8 +84,8 @@ public:
b->add32(sk_atomic_inc(&gKey));
}
- sk_sp<GrFragmentProcessor> clone() const override {
- return sk_sp<GrFragmentProcessor>(new TestFP(*this));
+ std::unique_ptr<GrFragmentProcessor> clone() const override {
+ return std::unique_ptr<GrFragmentProcessor>(new TestFP(*this));
}
private:
@@ -106,7 +107,7 @@ private:
}
}
- TestFP(sk_sp<GrFragmentProcessor> child)
+ TestFP(std::unique_ptr<GrFragmentProcessor> child)
: INHERITED(kNone_OptimizationFlags), fSamplers(4), fBuffers(4), fImages(4) {
this->initClassID<TestFP>();
this->registerChildProcessor(std::move(child));
@@ -224,7 +225,7 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(ProcessorRefTest, reporter, ctxInfo) {
for (int i = 0; i < parentCnt; ++i) {
fp = TestFP::Make(std::move(fp));
}
- sk_sp<GrFragmentProcessor> clone;
+ std::unique_ptr<GrFragmentProcessor> clone;
if (makeClone) {
clone = fp->clone();
}
@@ -320,7 +321,7 @@ static GrColor4f input_texel_color4f(int i, int j) {
return GrColor4f::FromGrColor(input_texel_color(i, j));
}
-void test_draw_op(GrRenderTargetContext* rtc, sk_sp<GrFragmentProcessor> fp,
+void test_draw_op(GrRenderTargetContext* rtc, std::unique_ptr<GrFragmentProcessor> fp,
sk_sp<GrTextureProxy> inputDataProxy) {
GrPaint paint;
paint.addColorTextureProcessor(std::move(inputDataProxy), nullptr, SkMatrix::I());
@@ -417,7 +418,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
int timesToInvokeFactory = 5;
// Increase the number of attempts if the FP has child FPs since optimizations likely depend
// on child optimizations being present.
- sk_sp<GrFragmentProcessor> fp = FPFactory::MakeIdx(i, &testData);
+ std::unique_ptr<GrFragmentProcessor> fp = FPFactory::MakeIdx(i, &testData);
for (int j = 0; j < fp->numChildProcessors(); ++j) {
// This value made a reasonable trade off between time and coverage when this test was
// written.
@@ -433,7 +434,11 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
!fp->compatibleWithCoverageAsAlpha()) {
continue;
}
- test_draw_op(rtc.get(), fp, inputTexture);
+
+ // Since we transfer away ownership of the original FP, we make a clone.
+ auto clone = fp->clone();
+
+ test_draw_op(rtc.get(), std::move(fp), inputTexture);
memset(readData.get(), 0x0, sizeof(GrColor) * kRenderSize * kRenderSize);
rtc->readPixels(SkImageInfo::Make(kRenderSize, kRenderSize, kRGBA_8888_SkColorType,
kPremul_SkAlphaType),
@@ -441,20 +446,20 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
bool passing = true;
if (0) { // Useful to see what FPs are being tested.
SkString children;
- for (int c = 0; c < fp->numChildProcessors(); ++c) {
+ for (int c = 0; c < clone->numChildProcessors(); ++c) {
if (!c) {
children.append("(");
}
- children.append(fp->childProcessor(c).name());
- children.append(c == fp->numChildProcessors() - 1 ? ")" : ", ");
+ children.append(clone->name());
+ children.append(c == clone->numChildProcessors() - 1 ? ")" : ", ");
}
- SkDebugf("%s %s\n", fp->name(), children.c_str());
+ SkDebugf("%s %s\n", clone->name(), children.c_str());
}
for (int y = 0; y < kRenderSize && passing; ++y) {
for (int x = 0; x < kRenderSize && passing; ++x) {
GrColor input = input_texel_color(x, y);
GrColor output = readData.get()[y * kRenderSize + x];
- if (fp->compatibleWithCoverageAsAlpha()) {
+ if (clone->compatibleWithCoverageAsAlpha()) {
// A modulating processor is allowed to modulate either the input color or
// just the input alpha.
bool legalColorModulation =
@@ -471,14 +476,14 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
ERRORF(reporter,
"\"Modulating\" processor %s made color/alpha value larger. "
"Input: 0x%08x, Output: 0x%08x.",
- fp->name(), input, output);
+ clone->name(), input, output);
passing = false;
}
}
GrColor4f input4f = input_texel_color4f(x, y);
GrColor4f output4f = GrColor4f::FromGrColor(output);
GrColor4f expected4f;
- if (fp->hasConstantOutputForConstantInput(input4f, &expected4f)) {
+ if (clone->hasConstantOutputForConstantInput(input4f, &expected4f)) {
float rDiff = fabsf(output4f.fRGBA[0] - expected4f.fRGBA[0]);
float gDiff = fabsf(output4f.fRGBA[1] - expected4f.fRGBA[1]);
float bDiff = fabsf(output4f.fRGBA[2] - expected4f.fRGBA[2]);
@@ -497,17 +502,17 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorOptimizationValidationTest, repor
passing = false;
}
}
- if (GrColorIsOpaque(input) && fp->preservesOpaqueInput() &&
+ if (GrColorIsOpaque(input) && clone->preservesOpaqueInput() &&
!GrColorIsOpaque(output)) {
ERRORF(reporter,
"Processor %s claimed opaqueness is preserved but it is not. Input: "
"0x%08x, Output: 0x%08x.",
- fp->name(), input, output);
+ clone->name(), input, output);
passing = false;
}
if (!passing) {
- ERRORF(reporter, "Seed: 0x%08x, Processor details: %s",
- seed, fp->dumpInfo().c_str());
+ ERRORF(reporter, "Seed: 0x%08x, Processor details: %s", seed,
+ clone->dumpInfo().c_str());
}
}
}
@@ -550,6 +555,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
ERRORF(reporter, "Clone of processor %s failed.", fp->name());
continue;
}
+ const char* name = fp->name();
if (!fp->instantiate(context->resourceProvider()) ||
!clone->instantiate(context->resourceProvider())) {
continue;
@@ -564,12 +570,12 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
REPORTER_ASSERT(reporter, fp->numChildProcessors() == clone->numChildProcessors());
REPORTER_ASSERT(reporter, fp->usesLocalCoords() == clone->usesLocalCoords());
// Draw with original and read back the results.
- test_draw_op(rtc.get(), fp, inputTexture);
+ test_draw_op(rtc.get(), std::move(fp), inputTexture);
memset(readData1.get(), 0x0, sizeof(GrColor) * kRenderSize * kRenderSize);
rtc->readPixels(readInfo, readData1.get(), 0, 0, 0);
// Draw with clone and read back the results.
- test_draw_op(rtc.get(), clone, inputTexture);
+ test_draw_op(rtc.get(), std::move(clone), inputTexture);
memset(readData2.get(), 0x0, sizeof(GrColor) * kRenderSize * kRenderSize);
rtc->readPixels(readInfo, readData2.get(), 0, 0, 0);
@@ -583,7 +589,7 @@ DEF_GPUTEST_FOR_GL_RENDERING_CONTEXTS(ProcessorCloneTest, reporter, ctxInfo) {
"Processor %s made clone produced different output. "
"Input color: 0x%08x, Original Output Color: 0x%08x, "
"Clone Output Color: 0x%08x..",
- fp->name(), input_texel_color(x, y), readData1[idx], readData2[idx]);
+ name, input_texel_color(x, y), readData1[idx], readData2[idx]);
passing = false;
}
}
diff --git a/tests/RectangleTextureTest.cpp b/tests/RectangleTextureTest.cpp
index 705f585b7b..08569a766e 100644
--- a/tests/RectangleTextureTest.cpp
+++ b/tests/RectangleTextureTest.cpp
@@ -29,10 +29,7 @@ static void test_basic_draw_as_src(skiatest::Reporter* reporter, GrContext* cont
GrSamplerParams::kBilerp_FilterMode,
GrSamplerParams::kMipMap_FilterMode}) {
rtContext->clear(nullptr, 0xDDCCBBAA, true);
- sk_sp<GrFragmentProcessor> fp(GrSimpleTextureEffect::Make(
- rectProxy,
- nullptr,
- SkMatrix::I(), filter));
+ auto fp = GrSimpleTextureEffect::Make(rectProxy, nullptr, SkMatrix::I(), filter);
GrPaint paint;
paint.setPorterDuffXPFactory(SkBlendMode::kSrc);
paint.addColorFragmentProcessor(std::move(fp));
diff --git a/tests/SkSLFPTest.cpp b/tests/SkSLFPTest.cpp
index 82bcb10b71..0c3da0b5c3 100644
--- a/tests/SkSLFPTest.cpp
+++ b/tests/SkSLFPTest.cpp
@@ -85,11 +85,11 @@ DEF_TEST(SkSLFPHelloWorld, r) {
"#include \"GrColorSpaceXform.h\"\n"
"class GrTest : public GrFragmentProcessor {\n"
"public:\n"
- " static sk_sp<GrFragmentProcessor> Make() {\n"
- " return sk_sp<GrFragmentProcessor>(new GrTest());\n"
+ " static std::unique_ptr<GrFragmentProcessor> Make() {\n"
+ " return std::unique_ptr<GrFragmentProcessor>(new GrTest());\n"
" }\n"
" GrTest(const GrTest& src);\n"
- " sk_sp<GrFragmentProcessor> clone() const override;\n"
+ " std::unique_ptr<GrFragmentProcessor> clone() const override;\n"
" const char* name() const override { return \"Test\"; }\n"
"private:\n"
" GrTest()\n"
@@ -154,8 +154,8 @@ DEF_TEST(SkSLFPHelloWorld, r) {
": INHERITED(src.optimizationFlags()) {\n"
" this->initClassID<GrTest>();\n"
"}\n"
- "sk_sp<GrFragmentProcessor> GrTest::clone() const {\n"
- " return sk_sp<GrFragmentProcessor>(new GrTest(*this));\n"
+ "std::unique_ptr<GrFragmentProcessor> GrTest::clone() const {\n"
+ " return std::unique_ptr<GrFragmentProcessor>(new GrTest(*this));\n"
"}\n"
"#endif\n"
});
@@ -170,8 +170,8 @@ DEF_TEST(SkSLFPInput, r) {
*SkSL::ShaderCapsFactory::Default(),
{
"SkPoint point() const { return fPoint; }",
- "static sk_sp<GrFragmentProcessor> Make(SkPoint point) {",
- "return sk_sp<GrFragmentProcessor>(new GrTest(point));",
+ "static std::unique_ptr<GrFragmentProcessor> Make(SkPoint point) {",
+ "return std::unique_ptr<GrFragmentProcessor>(new GrTest(point));",
"GrTest(SkPoint point)",
", fPoint(point)"
},
@@ -191,7 +191,7 @@ DEF_TEST(SkSLFPUniform, r) {
"}",
*SkSL::ShaderCapsFactory::Default(),
{
- "static sk_sp<GrFragmentProcessor> Make()"
+ "static std::unique_ptr<GrFragmentProcessor> Make()"
},
{
"fColorVar = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kVec4f_GrSLType, "
@@ -207,7 +207,7 @@ DEF_TEST(SkSLFPInUniform, r) {
"}",
*SkSL::ShaderCapsFactory::Default(),
{
- "static sk_sp<GrFragmentProcessor> Make(SkRect color) {",
+ "static std::unique_ptr<GrFragmentProcessor> Make(SkRect color) {",
},
{
"fColorVar = args.fUniformHandler->addUniform(kFragment_GrShaderFlag, kVec4f_GrSLType, "
@@ -257,7 +257,7 @@ DEF_TEST(SkSLFPSections, r) {
*SkSL::ShaderCapsFactory::Default(),
{
"Make(float w, int x, float y, std::vector<float> z )",
- "return sk_sp<GrFragmentProcessor>(new GrTest(w, x, y, z));",
+ "return std::unique_ptr<GrFragmentProcessor>(new GrTest(w, x, y, z));",
"GrTest(float w, int x, float y, std::vector<float> z )",
", fW(w) {"
},
@@ -342,7 +342,7 @@ DEF_TEST(SkSLFPSections, r) {
{},
{
"#if GR_TEST_UTILS\n"
- "sk_sp<GrFragmentProcessor> GrTest::TestCreate(GrProcessorTestData* testDataName) {\n"
+ "std::unique_ptr<GrFragmentProcessor> GrTest::TestCreate(GrProcessorTestData* testDataName) {\n"
" testDataName section }\n"
"#endif"
});
diff --git a/tests/TessellatingPathRendererTests.cpp b/tests/TessellatingPathRendererTests.cpp
index f9db895002..f8b69839aa 100644
--- a/tests/TessellatingPathRendererTests.cpp
+++ b/tests/TessellatingPathRendererTests.cpp
@@ -347,7 +347,7 @@ static SkPath create_path_22() {
return path;
}
-static sk_sp<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) {
+static std::unique_ptr<GrFragmentProcessor> create_linear_gradient_processor(GrContext* ctx) {
SkPoint pts[2] = { {0, 0}, {1, 1} };
SkColor colors[2] = { SK_ColorGREEN, SK_ColorBLUE };
sk_sp<SkShader> shader = SkGradientShader::MakeLinear(
@@ -362,13 +362,13 @@ static void test_path(GrContext* ctx,
const SkPath& path,
const SkMatrix& matrix = SkMatrix::I(),
GrAAType aaType = GrAAType::kNone,
- sk_sp<GrFragmentProcessor> fp = nullptr) {
+ std::unique_ptr<GrFragmentProcessor> fp = nullptr) {
GrTessellatingPathRenderer tess;
GrPaint paint;
paint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc));
if (fp) {
- paint.addColorFragmentProcessor(fp);
+ paint.addColorFragmentProcessor(std::move(fp));
}
GrNoClip noClip;
@@ -419,8 +419,9 @@ DEF_GPUTEST_FOR_ALL_CONTEXTS(TessellatingPathRendererTests, reporter, ctxInfo) {
test_path(ctx, rtc.get(), create_path_15());
test_path(ctx, rtc.get(), create_path_16());
SkMatrix nonInvertibleMatrix = SkMatrix::MakeScale(0, 0);
- sk_sp<GrFragmentProcessor> fp(create_linear_gradient_processor(ctx));
- test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, GrAAType::kCoverage, fp);
+ std::unique_ptr<GrFragmentProcessor> fp(create_linear_gradient_processor(ctx));
+ test_path(ctx, rtc.get(), create_path_17(), nonInvertibleMatrix, GrAAType::kCoverage,
+ std::move(fp));
test_path(ctx, rtc.get(), create_path_18());
test_path(ctx, rtc.get(), create_path_19());
test_path(ctx, rtc.get(), create_path_20(), SkMatrix(), GrAAType::kCoverage);