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