| 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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 MorphologyType type, float bounds[2]) { | 306 MorphologyType type, float bounds[2]) { |
| 307 return SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type, bounds)); | 307 return SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type, bounds)); |
| 308 } | 308 } |
| 309 | 309 |
| 310 virtual ~GrMorphologyEffect(); | 310 virtual ~GrMorphologyEffect(); |
| 311 | 311 |
| 312 MorphologyType type() const { return fType; } | 312 MorphologyType type() const { return fType; } |
| 313 bool useRange() const { return fUseRange; } | 313 bool useRange() const { return fUseRange; } |
| 314 const float* range() const { return fRange; } | 314 const float* range() const { return fRange; } |
| 315 | 315 |
| 316 const char* name() const SK_OVERRIDE { return "Morphology"; } | 316 const char* name() const override { return "Morphology"; } |
| 317 | 317 |
| 318 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE
RRIDE; | 318 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const overri
de; |
| 319 | 319 |
| 320 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 320 GrGLFragmentProcessor* createGLInstance() const override; |
| 321 | 321 |
| 322 protected: | 322 protected: |
| 323 | 323 |
| 324 MorphologyType fType; | 324 MorphologyType fType; |
| 325 bool fUseRange; | 325 bool fUseRange; |
| 326 float fRange[2]; | 326 float fRange[2]; |
| 327 | 327 |
| 328 private: | 328 private: |
| 329 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 329 bool onIsEqual(const GrFragmentProcessor&) const override; |
| 330 | 330 |
| 331 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; | 331 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
| 332 | 332 |
| 333 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); | 333 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); |
| 334 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType, float
bounds[2]); | 334 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType, float
bounds[2]); |
| 335 | 335 |
| 336 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 336 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 337 | 337 |
| 338 typedef Gr1DKernelEffect INHERITED; | 338 typedef Gr1DKernelEffect INHERITED; |
| 339 }; | 339 }; |
| 340 | 340 |
| 341 /////////////////////////////////////////////////////////////////////////////// | 341 /////////////////////////////////////////////////////////////////////////////// |
| 342 | 342 |
| 343 class GrGLMorphologyEffect : public GrGLFragmentProcessor { | 343 class GrGLMorphologyEffect : public GrGLFragmentProcessor { |
| 344 public: | 344 public: |
| 345 GrGLMorphologyEffect(const GrProcessor&); | 345 GrGLMorphologyEffect(const GrProcessor&); |
| 346 | 346 |
| 347 virtual void emitCode(GrGLFPBuilder*, | 347 virtual void emitCode(GrGLFPBuilder*, |
| 348 const GrFragmentProcessor&, | 348 const GrFragmentProcessor&, |
| 349 const char* outputColor, | 349 const char* outputColor, |
| 350 const char* inputColor, | 350 const char* inputColor, |
| 351 const TransformedCoordsArray&, | 351 const TransformedCoordsArray&, |
| 352 const TextureSamplerArray&) SK_OVERRIDE; | 352 const TextureSamplerArray&) override; |
| 353 | 353 |
| 354 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder* b); | 354 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder* b); |
| 355 | 355 |
| 356 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; | 356 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
| 357 | 357 |
| 358 private: | 358 private: |
| 359 int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); } | 359 int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); } |
| 360 | 360 |
| 361 int fRadius; | 361 int fRadius; |
| 362 Gr1DKernelEffect::Direction fDirection; | 362 Gr1DKernelEffect::Direction fDirection; |
| 363 bool fUseRange; | 363 bool fUseRange; |
| 364 GrMorphologyEffect::MorphologyType fType; | 364 GrMorphologyEffect::MorphologyType fType; |
| 365 GrGLProgramDataManager::UniformHandle fPixelSizeUni; | 365 GrGLProgramDataManager::UniformHandle fPixelSizeUni; |
| 366 GrGLProgramDataManager::UniformHandle fRangeUni; | 366 GrGLProgramDataManager::UniformHandle fRangeUni; |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 SkBitmap* result, SkIPoint* offset) con
st { | 747 SkBitmap* result, SkIPoint* offset) con
st { |
| 748 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 748 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
| 749 } | 749 } |
| 750 | 750 |
| 751 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 751 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
| 752 SkBitmap* result, SkIPoint* offset) cons
t { | 752 SkBitmap* result, SkIPoint* offset) cons
t { |
| 753 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 753 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
| 754 } | 754 } |
| 755 | 755 |
| 756 #endif | 756 #endif |
| OLD | NEW |