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

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

Issue 582963002: Solo gp (Closed) Base URL: https://skia.googlesource.com/skia.git@no_peb
Patch Set: rebase 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/SkGpuBlurUtils.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"
11 #include "SkUnPreMultiply.h" 11 #include "SkUnPreMultiply.h"
12 #include "SkColorPriv.h" 12 #include "SkColorPriv.h"
13 #if SK_SUPPORT_GPU 13 #if SK_SUPPORT_GPU
14 #include "GrContext.h" 14 #include "GrContext.h"
15 #include "GrCoordTransform.h" 15 #include "GrCoordTransform.h"
16 #include "gl/GrGLEffect.h" 16 #include "gl/GrGLProcessor.h"
17 #include "gl/builders/GrGLProgramBuilder.h" 17 #include "gl/builders/GrGLProgramBuilder.h"
18 #include "GrTBackendEffectFactory.h" 18 #include "GrTBackendProcessorFactory.h"
19 #endif 19 #endif
20 20
21 namespace { 21 namespace {
22 22
23 #define kChannelSelectorKeyBits 3; // Max value is 4, so 3 bits are required at most 23 #define kChannelSelectorKeyBits 3; // Max value is 4, so 3 bits are required at most
24 24
25 template<SkDisplacementMapEffect::ChannelSelectorType type> 25 template<SkDisplacementMapEffect::ChannelSelectorType type>
26 uint32_t getValue(SkColor, const SkUnPreMultiply::Scale*) { 26 uint32_t getValue(SkColor, const SkUnPreMultiply::Scale*) {
27 SkDEBUGFAIL("Unknown channel selector"); 27 SkDEBUGFAIL("Unknown channel selector");
28 return 0; 28 return 0;
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (getColorInput()) { 290 if (getColorInput()) {
291 return getColorInput()->filterBounds(bounds, ctm, dst); 291 return getColorInput()->filterBounds(bounds, ctm, dst);
292 } 292 }
293 *dst = bounds; 293 *dst = bounds;
294 return true; 294 return true;
295 } 295 }
296 296
297 /////////////////////////////////////////////////////////////////////////////// 297 ///////////////////////////////////////////////////////////////////////////////
298 298
299 #if SK_SUPPORT_GPU 299 #if SK_SUPPORT_GPU
300 class GrGLDisplacementMapEffect : public GrGLEffect { 300 class GrGLDisplacementMapEffect : public GrGLFragmentProcessor {
301 public: 301 public:
302 GrGLDisplacementMapEffect(const GrBackendEffectFactory& factory, 302 GrGLDisplacementMapEffect(const GrBackendProcessorFactory&,
303 const GrEffect& effect); 303 const GrProcessor&);
304 virtual ~GrGLDisplacementMapEffect(); 304 virtual ~GrGLDisplacementMapEffect();
305 305
306 virtual void emitCode(GrGLProgramBuilder*, 306 virtual void emitCode(GrGLProgramBuilder*,
307 const GrEffect&, 307 const GrFragmentProcessor&,
308 const GrEffectKey&, 308 const GrProcessorKey&,
309 const char* outputColor, 309 const char* outputColor,
310 const char* inputColor, 310 const char* inputColor,
311 const TransformedCoordsArray&, 311 const TransformedCoordsArray&,
312 const TextureSamplerArray&) SK_OVERRIDE; 312 const TextureSamplerArray&) SK_OVERRIDE;
313 313
314 static inline void GenKey(const GrEffect&, const GrGLCaps&, GrEffectKeyBuild er*); 314 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe yBuilder*);
315 315
316 virtual void setData(const GrGLProgramDataManager&, const GrEffect&) SK_OVER RIDE; 316 virtual void setData(const GrGLProgramDataManager&, const GrProcessor&) SK_O VERRIDE;
317 317
318 private: 318 private:
319 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; 319 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector;
320 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; 320 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector;
321 GrGLProgramDataManager::UniformHandle fScaleUni; 321 GrGLProgramDataManager::UniformHandle fScaleUni;
322 322
323 typedef GrGLEffect INHERITED; 323 typedef GrGLFragmentProcessor INHERITED;
324 }; 324 };
325 325
326 /////////////////////////////////////////////////////////////////////////////// 326 ///////////////////////////////////////////////////////////////////////////////
327 327
328 class GrDisplacementMapEffect : public GrEffect { 328 class GrDisplacementMapEffect : public GrFragmentProcessor {
329 public: 329 public:
330 static GrEffect* Create(SkDisplacementMapEffect::ChannelSelectorType xChanne lSelector, 330 static GrFragmentProcessor* Create(
331 SkDisplacementMapEffect::ChannelSelectorType yChanne lSelector, 331 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector,
332 SkVector scale, 332 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVec tor scale,
333 GrTexture* displacement, const SkMatrix& offsetMatri x, 333 GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* co lor) {
334 GrTexture* color) {
335 return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector, 334 return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector,
336 yChannelSelector, 335 yChannelSelector,
337 scale, 336 scale,
338 displacement, 337 displacement,
339 offsetMatrix, 338 offsetMatrix,
340 color)); 339 color));
341 } 340 }
342 341
343 virtual ~GrDisplacementMapEffect(); 342 virtual ~GrDisplacementMapEffect();
344 343
345 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; 344 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR IDE;
346 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const 345 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const
347 { return fXChannelSelector; } 346 { return fXChannelSelector; }
348 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const 347 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const
349 { return fYChannelSelector; } 348 { return fYChannelSelector; }
350 const SkVector& scale() const { return fScale; } 349 const SkVector& scale() const { return fScale; }
351 350
352 typedef GrGLDisplacementMapEffect GLEffect; 351 typedef GrGLDisplacementMapEffect GLProcessor;
353 static const char* Name() { return "DisplacementMap"; } 352 static const char* Name() { return "DisplacementMap"; }
354 353
355 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE; 354 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE;
356 355
357 private: 356 private:
358 virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE; 357 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE;
359 358
360 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne lSelector, 359 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne lSelector,
361 SkDisplacementMapEffect::ChannelSelectorType yChanne lSelector, 360 SkDisplacementMapEffect::ChannelSelectorType yChanne lSelector,
362 const SkVector& scale, 361 const SkVector& scale,
363 GrTexture* displacement, const SkMatrix& offsetMatri x, 362 GrTexture* displacement, const SkMatrix& offsetMatri x,
364 GrTexture* color); 363 GrTexture* color);
365 364
366 GR_DECLARE_EFFECT_TEST; 365 GR_DECLARE_FRAGMENT_PROCESSOR_TEST;
367 366
368 GrCoordTransform fDisplacementTransform; 367 GrCoordTransform fDisplacementTransform;
369 GrTextureAccess fDisplacementAccess; 368 GrTextureAccess fDisplacementAccess;
370 GrCoordTransform fColorTransform; 369 GrCoordTransform fColorTransform;
371 GrTextureAccess fColorAccess; 370 GrTextureAccess fColorAccess;
372 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; 371 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector;
373 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; 372 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector;
374 SkVector fScale; 373 SkVector fScale;
375 374
376 typedef GrEffect INHERITED; 375 typedef GrFragmentProcessor INHERITED;
377 }; 376 };
378 377
379 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx, 378 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src, const Context& ctx,
380 SkBitmap* result, SkIPoint* offset) const { 379 SkBitmap* result, SkIPoint* offset) const {
381 SkBitmap colorBM = src; 380 SkBitmap colorBM = src;
382 SkIPoint colorOffset = SkIPoint::Make(0, 0); 381 SkIPoint colorOffset = SkIPoint::Make(0, 0);
383 if (getColorInput() && !getColorInput()->getInputResultGPU(proxy, src, ctx, &colorBM, 382 if (getColorInput() && !getColorInput()->getInputResultGPU(proxy, src, ctx, &colorBM,
384 &colorOffset)) { 383 &colorOffset)) {
385 return false; 384 return false;
386 } 385 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); 423 GrContext::AutoRenderTarget art(context, dst->asRenderTarget());
425 424
426 SkVector scale = SkVector::Make(fScale, fScale); 425 SkVector scale = SkVector::Make(fScale, fScale);
427 ctx.ctm().mapVectors(&scale, 1); 426 ctx.ctm().mapVectors(&scale, 1);
428 427
429 GrPaint paint; 428 GrPaint paint;
430 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem ent); 429 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem ent);
431 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset. fX), 430 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset. fX),
432 SkIntToScalar(colorOffset.fY - displacementOffset. fY)); 431 SkIntToScalar(colorOffset.fY - displacementOffset. fY));
433 432
434 paint.addColorEffect( 433 paint.addColorProcessor(
435 GrDisplacementMapEffect::Create(fXChannelSelector, 434 GrDisplacementMapEffect::Create(fXChannelSelector,
436 fYChannelSelector, 435 fYChannelSelector,
437 scale, 436 scale,
438 displacement, 437 displacement,
439 offsetMatrix, 438 offsetMatrix,
440 color))->unref(); 439 color))->unref();
441 SkIRect colorBounds = bounds; 440 SkIRect colorBounds = bounds;
442 colorBounds.offset(-colorOffset); 441 colorBounds.offset(-colorOffset);
443 GrContext::AutoMatrix am; 442 GrContext::AutoMatrix am;
444 am.setIdentity(context); 443 am.setIdentity(context);
(...skipping 27 matching lines...) Expand all
472 this->addCoordTransform(&fDisplacementTransform); 471 this->addCoordTransform(&fDisplacementTransform);
473 this->addTextureAccess(&fDisplacementAccess); 472 this->addTextureAccess(&fDisplacementAccess);
474 this->addCoordTransform(&fColorTransform); 473 this->addCoordTransform(&fColorTransform);
475 this->addTextureAccess(&fColorAccess); 474 this->addTextureAccess(&fColorAccess);
476 this->setWillNotUseInputColor(); 475 this->setWillNotUseInputColor();
477 } 476 }
478 477
479 GrDisplacementMapEffect::~GrDisplacementMapEffect() { 478 GrDisplacementMapEffect::~GrDisplacementMapEffect() {
480 } 479 }
481 480
482 bool GrDisplacementMapEffect::onIsEqual(const GrEffect& sBase) const { 481 bool GrDisplacementMapEffect::onIsEqual(const GrProcessor& sBase) const {
483 const GrDisplacementMapEffect& s = sBase.cast<GrDisplacementMapEffect>(); 482 const GrDisplacementMapEffect& s = sBase.cast<GrDisplacementMapEffect>();
484 return fDisplacementAccess.getTexture() == s.fDisplacementAccess.getTexture( ) && 483 return fDisplacementAccess.getTexture() == s.fDisplacementAccess.getTexture( ) &&
485 fColorAccess.getTexture() == s.fColorAccess.getTexture() && 484 fColorAccess.getTexture() == s.fColorAccess.getTexture() &&
486 fXChannelSelector == s.fXChannelSelector && 485 fXChannelSelector == s.fXChannelSelector &&
487 fYChannelSelector == s.fYChannelSelector && 486 fYChannelSelector == s.fYChannelSelector &&
488 fScale == s.fScale; 487 fScale == s.fScale;
489 } 488 }
490 489
491 const GrBackendEffectFactory& GrDisplacementMapEffect::getFactory() const { 490 const GrBackendFragmentProcessorFactory& GrDisplacementMapEffect::getFactory() c onst {
492 return GrTBackendEffectFactory<GrDisplacementMapEffect>::getInstance(); 491 return GrTBackendFragmentProcessorFactory<GrDisplacementMapEffect>::getInsta nce();
493 } 492 }
494 493
495 void GrDisplacementMapEffect::getConstantColorComponents(GrColor*, 494 void GrDisplacementMapEffect::getConstantColorComponents(GrColor*,
496 uint32_t* validFlags) c onst { 495 uint32_t* validFlags) c onst {
497 // Any displacement offset bringing a pixel out of bounds will output a colo r of (0,0,0,0), 496 // Any displacement offset bringing a pixel out of bounds will output a colo r of (0,0,0,0),
498 // so the only way we'd get a constant alpha is if the input color image has a constant alpha 497 // so the only way we'd get a constant alpha is if the input color image has a constant alpha
499 // and no displacement offset push any texture coordinates out of bounds OR if the constant 498 // and no displacement offset push any texture coordinates out of bounds OR if the constant
500 // alpha is 0. Since this isn't trivial to compute at this point, let's assu me the output is 499 // alpha is 0. Since this isn't trivial to compute at this point, let's assu me the output is
501 // not of constant color when a displacement effect is applied. 500 // not of constant color when a displacement effect is applied.
502 *validFlags = 0; 501 *validFlags = 0;
503 } 502 }
504 503
505 /////////////////////////////////////////////////////////////////////////////// 504 ///////////////////////////////////////////////////////////////////////////////
506 505
507 GR_DEFINE_EFFECT_TEST(GrDisplacementMapEffect); 506 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrDisplacementMapEffect);
508 507
509 GrEffect* GrDisplacementMapEffect::TestCreate(SkRandom* random, 508 GrFragmentProcessor* GrDisplacementMapEffect::TestCreate(SkRandom* random,
510 GrContext*, 509 GrContext*,
511 const GrDrawTargetCaps&, 510 const GrDrawTargetCaps&,
512 GrTexture* textures[]) { 511 GrTexture* textures[]) {
513 int texIdxDispl = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : 512 int texIdxDispl = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureId x :
514 GrEffectUnitTest::kAlphaTextureIdx; 513 GrProcessorUnitTest::kAlphaTextureIdx ;
515 int texIdxColor = random->nextBool() ? GrEffectUnitTest::kSkiaPMTextureIdx : 514 int texIdxColor = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureId x :
516 GrEffectUnitTest::kAlphaTextureIdx; 515 GrProcessorUnitTest::kAlphaTextureIdx ;
517 static const int kMaxComponent = 4; 516 static const int kMaxComponent = 4;
518 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector = 517 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector =
519 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( 518 static_cast<SkDisplacementMapEffect::ChannelSelectorType>(
520 random->nextRangeU(1, kMaxComponent)); 519 random->nextRangeU(1, kMaxComponent));
521 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector = 520 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector =
522 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( 521 static_cast<SkDisplacementMapEffect::ChannelSelectorType>(
523 random->nextRangeU(1, kMaxComponent)); 522 random->nextRangeU(1, kMaxComponent));
524 SkVector scale = SkVector::Make(random->nextRangeScalar(0, 100.0f), 523 SkVector scale = SkVector::Make(random->nextRangeScalar(0, 100.0f),
525 random->nextRangeScalar(0, 100.0f)); 524 random->nextRangeScalar(0, 100.0f));
526 525
527 return GrDisplacementMapEffect::Create(xChannelSelector, yChannelSelector, s cale, 526 return GrDisplacementMapEffect::Create(xChannelSelector, yChannelSelector, s cale,
528 textures[texIdxDispl], SkMatrix::I(), 527 textures[texIdxDispl], SkMatrix::I(),
529 textures[texIdxColor]); 528 textures[texIdxColor]);
530 } 529 }
531 530
532 /////////////////////////////////////////////////////////////////////////////// 531 ///////////////////////////////////////////////////////////////////////////////
533 532
534 GrGLDisplacementMapEffect::GrGLDisplacementMapEffect(const GrBackendEffectFactor y& factory, 533 GrGLDisplacementMapEffect::GrGLDisplacementMapEffect(const GrBackendProcessorFac tory& factory,
535 const GrEffect& effect) 534 const GrProcessor& proc)
536 : INHERITED(factory) 535 : INHERITED(factory)
537 , fXChannelSelector(effect.cast<GrDisplacementMapEffect>().xChannelSelector( )) 536 , fXChannelSelector(proc.cast<GrDisplacementMapEffect>().xChannelSelector())
538 , fYChannelSelector(effect.cast<GrDisplacementMapEffect>().yChannelSelector( )) { 537 , fYChannelSelector(proc.cast<GrDisplacementMapEffect>().yChannelSelector()) {
539 } 538 }
540 539
541 GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() { 540 GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() {
542 } 541 }
543 542
544 void GrGLDisplacementMapEffect::emitCode(GrGLProgramBuilder* builder, 543 void GrGLDisplacementMapEffect::emitCode(GrGLProgramBuilder* builder,
545 const GrEffect&, 544 const GrFragmentProcessor&,
546 const GrEffectKey& key, 545 const GrProcessorKey& key,
547 const char* outputColor, 546 const char* outputColor,
548 const char* inputColor, 547 const char* inputColor,
549 const TransformedCoordsArray& coords, 548 const TransformedCoordsArray& coords,
550 const TextureSamplerArray& samplers) { 549 const TextureSamplerArray& samplers) {
551 sk_ignore_unused_variable(inputColor); 550 sk_ignore_unused_variable(inputColor);
552 551
553 fScaleUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, 552 fScaleUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility,
554 kVec2f_GrSLType, "Scale"); 553 kVec2f_GrSLType, "Scale");
555 const char* scaleUni = builder->getUniformCStr(fScaleUni); 554 const char* scaleUni = builder->getUniformCStr(fScaleUni);
556 const char* dColor = "dColor"; 555 const char* dColor = "dColor";
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 // a 0 border color instead of computing if cCoords is out of bounds here. 612 // a 0 border color instead of computing if cCoords is out of bounds here.
614 fsBuilder->codeAppendf( 613 fsBuilder->codeAppendf(
615 "bool %s = (%s.x < 0.0) || (%s.y < 0.0) || (%s.x > 1.0) || (%s.y > 1.0); \t\t", 614 "bool %s = (%s.x < 0.0) || (%s.y < 0.0) || (%s.x > 1.0) || (%s.y > 1.0); \t\t",
616 outOfBounds, cCoords, cCoords, cCoords, cCoords); 615 outOfBounds, cCoords, cCoords, cCoords, cCoords);
617 fsBuilder->codeAppendf("%s = %s ? vec4(0.0) : ", outputColor, outOfBounds); 616 fsBuilder->codeAppendf("%s = %s ? vec4(0.0) : ", outputColor, outOfBounds);
618 fsBuilder->appendTextureLookup(samplers[1], cCoords, coords[1].getType()); 617 fsBuilder->appendTextureLookup(samplers[1], cCoords, coords[1].getType());
619 fsBuilder->codeAppend(";\n"); 618 fsBuilder->codeAppend(";\n");
620 } 619 }
621 620
622 void GrGLDisplacementMapEffect::setData(const GrGLProgramDataManager& pdman, 621 void GrGLDisplacementMapEffect::setData(const GrGLProgramDataManager& pdman,
623 const GrEffect& effect) { 622 const GrProcessor& proc) {
624 const GrDisplacementMapEffect& displacementMap = effect.cast<GrDisplacementM apEffect>(); 623 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
625 GrTexture* colorTex = displacementMap.texture(1); 624 GrTexture* colorTex = displacementMap.texture(1);
626 SkScalar scaleX = SkScalarDiv(displacementMap.scale().fX, SkIntToScalar(colo rTex->width())); 625 SkScalar scaleX = SkScalarDiv(displacementMap.scale().fX, SkIntToScalar(colo rTex->width()));
627 SkScalar scaleY = SkScalarDiv(displacementMap.scale().fY, SkIntToScalar(colo rTex->height())); 626 SkScalar scaleY = SkScalarDiv(displacementMap.scale().fY, SkIntToScalar(colo rTex->height()));
628 pdman.set2f(fScaleUni, SkScalarToFloat(scaleX), 627 pdman.set2f(fScaleUni, SkScalarToFloat(scaleX),
629 colorTex->origin() == kTopLeft_GrSurfaceOrigin ? 628 colorTex->origin() == kTopLeft_GrSurfaceOrigin ?
630 SkScalarToFloat(scaleY) : SkScalarToFloat(-scaleY)); 629 SkScalarToFloat(scaleY) : SkScalarToFloat(-scaleY));
631 } 630 }
632 631
633 void GrGLDisplacementMapEffect::GenKey(const GrEffect& effect, 632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc,
634 const GrGLCaps&, GrEffectKeyBuilder* b) { 633 const GrGLCaps&, GrProcessorKeyBuilder* b ) {
635 const GrDisplacementMapEffect& displacementMap = effect.cast<GrDisplacementM apEffect>(); 634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap Effect>();
636 635
637 uint32_t xKey = displacementMap.xChannelSelector(); 636 uint32_t xKey = displacementMap.xChannelSelector();
638 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s; 637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit s;
639 638
640 b->add32(xKey | yKey); 639 b->add32(xKey | yKey);
641 } 640 }
642 #endif 641 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorMatrixFilter.cpp ('k') | src/effects/SkGpuBlurUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698