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

Unified Diff: src/gpu/effects/GrMatrixConvolutionEffect.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/GrMatrixConvolutionEffect.h ('k') | src/gpu/effects/GrOvalEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrMatrixConvolutionEffect.cpp
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 60f518ba24588408deef50350e31def3b406c2ed..5422755c2e8f8e42176e8a1dea01f737d33f6835 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -191,17 +191,17 @@ bool GrMatrixConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) cons
}
// Static function to create a 2D convolution
-GrFragmentProcessor*
-GrMatrixConvolutionEffect::CreateGaussian(GrTexture* texture,
- const SkIRect& bounds,
- const SkISize& kernelSize,
- SkScalar gain,
- SkScalar bias,
- const SkIPoint& kernelOffset,
- GrTextureDomain::Mode tileMode,
- bool convolveAlpha,
- SkScalar sigmaX,
- SkScalar sigmaY) {
+sk_sp<GrFragmentProcessor>
+GrMatrixConvolutionEffect::MakeGaussian(GrTexture* texture,
+ const SkIRect& bounds,
+ const SkISize& kernelSize,
+ SkScalar gain,
+ SkScalar bias,
+ const SkIPoint& kernelOffset,
+ GrTextureDomain::Mode tileMode,
+ bool convolveAlpha,
+ SkScalar sigmaX,
+ SkScalar sigmaY) {
float kernel[MAX_KERNEL_SIZE];
int width = kernelSize.width();
int height = kernelSize.height();
@@ -228,13 +228,14 @@ GrMatrixConvolutionEffect::CreateGaussian(GrTexture* texture,
for (int i = 0; i < width * height; ++i) {
kernel[i] *= scale;
}
- return new GrMatrixConvolutionEffect(texture, bounds, kernelSize, kernel, gain, bias,
- kernelOffset, tileMode, convolveAlpha);
+ return sk_sp<GrFragmentProcessor>(
+ new GrMatrixConvolutionEffect(texture, bounds, kernelSize, kernel, gain, bias,
+ kernelOffset, tileMode, convolveAlpha));
}
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect);
-const GrFragmentProcessor* GrMatrixConvolutionEffect::TestCreate(GrProcessorTestData* d) {
+sk_sp<GrFragmentProcessor> GrMatrixConvolutionEffect::TestCreate(GrProcessorTestData* d) {
int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
int width = d->fRandom->nextRangeU(1, MAX_KERNEL_SIZE);
@@ -255,13 +256,13 @@ const GrFragmentProcessor* GrMatrixConvolutionEffect::TestCreate(GrProcessorTest
GrTextureDomain::Mode tileMode =
static_cast<GrTextureDomain::Mode>(d->fRandom->nextRangeU(0, 2));
bool convolveAlpha = d->fRandom->nextBool();
- return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx],
- bounds,
- kernelSize,
- kernel.get(),
- gain,
- bias,
- kernelOffset,
- tileMode,
- convolveAlpha);
+ return GrMatrixConvolutionEffect::Make(d->fTextures[texIdx],
+ bounds,
+ kernelSize,
+ kernel.get(),
+ gain,
+ bias,
+ kernelOffset,
+ tileMode,
+ convolveAlpha);
}
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.h ('k') | src/gpu/effects/GrOvalEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698