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

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

Issue 1266633003: Added registerChild; transforms, textures, glKey automatically handled. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: refactored to onGetGLProcessorKey; removed emitSamplers specialized template; fixed nits Created 5 years, 4 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 yChannelSelector, 337 yChannelSelector,
338 scale, 338 scale,
339 displacement, 339 displacement,
340 offsetMatrix, 340 offsetMatrix,
341 color, 341 color,
342 colorDimensions)); 342 colorDimensions));
343 } 343 }
344 344
345 virtual ~GrDisplacementMapEffect(); 345 virtual ~GrDisplacementMapEffect();
346 346
347 virtual void getGLProcessorKey(const GrGLSLCaps& caps,
348 GrProcessorKeyBuilder* b) const override {
349 GrGLDisplacementMapEffect::GenKey(*this, caps, b);
350 }
351
352 GrGLFragmentProcessor* createGLInstance() const override { 347 GrGLFragmentProcessor* createGLInstance() const override {
353 return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this)); 348 return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this));
354 } 349 }
355 350
356 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const 351 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const
357 { return fXChannelSelector; } 352 { return fXChannelSelector; }
358 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const 353 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const
359 { return fYChannelSelector; } 354 { return fYChannelSelector; }
360 const SkVector& scale() const { return fScale; } 355 const SkVector& scale() const { return fScale; }
361 356
362 const char* name() const override { return "DisplacementMap"; } 357 const char* name() const override { return "DisplacementMap"; }
363 const GrTextureDomain& domain() const { return fDomain; } 358 const GrTextureDomain& domain() const { return fDomain; }
364 359
365 private: 360 private:
361 virtual void onGetGLProcessorKey(const GrGLSLCaps& caps,
362 GrProcessorKeyBuilder* b) const override {
363 GrGLDisplacementMapEffect::GenKey(*this, caps, b);
364 }
365
366 bool onIsEqual(const GrFragmentProcessor&) const override; 366 bool onIsEqual(const GrFragmentProcessor&) const override;
367 367
368 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; 368 void onComputeInvariantOutput(GrInvariantOutput* inout) const override;
369 369
370 GrDisplacementMapEffect(GrProcessorDataManager*, 370 GrDisplacementMapEffect(GrProcessorDataManager*,
371 SkDisplacementMapEffect::ChannelSelectorType xChanne lSelector, 371 SkDisplacementMapEffect::ChannelSelectorType xChanne lSelector,
372 SkDisplacementMapEffect::ChannelSelectorType yChanne lSelector, 372 SkDisplacementMapEffect::ChannelSelectorType yChanne lSelector,
373 const SkVector& scale, 373 const SkVector& scale,
374 GrTexture* displacement, const SkMatrix& offsetMatri x, 374 GrTexture* displacement, const SkMatrix& offsetMatri x,
375 GrTexture* color, 375 GrTexture* color,
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 const GrGLSLCaps&, GrProcessorKeyBuilder* b) { 638 const GrGLSLCaps&, GrProcessorKeyBuilder* b) {
639 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 639 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
640 640
641 uint32_t xKey = displacementMap.xChannelSelector(); 641 uint32_t xKey = displacementMap.xChannelSelector();
642 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 642 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
643 643
644 b->add32(xKey | yKey); 644 b->add32(xKey | yKey);
645 } 645 }
646 #endif 646 #endif
647 647
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