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

Unified Diff: src/effects/SkDisplacementMapEffect.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/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkGpuBlurUtils.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkDisplacementMapEffect.cpp
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp
index 541dbbd058d3cbb54b33da3e03e473ffd0b15d3b..29ce3fef524c60e9e9c6c635218b64fc6ccfd93b 100644
--- a/src/effects/SkDisplacementMapEffect.cpp
+++ b/src/effects/SkDisplacementMapEffect.cpp
@@ -214,13 +214,14 @@ void SkDisplacementMapEffect::flatten(SkWriteBuffer& buffer) const {
#if SK_SUPPORT_GPU
class GrDisplacementMapEffect : public GrFragmentProcessor {
public:
- static GrFragmentProcessor* Create(
+ static sk_sp<GrFragmentProcessor> Make(
SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVector scale,
GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* color,
const SkISize& colorDimensions) {
- return new GrDisplacementMapEffect(xChannelSelector, yChannelSelector, scale, displacement,
- offsetMatrix, color, colorDimensions);
+ return sk_sp<GrFragmentProcessor>(
+ new GrDisplacementMapEffect(xChannelSelector, yChannelSelector, scale, displacement,
+ offsetMatrix, color, colorDimensions));
}
virtual ~GrDisplacementMapEffect();
@@ -323,14 +324,13 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou
SkIntToScalar(colorOffset.fY - displOffset.fY));
paint.addColorFragmentProcessor(
- GrDisplacementMapEffect::Create(fXChannelSelector,
- fYChannelSelector,
- scale,
- displTexture.get(),
- offsetMatrix,
- colorTexture.get(),
- SkISize::Make(color->width(),
- color->height())))->unref();
+ GrDisplacementMapEffect::Make(fXChannelSelector,
+ fYChannelSelector,
+ scale,
+ displTexture.get(),
+ offsetMatrix,
+ colorTexture.get(),
+ SkISize::Make(color->width(), color->height())));
paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode);
SkMatrix matrix;
matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colorBounds.y()));
@@ -504,7 +504,7 @@ void GrDisplacementMapEffect::onComputeInvariantOutput(GrInvariantOutput* inout)
GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect);
-const GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(GrProcessorTestData* d) {
+sk_sp<GrFragmentProcessor> GrDisplacementMapEffect::TestCreate(GrProcessorTestData* d) {
int texIdxDispl = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
GrProcessorUnitTest::kAlphaTextureIdx;
int texIdxColor = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx :
@@ -521,9 +521,9 @@ const GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(GrProcessorTestDa
SkISize colorDimensions;
colorDimensions.fWidth = d->fRandom->nextRangeU(0, d->fTextures[texIdxColor]->width());
colorDimensions.fHeight = d->fRandom->nextRangeU(0, d->fTextures[texIdxColor]->height());
- return GrDisplacementMapEffect::Create(xChannelSelector, yChannelSelector, scale,
- d->fTextures[texIdxDispl], SkMatrix::I(),
- d->fTextures[texIdxColor], colorDimensions);
+ return GrDisplacementMapEffect::Make(xChannelSelector, yChannelSelector, scale,
+ d->fTextures[texIdxDispl], SkMatrix::I(),
+ d->fTextures[texIdxColor], colorDimensions);
}
///////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/effects/SkColorCubeFilter.cpp ('k') | src/effects/SkGpuBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698