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

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

Issue 699943003: Move GrInvariantOutput out of GrProcessor and into its own class. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Cleanup Created 6 years, 1 month 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"
11 #include "SkReadBuffer.h" 11 #include "SkReadBuffer.h"
12 #include "SkWriteBuffer.h" 12 #include "SkWriteBuffer.h"
13 #include "SkRect.h" 13 #include "SkRect.h"
14 #include "SkMorphology_opts.h" 14 #include "SkMorphology_opts.h"
15 #if SK_SUPPORT_GPU 15 #if SK_SUPPORT_GPU
16 #include "GrContext.h" 16 #include "GrContext.h"
17 #include "GrInvariantOutput.h"
17 #include "GrTexture.h" 18 #include "GrTexture.h"
18 #include "GrTBackendProcessorFactory.h" 19 #include "GrTBackendProcessorFactory.h"
19 #include "gl/GrGLProcessor.h" 20 #include "gl/GrGLProcessor.h"
20 #include "gl/builders/GrGLProgramBuilder.h" 21 #include "gl/builders/GrGLProgramBuilder.h"
21 #include "effects/Gr1DKernelEffect.h" 22 #include "effects/Gr1DKernelEffect.h"
22 #endif 23 #endif
23 24
24 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING 25 #ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
25 SkMorphologyImageFilter::SkMorphologyImageFilter(SkReadBuffer& buffer) 26 SkMorphologyImageFilter::SkMorphologyImageFilter(SkReadBuffer& buffer)
26 : INHERITED(1, buffer) { 27 : INHERITED(1, buffer) {
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 311
311 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE; 312 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
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 GrFragmentProcessor&) const SK_OVERRIDE; 319 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
319 320
320 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 321 virtual void onComputeInvariantOutput(GrInvariantOutput* inout) const SK_OVE RRIDE;
321 322
322 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType); 323 GrMorphologyEffect(GrTexture*, Direction, int radius, MorphologyType);
323 324
324 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 325 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
325 326
326 typedef Gr1DKernelEffect INHERITED; 327 typedef Gr1DKernelEffect INHERITED;
327 }; 328 };
328 329
329 /////////////////////////////////////////////////////////////////////////////// 330 ///////////////////////////////////////////////////////////////////////////////
330 331
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 return GrTBackendFragmentProcessorFactory<GrMorphologyEffect>::getInstance() ; 449 return GrTBackendFragmentProcessorFactory<GrMorphologyEffect>::getInstance() ;
449 } 450 }
450 451
451 bool GrMorphologyEffect::onIsEqual(const GrFragmentProcessor& sBase) const { 452 bool GrMorphologyEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
452 const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>(); 453 const GrMorphologyEffect& s = sBase.cast<GrMorphologyEffect>();
453 return (this->radius() == s.radius() && 454 return (this->radius() == s.radius() &&
454 this->direction() == s.direction() && 455 this->direction() == s.direction() &&
455 this->type() == s.type()); 456 this->type() == s.type());
456 } 457 }
457 458
458 void GrMorphologyEffect::onComputeInvariantOutput(InvariantOutput* inout) const { 459 void GrMorphologyEffect::onComputeInvariantOutput(GrInvariantOutput* inout) cons t {
459 // This is valid because the color components of the result of the kernel al l come 460 // 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. 461 // exactly from existing values in the source texture.
461 this->updateInvariantOutputForModulation(inout); 462 this->updateInvariantOutputForModulation(inout);
462 } 463 }
463 464
464 /////////////////////////////////////////////////////////////////////////////// 465 ///////////////////////////////////////////////////////////////////////////////
465 466
466 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect); 467 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMorphologyEffect);
467 468
468 GrFragmentProcessor* GrMorphologyEffect::TestCreate(SkRandom* random, 469 GrFragmentProcessor* GrMorphologyEffect::TestCreate(SkRandom* random,
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 SkBitmap* result, SkIPoint* offset) con st { 602 SkBitmap* result, SkIPoint* offset) con st {
602 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset); 603 return this->filterImageGPUGeneric(true, proxy, src, ctx, result, offset);
603 } 604 }
604 605
605 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 606 bool SkErodeImageFilter::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
606 SkBitmap* result, SkIPoint* offset) cons t { 607 SkBitmap* result, SkIPoint* offset) cons t {
607 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset); 608 return this->filterImageGPUGeneric(false, proxy, src, ctx, result, offset);
608 } 609 }
609 610
610 #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