| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 SkScalar fScale; | 273 SkScalar fScale; |
| 274 | 274 |
| 275 typedef GrEffect INHERITED; | 275 typedef GrEffect INHERITED; |
| 276 }; | 276 }; |
| 277 | 277 |
| 278 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
SkBitmap* result) { | 278 bool SkDisplacementMapEffect::filterImageGPU(Proxy* proxy, const SkBitmap& src,
SkBitmap* result) { |
| 279 SkBitmap colorBM; | 279 SkBitmap colorBM; |
| 280 if (!SkImageFilterUtils::GetInputResultGPU(getColorInput(), proxy, src, &col
orBM)) { | 280 if (!SkImageFilterUtils::GetInputResultGPU(getColorInput(), proxy, src, &col
orBM)) { |
| 281 return false; | 281 return false; |
| 282 } | 282 } |
| 283 GrTexture* color = (GrTexture*) colorBM.getTexture(); | 283 GrTexture* color = colorBM.getTexture(); |
| 284 SkBitmap displacementBM; | 284 SkBitmap displacementBM; |
| 285 if (!SkImageFilterUtils::GetInputResultGPU(getDisplacementInput(), proxy, sr
c, &displacementBM)) { | 285 if (!SkImageFilterUtils::GetInputResultGPU(getDisplacementInput(), proxy, sr
c, &displacementBM)) { |
| 286 return false; | 286 return false; |
| 287 } | 287 } |
| 288 GrTexture* displacement = (GrTexture*) displacementBM.getTexture(); | 288 GrTexture* displacement = displacementBM.getTexture(); |
| 289 GrContext* context = color->getContext(); | 289 GrContext* context = color->getContext(); |
| 290 | 290 |
| 291 GrTextureDesc desc; | 291 GrTextureDesc desc; |
| 292 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 292 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
| 293 desc.fWidth = src.width(); | 293 desc.fWidth = src.width(); |
| 294 desc.fHeight = src.height(); | 294 desc.fHeight = src.height(); |
| 295 desc.fConfig = kSkia8888_GrPixelConfig; | 295 desc.fConfig = kSkia8888_GrPixelConfig; |
| 296 | 296 |
| 297 GrAutoScratchTexture ast(context, desc); | 297 GrAutoScratchTexture ast(context, desc); |
| 298 SkAutoTUnref<GrTexture> dst(ast.detach()); | 298 SkAutoTUnref<GrTexture> dst(ast.detach()); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 colorTex); | 525 colorTex); |
| 526 | 526 |
| 527 colorKey <<= GrGLEffectMatrix::kKeyBits; | 527 colorKey <<= GrGLEffectMatrix::kKeyBits; |
| 528 EffectKey xKey = displacementMap.xChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits); | 528 EffectKey xKey = displacementMap.xChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits); |
| 529 EffectKey yKey = displacementMap.yChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits + | 529 EffectKey yKey = displacementMap.yChannelSelector() << (2 * GrGLEffectMatrix
::kKeyBits + |
| 530 SkDisplacementMapEff
ect::kKeyBits); | 530 SkDisplacementMapEff
ect::kKeyBits); |
| 531 | 531 |
| 532 return xKey | yKey | displKey | colorKey; | 532 return xKey | yKey | displKey | colorKey; |
| 533 } | 533 } |
| 534 #endif | 534 #endif |
| OLD | NEW |