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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 virtual ~GrMorphologyEffect(); | 303 virtual ~GrMorphologyEffect(); |
304 | 304 |
305 MorphologyType type() const { return fType; } | 305 MorphologyType type() const { return fType; } |
306 | 306 |
307 static const char* Name() { return "Morphology"; } | 307 static const char* Name() { return "Morphology"; } |
308 | 308 |
309 typedef GrGLMorphologyEffect GLProcessor; | 309 typedef GrGLMorphologyEffect GLProcessor; |
310 | 310 |
311 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; | 311 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE; |
312 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const SK_OVERRIDE; | |
313 | 312 |
314 protected: | 313 protected: |
315 | 314 |
316 MorphologyType fType; | 315 MorphologyType fType; |
317 | 316 |
318 private: | 317 private: |
319 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; | 318 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; |
320 | 319 |
| 320 virtual void onGetConstantColorComponents(GrColor* color, uint32_t* validFla
gs, |
| 321 bool* isSingleComponent) const SK_
OVERRIDE; |
| 322 |
321 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); | 323 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); |
322 | 324 |
323 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 325 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
324 | 326 |
325 typedef Gr1DKernelEffect INHERITED; | 327 typedef Gr1DKernelEffect INHERITED; |
326 }; | 328 }; |
327 | 329 |
328 /////////////////////////////////////////////////////////////////////////////// | 330 /////////////////////////////////////////////////////////////////////////////// |
329 | 331 |
330 class GrGLMorphologyEffect : public GrGLFragmentProcessor { | 332 class GrGLMorphologyEffect : public GrGLFragmentProcessor { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 } | 450 } |
449 | 451 |
450 bool GrMorphologyEffect::onIsEqual(const GrProcessor& sBase) const { | 452 bool GrMorphologyEffect::onIsEqual(const GrProcessor& sBase) const { |
451 const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>(); | 453 const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>(); |
452 return (this->texture(0) == s.texture(0) && | 454 return (this->texture(0) == s.texture(0) && |
453 this->radius() == s.radius() && | 455 this->radius() == s.radius() && |
454 this->direction() == s.direction() && | 456 this->direction() == s.direction() && |
455 this->type() == s.type()); | 457 this->type() == s.type()); |
456 } | 458 } |
457 | 459 |
458 void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va
lidFlags) const { | 460 void GrMorphologyEffect::onGetConstantColorComponents(GrColor* color, uint32_t*
validFlags, |
| 461 bool* isSingleComponent) c
onst { |
459 // This is valid because the color components of the result of the kernel al
l come | 462 // This is valid because the color components of the result of the kernel al
l come |
460 // exactly from existing values in the source texture. | 463 // exactly from existing values in the source texture. |
461 this->updateConstantColorComponentsForModulation(color, validFlags); | 464 this->updateConstantColorComponentsForModulation(color, validFlags); |
462 } | 465 } |
463 | 466 |
464 /////////////////////////////////////////////////////////////////////////////// | 467 /////////////////////////////////////////////////////////////////////////////// |
465 | 468 |
466 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect); | 469 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect); |
467 | 470 |
468 GrFragmentProcessor* GrMorphologyEffect::TestCreate(SkRandom* random, | 471 GrFragmentProcessor* GrMorphologyEffect::TestCreate(SkRandom* random, |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 SkBitmap* result, SkIPoint* offset) con
st { | 605 SkBitmap* result, SkIPoint* offset) con
st { |
603 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 606 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
604 } | 607 } |
605 | 608 |
606 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 609 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
607 SkBitmap* result, SkIPoint* offset) cons
t { | 610 SkBitmap* result, SkIPoint* offset) cons
t { |
608 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 611 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
609 } | 612 } |
610 | 613 |
611 #endif | 614 #endif |
OLD | NEW |