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>
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index ee7985c..5101762 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -206,21 +206,20 @@
}
}
-sk_sp<GrFragmentProcessor> GrTextureDomainEffect::Make(sk_sp<GrTextureProxy> proxy,
- sk_sp<GrColorSpaceXform> colorSpaceXform,
- const SkMatrix& matrix,
- const SkRect& domain,
- GrTextureDomain::Mode mode,
- GrSamplerParams::FilterMode filterMode) {
+std::unique_ptr<GrFragmentProcessor> GrTextureDomainEffect::Make(
+ sk_sp<GrTextureProxy> proxy,
+ sk_sp<GrColorSpaceXform> colorSpaceXform,
+ const SkMatrix& matrix,
+ const SkRect& domain,
+ GrTextureDomain::Mode mode,
+ GrSamplerParams::FilterMode filterMode) {
if (GrTextureDomain::kIgnore_Mode == mode ||
(GrTextureDomain::kClamp_Mode == mode && can_ignore_rect(proxy.get(), domain))) {
return GrSimpleTextureEffect::Make(std::move(proxy),
std::move(colorSpaceXform), matrix, filterMode);
} else {
- return sk_sp<GrFragmentProcessor>(
- new GrTextureDomainEffect(std::move(proxy),
- std::move(colorSpaceXform),
- matrix, domain, mode, filterMode));
+ return std::unique_ptr<GrFragmentProcessor>(new GrTextureDomainEffect(
+ std::move(proxy), std::move(colorSpaceXform), matrix, domain, mode, filterMode));
}
}
@@ -312,7 +311,7 @@
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect);
#if GR_TEST_UTILS
-sk_sp<GrFragmentProcessor> GrTextureDomainEffect::TestCreate(GrProcessorTestData* d) {
+std::unique_ptr<GrFragmentProcessor> GrTextureDomainEffect::TestCreate(GrProcessorTestData* d) {
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: GrProcessorUnitTest::kAlphaTextureIdx;
sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx);
@@ -337,11 +336,9 @@
#endif
///////////////////////////////////////////////////////////////////////////////
-sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::Make(
- sk_sp<GrTextureProxy> proxy,
- const SkIRect& subset,
- const SkIPoint& deviceSpaceOffset) {
- return sk_sp<GrFragmentProcessor>(new GrDeviceSpaceTextureDecalFragmentProcessor(
+std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::Make(
+ sk_sp<GrTextureProxy> proxy, const SkIRect& subset, const SkIPoint& deviceSpaceOffset) {
+ return std::unique_ptr<GrFragmentProcessor>(new GrDeviceSpaceTextureDecalFragmentProcessor(
std::move(proxy), subset, deviceSpaceOffset));
}
@@ -369,8 +366,9 @@
this->addTextureSampler(&fTextureSampler);
}
-sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::clone() const {
- return sk_sp<GrFragmentProcessor>(new GrDeviceSpaceTextureDecalFragmentProcessor(*this));
+std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::clone() const {
+ return std::unique_ptr<GrFragmentProcessor>(
+ new GrDeviceSpaceTextureDecalFragmentProcessor(*this));
}
GrGLSLFragmentProcessor* GrDeviceSpaceTextureDecalFragmentProcessor::onCreateGLSLInstance() const {
@@ -441,7 +439,7 @@
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDeviceSpaceTextureDecalFragmentProcessor);
#if GR_TEST_UTILS
-sk_sp<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::TestCreate(
+std::unique_ptr<GrFragmentProcessor> GrDeviceSpaceTextureDecalFragmentProcessor::TestCreate(
GrProcessorTestData* d) {
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
: GrProcessorUnitTest::kAlphaTextureIdx;