OLD | NEW |
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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 public: | 201 public: |
202 | 202 |
203 enum MorphologyType { | 203 enum MorphologyType { |
204 kErode_MorphologyType, | 204 kErode_MorphologyType, |
205 kDilate_MorphologyType, | 205 kDilate_MorphologyType, |
206 }; | 206 }; |
207 | 207 |
208 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
GrTexture* tex, | 208 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
GrTexture* tex, |
209 Direction dir, int radius, MorphologyType
type) { | 209 Direction dir, int radius, MorphologyType
type) { |
210 return SkNEW_ARGS(GrMorphologyEffect, (procDataManager, tex, dir, radius
, type)); | 210 return new GrMorphologyEffect(procDataManager, tex, dir, radius, type); |
211 } | 211 } |
212 | 212 |
213 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
GrTexture* tex, | 213 static GrFragmentProcessor* Create(GrProcessorDataManager* procDataManager,
GrTexture* tex, |
214 Direction dir, int radius, MorphologyType
type, | 214 Direction dir, int radius, MorphologyType
type, |
215 float bounds[2]) { | 215 float bounds[2]) { |
216 return SkNEW_ARGS(GrMorphologyEffect, (procDataManager, tex, dir, radius
, type, bounds)); | 216 return new GrMorphologyEffect(procDataManager, tex, dir, radius, type, b
ounds); |
217 } | 217 } |
218 | 218 |
219 virtual ~GrMorphologyEffect(); | 219 virtual ~GrMorphologyEffect(); |
220 | 220 |
221 MorphologyType type() const { return fType; } | 221 MorphologyType type() const { return fType; } |
222 bool useRange() const { return fUseRange; } | 222 bool useRange() const { return fUseRange; } |
223 const float* range() const { return fRange; } | 223 const float* range() const { return fRange; } |
224 | 224 |
225 const char* name() const override { return "Morphology"; } | 225 const char* name() const override { return "Morphology"; } |
226 | 226 |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 } | 418 } |
419 | 419 |
420 GrMorphologyEffect::~GrMorphologyEffect() { | 420 GrMorphologyEffect::~GrMorphologyEffect() { |
421 } | 421 } |
422 | 422 |
423 void GrMorphologyEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessor
KeyBuilder* b) const { | 423 void GrMorphologyEffect::onGetGLProcessorKey(const GrGLSLCaps& caps, GrProcessor
KeyBuilder* b) const { |
424 GrGLMorphologyEffect::GenKey(*this, caps, b); | 424 GrGLMorphologyEffect::GenKey(*this, caps, b); |
425 } | 425 } |
426 | 426 |
427 GrGLFragmentProcessor* GrMorphologyEffect::onCreateGLInstance() const { | 427 GrGLFragmentProcessor* GrMorphologyEffect::onCreateGLInstance() const { |
428 return SkNEW_ARGS(GrGLMorphologyEffect, (*this)); | 428 return new GrGLMorphologyEffect(*this); |
429 } | 429 } |
430 bool GrMorphologyEffect::onIsEqual(const GrFragmentProcessor& sBase) const { | 430 bool GrMorphologyEffect::onIsEqual(const GrFragmentProcessor& sBase) const { |
431 const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>(); | 431 const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>(); |
432 return (this->radius() == s.radius() && | 432 return (this->radius() == s.radius() && |
433 this->direction() == s.direction() && | 433 this->direction() == s.direction() && |
434 this->useRange() == s.useRange() && | 434 this->useRange() == s.useRange() && |
435 this->type() == s.type()); | 435 this->type() == s.type()); |
436 } | 436 } |
437 | 437 |
438 void GrMorphologyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons
t { | 438 void GrMorphologyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons
t { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 SkBitmap* result, SkIPoint* offset) con
st { | 662 SkBitmap* result, SkIPoint* offset) con
st { |
663 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 663 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
664 } | 664 } |
665 | 665 |
666 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 666 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
667 SkBitmap* result, SkIPoint* offset) cons
t { | 667 SkBitmap* result, SkIPoint* offset) cons
t { |
668 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 668 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
669 } | 669 } |
670 | 670 |
671 #endif | 671 #endif |
OLD | NEW |