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" |
11 #include "SkWriteBuffer.h" | 11 #include "SkWriteBuffer.h" |
12 #include "SkUnPreMultiply.h" | 12 #include "SkUnPreMultiply.h" |
13 #include "SkColorPriv.h" | 13 #include "SkColorPriv.h" |
14 #if SK_SUPPORT_GPU | 14 #if SK_SUPPORT_GPU |
15 #include "GrContext.h" | 15 #include "GrContext.h" |
16 #include "GrDrawContext.h" | 16 #include "GrDrawContext.h" |
17 #include "GrCoordTransform.h" | 17 #include "GrCoordTransform.h" |
18 #include "GrInvariantOutput.h" | 18 #include "GrInvariantOutput.h" |
| 19 #include "SkGr.h" |
19 #include "effects/GrTextureDomain.h" | 20 #include "effects/GrTextureDomain.h" |
20 #include "glsl/GrGLSLFragmentProcessor.h" | 21 #include "glsl/GrGLSLFragmentProcessor.h" |
21 #include "glsl/GrGLSLFragmentShaderBuilder.h" | 22 #include "glsl/GrGLSLFragmentShaderBuilder.h" |
22 #include "glsl/GrGLSLProgramDataManager.h" | 23 #include "glsl/GrGLSLProgramDataManager.h" |
23 #include "glsl/GrGLSLUniformHandler.h" | 24 #include "glsl/GrGLSLUniformHandler.h" |
24 #endif | 25 #endif |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 #define kChannelSelectorKeyBits 3; // Max value is 4, so 3 bits are required at
most | 29 #define kChannelSelectorKeyBits 3; // Max value is 4, so 3 bits are required at
most |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
458 -SkIntToScalar(colorBounds.y())); | 459 -SkIntToScalar(colorBounds.y())); |
459 | 460 |
460 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTa
rget())); | 461 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRenderTa
rget())); |
461 if (!drawContext) { | 462 if (!drawContext) { |
462 return false; | 463 return false; |
463 } | 464 } |
464 | 465 |
465 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(colorB
ounds)); | 466 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(colorB
ounds)); |
466 offset->fX = bounds.left(); | 467 offset->fX = bounds.left(); |
467 offset->fY = bounds.top(); | 468 offset->fY = bounds.top(); |
468 WrapTexture(dst, bounds.width(), bounds.height(), result); | 469 GrWrapTextureInBitmap(dst, bounds.width(), bounds.height(), false, result); |
469 return true; | 470 return true; |
470 } | 471 } |
471 | 472 |
472 /////////////////////////////////////////////////////////////////////////////// | 473 /////////////////////////////////////////////////////////////////////////////// |
473 | 474 |
474 GrDisplacementMapEffect::GrDisplacementMapEffect( | 475 GrDisplacementMapEffect::GrDisplacementMapEffect( |
475 SkDisplacementMapEffect::ChannelSelectorType xChann
elSelector, | 476 SkDisplacementMapEffect::ChannelSelectorType xChann
elSelector, |
476 SkDisplacementMapEffect::ChannelSelectorType yChann
elSelector, | 477 SkDisplacementMapEffect::ChannelSelectorType yChann
elSelector, |
477 const SkVector& scale, | 478 const SkVector& scale, |
478 GrTexture* displacement, | 479 GrTexture* displacement, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 641 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
641 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 642 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
642 | 643 |
643 uint32_t xKey = displacementMap.xChannelSelector(); | 644 uint32_t xKey = displacementMap.xChannelSelector(); |
644 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 645 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
645 | 646 |
646 b->add32(xKey | yKey); | 647 b->add32(xKey | yKey); |
647 } | 648 } |
648 #endif | 649 #endif |
649 | 650 |
OLD | NEW |