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

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

Issue 617853003: Revert of Add isSingleComponent bool to getConstantColorComponent (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/SkMagnifierImageFilter.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 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
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;
312 313
313 protected: 314 protected:
314 315
315 MorphologyType fType; 316 MorphologyType fType;
316 317
317 private: 318 private:
318 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; 319 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
319 320
320 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE;
321
322 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); 321 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType);
323 322
324 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 323 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
325 324
326 typedef Gr1DKernelEffect INHERITED; 325 typedef Gr1DKernelEffect INHERITED;
327 }; 326 };
328 327
329 /////////////////////////////////////////////////////////////////////////////// 328 ///////////////////////////////////////////////////////////////////////////////
330 329
331 class GrGLMorphologyEffect : public GrGLFragmentProcessor { 330 class GrGLMorphologyEffect : public GrGLFragmentProcessor {
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 } 448 }
450 449
451 bool GrMorphologyEffect::onIsEqual(const GrProcessor& sBase) const { 450 bool GrMorphologyEffect::onIsEqual(const GrProcessor& sBase) const {
452 const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>(); 451 const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>();
453 return (this->texture(0) == s.texture(0) && 452 return (this->texture(0) == s.texture(0) &&
454 this->radius() == s.radius() && 453 this->radius() == s.radius() &&
455 this->direction() == s.direction() && 454 this->direction() == s.direction() &&
456 this->type() == s.type()); 455 this->type() == s.type());
457 } 456 }
458 457
459 void GrMorphologyEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 458 void GrMorphologyEffect::getConstantColorComponents(GrColor* color, uint32_t* va lidFlags) const {
460 // This is valid because the color components of the result of the kernel al l come 459 // This is valid because the color components of the result of the kernel al l come
461 // exactly from existing values in the source texture. 460 // exactly from existing values in the source texture.
462 this->updateInvariantOutputForModulation(inout); 461 this->updateConstantColorComponentsForModulation(color, validFlags);
463 inout->fIsSingleComponent = false;
464 } 462 }
465 463
466 /////////////////////////////////////////////////////////////////////////////// 464 ///////////////////////////////////////////////////////////////////////////////
467 465
468 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect); 466 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect);
469 467
470 GrFragmentProcessor* GrMorphologyEffect::TestCreate(SkRandom* random, 468 GrFragmentProcessor* GrMorphologyEffect::TestCreate(SkRandom* random,
471 GrContext*, 469 GrContext*,
472 const GrDrawTargetCaps&, 470 const GrDrawTargetCaps&,
473 GrTexture* textures[]) { 471 GrTexture* textures[]) {
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 SkBitmap* result, SkIPoint* offset) con st { 602 SkBitmap* result, SkIPoint* offset) con st {
605 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 603 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
606 } 604 }
607 605
608 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 606 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
609 SkBitmap* result, SkIPoint* offset) cons t { 607 SkBitmap* result, SkIPoint* offset) cons t {
610 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 608 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
611 } 609 }
612 610
613 #endif 611 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMagnifierImageFilter.cpp ('k') | src/effects/SkPerlinNoiseShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698