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

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

Issue 643743003: Create helper functions to use in computeInvariantOutput calls (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update blurMaskFilter 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 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c onst { 490 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c onst {
491 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta nce(); 491 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta nce();
492 } 492 }
493 493
494 void GrDisplacementMapEffect::onComputeInvariantOutput(InvariantOutput* inout) c onst { 494 void GrDisplacementMapEffect::onComputeInvariantOutput(InvariantOutput* inout) c onst {
495 // Any displacement offset bringing a pixel out of bounds will output a colo r of (0,0,0,0), 495 // Any displacement offset bringing a pixel out of bounds will output a colo r of (0,0,0,0),
496 // so the only way we'd get a constant alpha is if the input color image has a constant alpha 496 // so the only way we'd get a constant alpha is if the input color image has a constant alpha
497 // and no displacement offset push any texture coordinates out of bounds OR if the constant 497 // and no displacement offset push any texture coordinates out of bounds OR if the constant
498 // alpha is 0. Since this isn't trivial to compute at this point, let's assu me the output is 498 // alpha is 0. Since this isn't trivial to compute at this point, let's assu me the output is
499 // not of constant color when a displacement effect is applied. 499 // not of constant color when a displacement effect is applied.
500 inout->fValidFlags = 0; 500 inout->setToUnknown();
501 inout->fIsSingleComponent = false;
502 } 501 }
503 502
504 /////////////////////////////////////////////////////////////////////////////// 503 ///////////////////////////////////////////////////////////////////////////////
505 504
506 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect); 505 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect);
507 506
508 GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(SkRandom* random, 507 GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(SkRandom* random,
509 GrContext*, 508 GrContext*,
510 const GrDrawTargetCaps&, 509 const GrDrawTargetCaps&,
511 GrTexture* textures[]) { 510 GrTexture* textures[]) {
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, 631 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
633 const GrGLCaps&, GrProcessorKeyBuilder* b ) { 632 const GrGLCaps&, GrProcessorKeyBuilder* b ) {
634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>(); 633 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
635 634
636 uint32_t xKey = displacementMap.xChannelSelector(); 635 uint32_t xKey = displacementMap.xChannelSelector();
637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 636 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
638 637
639 b->add32(xKey | yKey); 638 b->add32(xKey | yKey);
640 } 639 }
641 #endif 640 #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