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 | 9 |
10 #include "SkBitmap.h" | 10 #include "SkBitmap.h" |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 SkIntToScalar(colorOffset.fY - displOffset.fY)
); | 336 SkIntToScalar(colorOffset.fY - displOffset.fY)
); |
337 | 337 |
338 paint.addColorFragmentProcessor( | 338 paint.addColorFragmentProcessor( |
339 GrDisplacementMapEffect::Make(fXChannelSelector, | 339 GrDisplacementMapEffect::Make(fXChannelSelector, |
340 fYChannelSelector, | 340 fYChannelSelector, |
341 scale, | 341 scale, |
342 displTexture.get(), | 342 displTexture.get(), |
343 offsetMatrix, | 343 offsetMatrix, |
344 colorTexture.get(), | 344 colorTexture.get(), |
345 SkISize::Make(color->width(), color->h
eight()))); | 345 SkISize::Make(color->width(), color->h
eight()))); |
346 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 346 paint.setPorterDuffXPFactory(SkBlendMode::kSrc); |
347 SkMatrix matrix; | 347 SkMatrix matrix; |
348 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo
rBounds.y())); | 348 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo
rBounds.y())); |
349 | 349 |
350 SkColorSpace* colorSpace = ctx.outputProperties().colorSpace(); | 350 SkColorSpace* colorSpace = ctx.outputProperties().colorSpace(); |
351 sk_sp<GrDrawContext> drawContext( | 351 sk_sp<GrDrawContext> drawContext( |
352 context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), boun
ds.height(), | 352 context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), boun
ds.height(), |
353 GrRenderableConfigForColorSpace(colorSpace)
, | 353 GrRenderableConfigForColorSpace(colorSpace)
, |
354 sk_ref_sp(colorSpace))); | 354 sk_ref_sp(colorSpace))); |
355 if (!drawContext) { | 355 if (!drawContext) { |
356 return nullptr; | 356 return nullptr; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 632 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
633 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 633 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 634 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
635 | 635 |
636 uint32_t xKey = displacementMap.xChannelSelector(); | 636 uint32_t xKey = displacementMap.xChannelSelector(); |
637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 637 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
638 | 638 |
639 b->add32(xKey | yKey); | 639 b->add32(xKey | yKey); |
640 } | 640 } |
641 #endif | 641 #endif |
OLD | NEW |