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 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 | 268 |
269 GrTextureAccess fDisplacementAccess; | 269 GrTextureAccess fDisplacementAccess; |
270 GrTextureAccess fColorAccess; | 270 GrTextureAccess fColorAccess; |
271 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; | 271 SkDisplacementMapEffect::ChannelSelectorType fXChannelSelector; |
272 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; | 272 SkDisplacementMapEffect::ChannelSelectorType fYChannelSelector; |
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,
const SkMatrix& ctm, |
279 SkIPoint* offset) { | 279 SkBitmap* result, SkIPoint* offset)
{ |
280 SkBitmap colorBM; | 280 SkBitmap colorBM; |
281 SkIPoint colorOffset = SkIPoint::Make(0, 0); | 281 SkIPoint colorOffset = SkIPoint::Make(0, 0); |
282 if (!SkImageFilterUtils::GetInputResultGPU(getColorInput(), proxy, src, &col
orBM, | 282 if (!SkImageFilterUtils::GetInputResultGPU(getColorInput(), proxy, src, ctm,
&colorBM, |
283 &colorOffset)) { | 283 &colorOffset)) { |
284 return false; | 284 return false; |
285 } | 285 } |
286 GrTexture* color = colorBM.getTexture(); | 286 GrTexture* color = colorBM.getTexture(); |
287 SkBitmap displacementBM; | 287 SkBitmap displacementBM; |
288 SkIPoint displacementOffset = SkIPoint::Make(0, 0); | 288 SkIPoint displacementOffset = SkIPoint::Make(0, 0); |
289 if (!SkImageFilterUtils::GetInputResultGPU(getDisplacementInput(), proxy, sr
c, &displacementBM, | 289 if (!SkImageFilterUtils::GetInputResultGPU(getDisplacementInput(), proxy, sr
c, ctm, |
290 &displacementOffset)) { | 290 &displacementBM, &displacementOff
set)) { |
291 return false; | 291 return false; |
292 } | 292 } |
293 GrTexture* displacement = displacementBM.getTexture(); | 293 GrTexture* displacement = displacementBM.getTexture(); |
294 GrContext* context = color->getContext(); | 294 GrContext* context = color->getContext(); |
295 | 295 |
296 GrTextureDesc desc; | 296 GrTextureDesc desc; |
297 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; | 297 desc.fFlags = kRenderTarget_GrTextureFlagBit | kNoStencil_GrTextureFlagBit; |
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; |
(...skipping 231 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 |