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

Side by Side Diff: src/effects/SkMorphologyImageFilter.cpp

Issue 374923002: Goodbye GrEffectRef. (Closed) Base URL: https://skia.googlesource.com/skia.git@noref3
Patch Set: Address comments Created 6 years, 5 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 unified diff | Download patch
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 The Android Open Source Project 2 * Copyright 2012 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkMorphologyImageFilter.h" 8 #include "SkMorphologyImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 */ 271 */
272 class GrMorphologyEffect : public Gr1DKernelEffect { 272 class GrMorphologyEffect : public Gr1DKernelEffect {
273 273
274 public: 274 public:
275 275
276 enum MorphologyType { 276 enum MorphologyType {
277 kErode_MorphologyType, 277 kErode_MorphologyType,
278 kDilate_MorphologyType, 278 kDilate_MorphologyType,
279 }; 279 };
280 280
281 static GrEffectRef* Create(GrTexture* tex, Direction dir, int radius, Morpho logyType type) { 281 static GrEffect* Create(GrTexture* tex, Direction dir, int radius, Morpholog yType type) {
282 return SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type)); 282 return SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type));
283 } 283 }
284 284
285 virtual ~GrMorphologyEffect(); 285 virtual ~GrMorphologyEffect();
286 286
287 MorphologyType type() const { return fType; } 287 MorphologyType type() const { return fType; }
288 288
289 static const char* Name() { return "Morphology"; } 289 static const char* Name() { return "Morphology"; }
290 290
291 typedef GrGLMorphologyEffect GLEffect; 291 typedef GrGLMorphologyEffect GLEffect;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va lidFlags) const { 439 void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va lidFlags) const {
440 // This is valid because the color components of the result of the kernel al l come 440 // This is valid because the color components of the result of the kernel al l come
441 // exactly from existing values in the source texture. 441 // exactly from existing values in the source texture.
442 this->updateConstantColorComponentsForModulation(color, validFlags); 442 this->updateConstantColorComponentsForModulation(color, validFlags);
443 } 443 }
444 444
445 /////////////////////////////////////////////////////////////////////////////// 445 ///////////////////////////////////////////////////////////////////////////////
446 446
447 GR_DEFINE_EFFECT_TEST(GrMorphologyEffect); 447 GR_DEFINE_EFFECT_TEST(GrMorphologyEffect);
448 448
449 GrEffectRef* GrMorphologyEffect::TestCreate(SkRandom* random, 449 GrEffect* GrMorphologyEffect::TestCreate(SkRandom* random,
450 GrContext*, 450 GrContext*,
451 const GrDrawTargetCaps&, 451 const GrDrawTargetCaps&,
452 GrTexture* textures[]) { 452 GrTexture* textures[]) {
453 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : 453 int texIdx = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx :
454 GrEffectUnitTest::kAlphaTextureIdx; 454 GrEffectUnitTest::kAlphaTextureIdx;
455 Direction dir = random->nextBool() ? kX_Direction : kY_Direction; 455 Direction dir = random->nextBool() ? kX_Direction : kY_Direction;
456 static const int kMaxRadius = 10; 456 static const int kMaxRadius = 10;
457 int radius = random->nextRangeU(1, kMaxRadius); 457 int radius = random->nextRangeU(1, kMaxRadius);
458 MorphologyType type = random->nextBool() ? GrMorphologyEffect::kErode_Morpho logyType : 458 MorphologyType type = random->nextBool() ? GrMorphologyEffect::kErode_Morpho logyType :
459 GrMorphologyEffect::kDilate_Morph ologyType; 459 GrMorphologyEffect::kDilate_Morph ologyType;
460 460
461 return GrMorphologyEffect::Create(textures[texIdx], dir, radius, type); 461 return GrMorphologyEffect::Create(textures[texIdx], dir, radius, type);
462 } 462 }
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
577 SkBitmap* result, SkIPoint* offset) con st { 577 SkBitmap* result, SkIPoint* offset) con st {
578 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 578 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
579 } 579 }
580 580
581 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 581 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
582 SkBitmap* result, SkIPoint* offset) cons t { 582 SkBitmap* result, SkIPoint* offset) cons t {
583 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 583 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
584 } 584 }
585 585
586 #endif 586 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698