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" |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 GrTexture* color = colorBM.getTexture(); | 422 GrTexture* color = colorBM.getTexture(); |
423 GrTexture* displacement = displacementBM.getTexture(); | 423 GrTexture* displacement = displacementBM.getTexture(); |
424 GrContext* context = color->getContext(); | 424 GrContext* context = color->getContext(); |
425 | 425 |
426 GrSurfaceDesc desc; | 426 GrSurfaceDesc desc; |
427 desc.fFlags = kRenderTarget_GrSurfaceFlag; | 427 desc.fFlags = kRenderTarget_GrSurfaceFlag; |
428 desc.fWidth = bounds.width(); | 428 desc.fWidth = bounds.width(); |
429 desc.fHeight = bounds.height(); | 429 desc.fHeight = bounds.height(); |
430 desc.fConfig = kSkia8888_GrPixelConfig; | 430 desc.fConfig = kSkia8888_GrPixelConfig; |
431 | 431 |
432 SkAutoTUnref<GrTexture> dst( | 432 SkAutoTUnref<GrTexture> dst(context->textureProvider()->refScratchTexture(de
sc, |
433 context->refScratchTexture(desc, GrContext::kApprox_ScratchTexMatch)); | 433 GrTextureProvider::kApprox_ScratchTexMatch)); |
434 | 434 |
435 if (!dst) { | 435 if (!dst) { |
436 return false; | 436 return false; |
437 } | 437 } |
438 | 438 |
439 SkVector scale = SkVector::Make(fScale, fScale); | 439 SkVector scale = SkVector::Make(fScale, fScale); |
440 ctx.ctm().mapVectors(&scale, 1); | 440 ctx.ctm().mapVectors(&scale, 1); |
441 | 441 |
442 GrPaint paint; | 442 GrPaint paint; |
443 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); | 443 SkMatrix offsetMatrix = GrCoordTransform::MakeDivByTextureWHMatrix(displacem
ent); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
637 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 637 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
638 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 638 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
639 | 639 |
640 uint32_t xKey = displacementMap.xChannelSelector(); | 640 uint32_t xKey = displacementMap.xChannelSelector(); |
641 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 641 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
642 | 642 |
643 b->add32(xKey | yKey); | 643 b->add32(xKey | yKey); |
644 } | 644 } |
645 #endif | 645 #endif |
646 | 646 |
OLD | NEW |