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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 | 300 |
301 static GrFragmentProcessor* Create(GrTexture* tex, Direction dir, int radius
, | 301 static GrFragmentProcessor* Create(GrTexture* tex, Direction dir, int radius
, |
302 MorphologyType type) { | 302 MorphologyType type) { |
303 return SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type)); | 303 return SkNEW_ARGS(GrMorphologyEffect, (tex, dir, radius, type)); |
304 } | 304 } |
305 | 305 |
306 virtual ~GrMorphologyEffect(); | 306 virtual ~GrMorphologyEffect(); |
307 | 307 |
308 MorphologyType type() const { return fType; } | 308 MorphologyType type() const { return fType; } |
309 | 309 |
310 virtual const char* name() const SK_OVERRIDE { return "Morphology"; } | 310 const char* name() const SK_OVERRIDE { return "Morphology"; } |
311 | 311 |
312 virtual void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) cons
t SK_OVERRIDE; | 312 void getGLProcessorKey(const GrGLCaps&, GrProcessorKeyBuilder*) const SK_OVE
RRIDE; |
313 | 313 |
314 virtual GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; | 314 GrGLFragmentProcessor* createGLInstance() const SK_OVERRIDE; |
315 | 315 |
316 protected: | 316 protected: |
317 | 317 |
318 MorphologyType fType; | 318 MorphologyType fType; |
319 | 319 |
320 private: | 320 private: |
321 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; | 321 bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE; |
322 | 322 |
323 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE
RRIDE; | 323 void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVERRIDE; |
324 | 324 |
325 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); | 325 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); |
326 | 326 |
327 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 327 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
328 | 328 |
329 typedef Gr1DKernelEffect INHERITED; | 329 typedef Gr1DKernelEffect INHERITED; |
330 }; | 330 }; |
331 | 331 |
332 /////////////////////////////////////////////////////////////////////////////// | 332 /////////////////////////////////////////////////////////////////////////////// |
333 | 333 |
334 class GrGLMorphologyEffect : public GrGLFragmentProcessor { | 334 class GrGLMorphologyEffect : public GrGLFragmentProcessor { |
335 public: | 335 public: |
336 GrGLMorphologyEffect(const GrProcessor&); | 336 GrGLMorphologyEffect(const GrProcessor&); |
337 | 337 |
338 virtual void emitCode(GrGLFPBuilder*, | 338 virtual void emitCode(GrGLFPBuilder*, |
339 const GrFragmentProcessor&, | 339 const GrFragmentProcessor&, |
340 const char* outputColor, | 340 const char* outputColor, |
341 const char* inputColor, | 341 const char* inputColor, |
342 const TransformedCoordsArray&, | 342 const TransformedCoordsArray&, |
343 const TextureSamplerArray&) SK_OVERRIDE; | 343 const TextureSamplerArray&) SK_OVERRIDE; |
344 | 344 |
345 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder* b); | 345 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder* b); |
346 | 346 |
347 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O
VERRIDE; | 347 void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_OVERRIDE; |
348 | 348 |
349 private: | 349 private: |
350 int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); } | 350 int width() const { return GrMorphologyEffect::WidthFromRadius(fRadius); } |
351 | 351 |
352 int fRadius; | 352 int fRadius; |
353 GrMorphologyEffect::MorphologyType fType; | 353 GrMorphologyEffect::MorphologyType fType; |
354 GrGLProgramDataManager::UniformHandle fImageIncrementUni; | 354 GrGLProgramDataManager::UniformHandle fImageIncrementUni; |
355 | 355 |
356 typedef GrGLFragmentProcessor INHERITED; | 356 typedef GrGLFragmentProcessor INHERITED; |
357 }; | 357 }; |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 SkBitmap* result, SkIPoint* offset) con
st { | 603 SkBitmap* result, SkIPoint* offset) con
st { |
604 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); | 604 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); |
605 } | 605 } |
606 | 606 |
607 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, | 607 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const
Context& ctx, |
608 SkBitmap* result, SkIPoint* offset) cons
t { | 608 SkBitmap* result, SkIPoint* offset) cons
t { |
609 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); | 609 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); |
610 } | 610 } |
611 | 611 |
612 #endif | 612 #endif |
OLD | NEW |