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

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

Issue 654273002: Push isEqual/onIsEqual down from GrProcessor to subclasses. (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/SkColorMatrixFilter.cpp ('k') | src/effects/SkLightingImageFilter.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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkDisplacementMapEffect.h" 8 #include "SkDisplacementMapEffect.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const 345 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const
346 { return fXChannelSelector; } 346 { return fXChannelSelector; }
347 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const 347 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const
348 { return fYChannelSelector; } 348 { return fYChannelSelector; }
349 const SkVector& scale() const { return fScale; } 349 const SkVector& scale() const { return fScale; }
350 350
351 typedef GrGLDisplacementMapEffect GLProcessor; 351 typedef GrGLDisplacementMapEffect GLProcessor;
352 static const char* Name() { return "DisplacementMap"; } 352 static const char* Name() { return "DisplacementMap"; }
353 353
354 private: 354 private:
355 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE; 355 virtual bool onIsEqual(const GrFragmentProcessor&) const SK_OVERRIDE;
356 356
357 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE; 357 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR IDE;
358 358
359 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne lSelector, 359 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne lSelector,
360 SkDisplacementMapEffect::ChannelSelectorType yChanne lSelector, 360 SkDisplacementMapEffect::ChannelSelectorType yChanne lSelector,
361 const SkVector& scale, 361 const SkVector& scale,
362 GrTexture* displacement, const SkMatrix& offsetMatri x, 362 GrTexture* displacement, const SkMatrix& offsetMatri x,
363 GrTexture* color); 363 GrTexture* color);
364 364
365 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; 365 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 this->addCoordTransform(&fDisplacementTransform); 472 this->addCoordTransform(&fDisplacementTransform);
473 this->addTextureAccess(&fDisplacementAccess); 473 this->addTextureAccess(&fDisplacementAccess);
474 this->addCoordTransform(&fColorTransform); 474 this->addCoordTransform(&fColorTransform);
475 this->addTextureAccess(&fColorAccess); 475 this->addTextureAccess(&fColorAccess);
476 this->setWillNotUseInputColor(); 476 this->setWillNotUseInputColor();
477 } 477 }
478 478
479 GrDisplacementMapEffect::~GrDisplacementMapEffect() { 479 GrDisplacementMapEffect::~GrDisplacementMapEffect() {
480 } 480 }
481 481
482 bool GrDisplacementMapEffect::onIsEqual(const GrProcessor& sBase) const { 482 bool GrDisplacementMapEffect::onIsEqual(const GrFragmentProcessor& sBase) const {
483 const GrDisplacementMapEffect& s = sBase.cast<GrDisplacementMapEffect>(); 483 const GrDisplacementMapEffect& s = sBase.cast<GrDisplacementMapEffect>();
484 return fDisplacementAccess.getTexture() == s.fDisplacementAccess.getTexture( ) && 484 return fDisplacementAccess.getTexture() == s.fDisplacementAccess.getTexture( ) &&
485 fColorAccess.getTexture() == s.fColorAccess.getTexture() && 485 fColorAccess.getTexture() == s.fColorAccess.getTexture() &&
486 fXChannelSelector == s.fXChannelSelector && 486 fXChannelSelector == s.fXChannelSelector &&
487 fYChannelSelector == s.fYChannelSelector && 487 fYChannelSelector == s.fYChannelSelector &&
488 fScale == s.fScale; 488 fScale == s.fScale;
489 } 489 }
490 490
491 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c onst { 491 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c onst {
492 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta nce(); 492 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta nce();
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, 632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
633 const GrGLCaps&, GrProcessorKeyBuilder* b ) { 633 const GrGLCaps&, GrProcessorKeyBuilder* b ) {
634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
635 635
636 uint32_t xKey = displacementMap.xChannelSelector(); 636 uint32_t xKey = displacementMap.xChannelSelector();
637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
638 638
639 b->add32(xKey | yKey); 639 b->add32(xKey | yKey);
640 } 640 }
641 #endif 641 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkLightingImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698