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

Unified Diff: src/gpu/effects/GrGammaEffect.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/effects/GrGammaEffect.h ('k') | src/gpu/effects/GrMatrixConvolutionEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrGammaEffect.cpp
diff --git a/src/gpu/effects/GrGammaEffect.cpp b/src/gpu/effects/GrGammaEffect.cpp
index 71d8c914238fa972906e6acd4aeb16c490bf54f6..63ffc3242473824b1df30ed731746f6c05652591 100644
--- a/src/gpu/effects/GrGammaEffect.cpp
+++ b/src/gpu/effects/GrGammaEffect.cpp
@@ -116,11 +116,11 @@ void GrGammaEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const {
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrGammaEffect);
-const GrFragmentProcessor* GrGammaEffect::TestCreate(GrProcessorTestData* d) {
+sk_sp<GrFragmentProcessor> GrGammaEffect::TestCreate(GrProcessorTestData* d) {
// We want to be sure and test sRGB sometimes
Mode testMode = static_cast<Mode>(d->fRandom->nextRangeU(0, 2));
SkScalar gamma = d->fRandom->nextRangeScalar(0.5f, 2.0f);
- return new GrGammaEffect(testMode, gamma);
+ return sk_sp<GrFragmentProcessor>(new GrGammaEffect(testMode, gamma));
}
///////////////////////////////////////////////////////////////////////////////
@@ -134,15 +134,15 @@ GrGLSLFragmentProcessor* GrGammaEffect::onCreateGLSLInstance() const {
return new GrGLGammaEffect();
}
-const GrFragmentProcessor* GrGammaEffect::Create(SkScalar gamma) {
+sk_sp<GrFragmentProcessor> GrGammaEffect::Make(SkScalar gamma) {
// TODO: Once our public-facing API for specifying gamma curves settles down, expose this,
// and allow clients to explicitly request sRGB, rather than inferring from the exponent.
// Note that AdobeRGB (for example) is speficied as x^2.2, not the Rec.709 curves.
if (SkScalarNearlyEqual(gamma, 2.2f)) {
- return new GrGammaEffect(Mode::kSRGBToLinear, 2.2f);
+ return sk_sp<GrFragmentProcessor>(new GrGammaEffect(Mode::kSRGBToLinear, 2.2f));
} else if (SkScalarNearlyEqual(gamma, 1.0f / 2.2f)) {
- return new GrGammaEffect(Mode::kLinearToSRGB, 1.0f / 2.2f);
+ return sk_sp<GrFragmentProcessor>(new GrGammaEffect(Mode::kLinearToSRGB, 1.0f / 2.2f));
} else {
- return new GrGammaEffect(Mode::kExponential, gamma);
+ return sk_sp<GrFragmentProcessor>(new GrGammaEffect(Mode::kExponential, gamma));
}
}
« no previous file with comments | « src/gpu/effects/GrGammaEffect.h ('k') | src/gpu/effects/GrMatrixConvolutionEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698