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 "SkFlattenableBuffers.h" | 9 #include "SkFlattenableBuffers.h" |
10 #include "SkUnPreMultiply.h" | 10 #include "SkUnPreMultiply.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 desc.fWidth = src.width(); | 298 desc.fWidth = src.width(); |
299 desc.fHeight = src.height(); | 299 desc.fHeight = src.height(); |
300 desc.fConfig = kSkia8888_GrPixelConfig; | 300 desc.fConfig = kSkia8888_GrPixelConfig; |
301 | 301 |
302 GrAutoScratchTexture ast(context, desc); | 302 GrAutoScratchTexture ast(context, desc); |
303 SkAutoTUnref<GrTexture> dst(ast.detach()); | 303 SkAutoTUnref<GrTexture> dst(ast.detach()); |
304 | 304 |
305 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); | 305 GrContext::AutoRenderTarget art(context, dst->asRenderTarget()); |
306 | 306 |
307 GrPaint paint; | 307 GrPaint paint; |
308 paint.colorStage(0)->setEffect( | 308 paint.addColorEffect( |
309 GrDisplacementMapEffect::Create(fXChannelSelector, | 309 GrDisplacementMapEffect::Create(fXChannelSelector, |
310 fYChannelSelector, | 310 fYChannelSelector, |
311 fScale, | 311 fScale, |
312 displacement, | 312 displacement, |
313 color))->unref(); | 313 color))->unref(); |
314 SkRect srcRect; | 314 SkRect srcRect; |
315 src.getBounds(&srcRect); | 315 src.getBounds(&srcRect); |
316 SkRect dstRect = srcRect; | 316 SkRect dstRect = srcRect; |
317 dstRect.offset(SkIntToScalar(colorOffset.fX), SkIntToScalar(colorOffset.fY))
; | 317 dstRect.offset(SkIntToScalar(colorOffset.fX), SkIntToScalar(colorOffset.fY))
; |
318 context->drawRectToRect(paint, srcRect, dstRect); | 318 context->drawRectToRect(paint, srcRect, dstRect); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 colorTex); | 532 colorTex); |
533 | 533 |
534 colorKey <<= GrGLEffectMatrix::kKeyBits; | 534 colorKey <<= GrGLEffectMatrix::kKeyBits; |
535 EffectKey xKey = displacementMap.xChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits); | 535 EffectKey xKey = displacementMap.xChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits); |
536 EffectKey yKey = displacementMap.yChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits + | 536 EffectKey yKey = displacementMap.yChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits + |
537 SkDisplacementMapEff
ect::kKeyBits); | 537 SkDisplacementMapEff
ect::kKeyBits); |
538 | 538 |
539 return xKey | yKey | displKey | colorKey; | 539 return xKey | yKey | displKey | colorKey; |
540 } | 540 } |
541 #endif | 541 #endif |
OLD | NEW |