OLD | NEW |
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 "GrInvariantOutput.h" | 16 #include "GrInvariantOutput.h" |
| 17 #include "effects/GrTextureDomain.h" |
17 #include "gl/GrGLProcessor.h" | 18 #include "gl/GrGLProcessor.h" |
18 #include "gl/builders/GrGLProgramBuilder.h" | 19 #include "gl/builders/GrGLProgramBuilder.h" |
19 #endif | 20 #endif |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 #define kChannelSelectorKeyBits 3; // Max value is 4, so 3 bits are required at
most | 24 #define kChannelSelectorKeyBits 3; // Max value is 4, so 3 bits are required at
most |
24 | 25 |
25 template<SkDisplacementMapEffect::ChannelSelectorType type> | 26 template<SkDisplacementMapEffect::ChannelSelectorType type> |
26 uint32_t getValue(SkColor, const SkUnPreMultiply::Scale*) { | 27 uint32_t getValue(SkColor, const SkUnPreMultiply::Scale*) { |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 virtual void emitCode(GrGLFPBuilder*, | 308 virtual void emitCode(GrGLFPBuilder*, |
308 const GrFragmentProcessor&, | 309 const GrFragmentProcessor&, |
309 const char* outputColor, | 310 const char* outputColor, |
310 const char* inputColor, | 311 const char* inputColor, |
311 const TransformedCoordsArray&, | 312 const TransformedCoordsArray&, |
312 const TextureSamplerArray&) override; | 313 const TextureSamplerArray&) override; |
313 | 314 |
314 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); | 315 static inline void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKe
yBuilder*); |
315 | 316 |
316 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; | 317 void setData(const GrGLProgramDataManager&, const GrProcessor&) override; |
| 318 const GrTextureDomain::GLDomain& glDomain() const { return fGLDomain; } |
317 | 319 |
318 private: | 320 private: |
319 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; | 321 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; |
320 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; | 322 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; |
321 GrGLProgramDataManager::UniformHandle fScaleUni; | 323 GrGLProgramDataManager::UniformHandle fScaleUni; |
| 324 GrTextureDomain::GLDomain fGLDomain; |
322 | 325 |
323 typedef GrGLFragmentProcessor INHERITED; | 326 typedef GrGLFragmentProcessor INHERITED; |
324 }; | 327 }; |
325 | 328 |
326 /////////////////////////////////////////////////////////////////////////////// | 329 /////////////////////////////////////////////////////////////////////////////// |
327 | 330 |
328 class GrDisplacementMapEffect : public GrFragmentProcessor { | 331 class GrDisplacementMapEffect : public GrFragmentProcessor { |
329 public: | 332 public: |
330 static GrFragmentProcessor* Create( | 333 static GrFragmentProcessor* Create( |
331 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, | 334 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector, |
332 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVec
tor scale, | 335 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector, SkVec
tor scale, |
333 GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* co
lor) { | 336 GrTexture* displacement, const SkMatrix& offsetMatrix, GrTexture* co
lor, |
| 337 const SkISize& colorDimensions) { |
334 return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector, | 338 return SkNEW_ARGS(GrDisplacementMapEffect, (xChannelSelector, |
335 yChannelSelector, | 339 yChannelSelector, |
336 scale, | 340 scale, |
337 displacement, | 341 displacement, |
338 offsetMatrix, | 342 offsetMatrix, |
339 color)); | 343 color, |
| 344 colorDimensions)); |
340 } | 345 } |
341 | 346 |
342 virtual ~GrDisplacementMapEffect(); | 347 virtual ~GrDisplacementMapEffect(); |
343 | 348 |
344 virtual void getGLProcessorKey(const GrGLCaps& caps, | 349 virtual void getGLProcessorKey(const GrGLCaps& caps, |
345 GrProcessorKeyBuilder* b) const override { | 350 GrProcessorKeyBuilder* b) const override { |
346 GrGLDisplacementMapEffect::GenKey(*this, caps, b); | 351 GrGLDisplacementMapEffect::GenKey(*this, caps, b); |
347 } | 352 } |
348 | 353 |
349 GrGLFragmentProcessor* createGLInstance() const override { | 354 GrGLFragmentProcessor* createGLInstance() const override { |
350 return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this)); | 355 return SkNEW_ARGS(GrGLDisplacementMapEffect, (*this)); |
351 } | 356 } |
352 | 357 |
353 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const | 358 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector() const |
354 { return fXChannelSelector; } | 359 { return fXChannelSelector; } |
355 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const | 360 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector() const |
356 { return fYChannelSelector; } | 361 { return fYChannelSelector; } |
357 const SkVector& scale() const { return fScale; } | 362 const SkVector& scale() const { return fScale; } |
358 | 363 |
359 const char* name() const override { return "DisplacementMap"; } | 364 const char* name() const override { return "DisplacementMap"; } |
| 365 const GrTextureDomain& domain() const { return fDomain; } |
360 | 366 |
361 private: | 367 private: |
362 bool onIsEqual(const GrFragmentProcessor&) const override; | 368 bool onIsEqual(const GrFragmentProcessor&) const override; |
363 | 369 |
364 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 370 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
365 | 371 |
366 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne
lSelector, | 372 GrDisplacementMapEffect(SkDisplacementMapEffect::ChannelSelectorType xChanne
lSelector, |
367 SkDisplacementMapEffect::ChannelSelectorType yChanne
lSelector, | 373 SkDisplacementMapEffect::ChannelSelectorType yChanne
lSelector, |
368 const SkVector& scale, | 374 const SkVector& scale, |
369 GrTexture* displacement, const SkMatrix& offsetMatri
x, | 375 GrTexture* displacement, const SkMatrix& offsetMatri
x, |
370 GrTexture* color); | 376 GrTexture* color, |
| 377 const SkISize& colorDimensions); |
371 | 378 |
372 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 379 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
373 | 380 |
374 GrCoordTransform fDisplacementTransform; | 381 GrCoordTransform fDisplacementTransform; |
375 GrTextureAccess fDisplacementAccess; | 382 GrTextureAccess fDisplacementAccess; |
376 GrCoordTransform fColorTransform; | 383 GrCoordTransform fColorTransform; |
| 384 GrTextureDomain fDomain; |
377 GrTextureAccess fColorAccess; | 385 GrTextureAccess fColorAccess; |
378 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; | 386 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; |
379 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; | 387 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; |
380 SkVector fScale; | 388 SkVector fScale; |
381 | 389 |
382 typedef GrFragmentProcessor INHERITED; | 390 typedef GrFragmentProcessor INHERITED; |
383 }; | 391 }; |
384 | 392 |
385 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
const Context& ctx, | 393 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
const Context& ctx, |
386 SkBitmap* result, SkIPoint* offset)
const { | 394 SkBitmap* result, SkIPoint* offset)
const { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); | 443 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); |
436 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset.
fX), | 444 offsetMatrix.preTranslate(SkIntToScalar(colorOffset.fX - displacementOffset.
fX), |
437 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); | 445 SkIntToScalar(colorOffset.fY - displacementOffset.
fY)); |
438 | 446 |
439 paint.addColorProcessor( | 447 paint.addColorProcessor( |
440 GrDisplacementMapEffect::Create(fXChannelSelector, | 448 GrDisplacementMapEffect::Create(fXChannelSelector, |
441 fYChannelSelector, | 449 fYChannelSelector, |
442 scale, | 450 scale, |
443 displacement, | 451 displacement, |
444 offsetMatrix, | 452 offsetMatrix, |
445 color))->unref(); | 453 color, |
| 454 colorBM.dimensions()))->unref(); |
446 SkIRect colorBounds = bounds; | 455 SkIRect colorBounds = bounds; |
447 colorBounds.offset(-colorOffset); | 456 colorBounds.offset(-colorOffset); |
448 SkMatrix matrix; | 457 SkMatrix matrix; |
449 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), | 458 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), |
450 -SkIntToScalar(colorBounds.y())); | 459 -SkIntToScalar(colorBounds.y())); |
451 context->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, matrix, | 460 context->drawRect(dst->asRenderTarget(), GrClip::WideOpen(), paint, matrix, |
452 SkRect::Make(colorBounds)); | 461 SkRect::Make(colorBounds)); |
453 offset->fX = bounds.left(); | 462 offset->fX = bounds.left(); |
454 offset->fY = bounds.top(); | 463 offset->fY = bounds.top(); |
455 WrapTexture(dst, bounds.width(), bounds.height(), result); | 464 WrapTexture(dst, bounds.width(), bounds.height(), result); |
456 return true; | 465 return true; |
457 } | 466 } |
458 | 467 |
459 /////////////////////////////////////////////////////////////////////////////// | 468 /////////////////////////////////////////////////////////////////////////////// |
460 | 469 |
461 GrDisplacementMapEffect::GrDisplacementMapEffect( | 470 GrDisplacementMapEffect::GrDisplacementMapEffect( |
462 SkDisplacementMapEffect::ChannelSelectorType xChann
elSelector, | 471 SkDisplacementMapEffect::ChannelSelectorType xChann
elSelector, |
463 SkDisplacementMapEffect::ChannelSelectorType yChann
elSelector, | 472 SkDisplacementMapEffect::ChannelSelectorType yChann
elSelector, |
464 const SkVector& scale, | 473 const SkVector& scale, |
465 GrTexture* displacement, | 474 GrTexture* displacement, |
466 const SkMatrix& offsetMatrix, | 475 const SkMatrix& offsetMatrix, |
467 GrTexture* color) | 476 GrTexture* color, |
| 477 const SkISize& colorDimensions) |
468 : fDisplacementTransform(kLocal_GrCoordSet, offsetMatrix, displacement, | 478 : fDisplacementTransform(kLocal_GrCoordSet, offsetMatrix, displacement, |
469 GrTextureParams::kNone_FilterMode) | 479 GrTextureParams::kNone_FilterMode) |
470 , fDisplacementAccess(displacement) | 480 , fDisplacementAccess(displacement) |
471 , fColorTransform(kLocal_GrCoordSet, color, GrTextureParams::kNone_FilterMod
e) | 481 , fColorTransform(kLocal_GrCoordSet, color, GrTextureParams::kNone_FilterMod
e) |
| 482 , fDomain(GrTextureDomain::MakeTexelDomain(color, SkIRect::MakeSize(colorDim
ensions)), |
| 483 GrTextureDomain::kDecal_Mode) |
472 , fColorAccess(color) | 484 , fColorAccess(color) |
473 , fXChannelSelector(xChannelSelector) | 485 , fXChannelSelector(xChannelSelector) |
474 , fYChannelSelector(yChannelSelector) | 486 , fYChannelSelector(yChannelSelector) |
475 , fScale(scale) { | 487 , fScale(scale) { |
476 this->initClassID<GrDisplacementMapEffect>(); | 488 this->initClassID<GrDisplacementMapEffect>(); |
477 this->addCoordTransform(&fDisplacementTransform); | 489 this->addCoordTransform(&fDisplacementTransform); |
478 this->addTextureAccess(&fDisplacementAccess); | 490 this->addTextureAccess(&fDisplacementAccess); |
479 this->addCoordTransform(&fColorTransform); | 491 this->addCoordTransform(&fColorTransform); |
480 this->addTextureAccess(&fColorAccess); | 492 this->addTextureAccess(&fColorAccess); |
481 } | 493 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
513 GrProcessorUnitTest::kAlphaTextureIdx
; | 525 GrProcessorUnitTest::kAlphaTextureIdx
; |
514 static const int kMaxComponent = 4; | 526 static const int kMaxComponent = 4; |
515 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector = | 527 SkDisplacementMapEffect::ChannelSelectorType xChannelSelector = |
516 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( | 528 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( |
517 random->nextRangeU(1, kMaxComponent)); | 529 random->nextRangeU(1, kMaxComponent)); |
518 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector = | 530 SkDisplacementMapEffect::ChannelSelectorType yChannelSelector = |
519 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( | 531 static_cast<SkDisplacementMapEffect::ChannelSelectorType>( |
520 random->nextRangeU(1, kMaxComponent)); | 532 random->nextRangeU(1, kMaxComponent)); |
521 SkVector scale = SkVector::Make(random->nextRangeScalar(0, 100.0f), | 533 SkVector scale = SkVector::Make(random->nextRangeScalar(0, 100.0f), |
522 random->nextRangeScalar(0, 100.0f)); | 534 random->nextRangeScalar(0, 100.0f)); |
523 | 535 SkISize colorDimensions; |
| 536 colorDimensions.fWidth = random->nextRangeU(0, textures[texIdxColor]->width(
)); |
| 537 colorDimensions.fHeight = random->nextRangeU(0, textures[texIdxColor]->heigh
t()); |
524 return GrDisplacementMapEffect::Create(xChannelSelector, yChannelSelector, s
cale, | 538 return GrDisplacementMapEffect::Create(xChannelSelector, yChannelSelector, s
cale, |
525 textures[texIdxDispl], SkMatrix::I(), | 539 textures[texIdxDispl], SkMatrix::I(), |
526 textures[texIdxColor]); | 540 textures[texIdxColor], colorDimension
s); |
527 } | 541 } |
528 | 542 |
529 /////////////////////////////////////////////////////////////////////////////// | 543 /////////////////////////////////////////////////////////////////////////////// |
530 | 544 |
531 GrGLDisplacementMapEffect::GrGLDisplacementMapEffect(const GrProcessor& proc) | 545 GrGLDisplacementMapEffect::GrGLDisplacementMapEffect(const GrProcessor& proc) |
532 : fXChannelSelector(proc.cast<GrDisplacementMapEffect>().xChannelSelector()) | 546 : fXChannelSelector(proc.cast<GrDisplacementMapEffect>().xChannelSelector()) |
533 , fYChannelSelector(proc.cast<GrDisplacementMapEffect>().yChannelSelector())
{ | 547 , fYChannelSelector(proc.cast<GrDisplacementMapEffect>().yChannelSelector())
{ |
534 } | 548 } |
535 | 549 |
536 GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() { | 550 GrGLDisplacementMapEffect::~GrGLDisplacementMapEffect() { |
537 } | 551 } |
538 | 552 |
539 void GrGLDisplacementMapEffect::emitCode(GrGLFPBuilder* builder, | 553 void GrGLDisplacementMapEffect::emitCode(GrGLFPBuilder* builder, |
540 const GrFragmentProcessor&, | 554 const GrFragmentProcessor& fp, |
541 const char* outputColor, | 555 const char* outputColor, |
542 const char* inputColor, | 556 const char* inputColor, |
543 const TransformedCoordsArray& coords, | 557 const TransformedCoordsArray& coords, |
544 const TextureSamplerArray& samplers) { | 558 const TextureSamplerArray& samplers) { |
| 559 const GrTextureDomain& domain = fp.cast<GrDisplacementMapEffect>().domain(); |
545 sk_ignore_unused_variable(inputColor); | 560 sk_ignore_unused_variable(inputColor); |
546 | 561 |
547 fScaleUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, | 562 fScaleUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visibility, |
548 kVec2f_GrSLType, kDefault_GrSLPrecision, "Sc
ale"); | 563 kVec2f_GrSLType, kDefault_GrSLPrecision, "Sc
ale"); |
549 const char* scaleUni = builder->getUniformCStr(fScaleUni); | 564 const char* scaleUni = builder->getUniformCStr(fScaleUni); |
550 const char* dColor = "dColor"; | 565 const char* dColor = "dColor"; |
551 const char* cCoords = "cCoords"; | 566 const char* cCoords = "cCoords"; |
552 const char* outOfBounds = "outOfBounds"; | |
553 const char* nearZero = "1e-6"; // Since 6.10352e−5 is the smallest half floa
t, use | 567 const char* nearZero = "1e-6"; // Since 6.10352e−5 is the smallest half floa
t, use |
554 // a number smaller than that to approximate
0, but | 568 // a number smaller than that to approximate
0, but |
555 // leave room for 32-bit float GPU rounding e
rrors. | 569 // leave room for 32-bit float GPU rounding e
rrors. |
556 | 570 |
557 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 571 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
558 fsBuilder->codeAppendf("\t\tvec4 %s = ", dColor); | 572 fsBuilder->codeAppendf("\t\tvec4 %s = ", dColor); |
559 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0].get
Type()); | 573 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coords[0].get
Type()); |
560 fsBuilder->codeAppend(";\n"); | 574 fsBuilder->codeAppend(";\n"); |
561 | 575 |
562 // Unpremultiply the displacement | 576 // Unpremultiply the displacement |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 break; | 610 break; |
597 case SkDisplacementMapEffect::kA_ChannelSelectorType: | 611 case SkDisplacementMapEffect::kA_ChannelSelectorType: |
598 fsBuilder->codeAppend("a"); | 612 fsBuilder->codeAppend("a"); |
599 break; | 613 break; |
600 case SkDisplacementMapEffect::kUnknown_ChannelSelectorType: | 614 case SkDisplacementMapEffect::kUnknown_ChannelSelectorType: |
601 default: | 615 default: |
602 SkDEBUGFAIL("Unknown Y channel selector"); | 616 SkDEBUGFAIL("Unknown Y channel selector"); |
603 } | 617 } |
604 fsBuilder->codeAppend("-vec2(0.5));\t\t"); | 618 fsBuilder->codeAppend("-vec2(0.5));\t\t"); |
605 | 619 |
606 // FIXME : This can be achieved with a "clamp to border" texture repeat mode
and | 620 fGLDomain.sampleTexture(fsBuilder, domain, outputColor, SkString(cCoords), s
amplers[1]); |
607 // a 0 border color instead of computing if cCoords is out of bounds
here. | |
608 fsBuilder->codeAppendf( | |
609 "bool %s = (%s.x < 0.0) || (%s.y < 0.0) || (%s.x > 1.0) || (%s.y > 1.0);
\t\t", | |
610 outOfBounds, cCoords, cCoords, cCoords, cCoords); | |
611 fsBuilder->codeAppendf("%s = %s ? vec4(0.0) : ", outputColor, outOfBounds); | |
612 | |
613 // cCoords is always a vec2f | |
614 fsBuilder->appendTextureLookup(samplers[1], cCoords, kVec2f_GrSLType); | |
615 fsBuilder->codeAppend(";\n"); | 621 fsBuilder->codeAppend(";\n"); |
616 } | 622 } |
617 | 623 |
618 void GrGLDisplacementMapEffect::setData(const GrGLProgramDataManager& pdman, | 624 void GrGLDisplacementMapEffect::setData(const GrGLProgramDataManager& pdman, |
619 const GrProcessor& proc) { | 625 const GrProcessor& proc) { |
620 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 626 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
621 GrTexture* colorTex = displacementMap.texture(1); | 627 GrTexture* colorTex = displacementMap.texture(1); |
622 SkScalar scaleX = SkScalarDiv(displacementMap.scale().fX, SkIntToScalar(colo
rTex->width())); | 628 SkScalar scaleX = SkScalarDiv(displacementMap.scale().fX, SkIntToScalar(colo
rTex->width())); |
623 SkScalar scaleY = SkScalarDiv(displacementMap.scale().fY, SkIntToScalar(colo
rTex->height())); | 629 SkScalar scaleY = SkScalarDiv(displacementMap.scale().fY, SkIntToScalar(colo
rTex->height())); |
624 pdman.set2f(fScaleUni, SkScalarToFloat(scaleX), | 630 pdman.set2f(fScaleUni, SkScalarToFloat(scaleX), |
625 colorTex->origin() == kTopLeft_GrSurfaceOrigin ? | 631 colorTex->origin() == kTopLeft_GrSurfaceOrigin ? |
626 SkScalarToFloat(scaleY) : SkScalarToFloat(-scaleY)); | 632 SkScalarToFloat(scaleY) : SkScalarToFloat(-scaleY)); |
| 633 fGLDomain.setData(pdman, displacementMap.domain(), colorTex->origin()); |
627 } | 634 } |
628 | 635 |
629 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 636 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
630 const GrGLCaps&, GrProcessorKeyBuilder* b
) { | 637 const GrGLCaps&, GrProcessorKeyBuilder* b
) { |
631 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 638 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
632 | 639 |
633 uint32_t xKey = displacementMap.xChannelSelector(); | 640 uint32_t xKey = displacementMap.xChannelSelector(); |
634 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 641 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
635 | 642 |
636 b->add32(xKey | yKey); | 643 b->add32(xKey | yKey); |
637 } | 644 } |
638 #endif | 645 #endif |
639 | 646 |
OLD | NEW |