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 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 scale, | 339 scale, |
340 displTexture.get(), | 340 displTexture.get(), |
341 offsetMatrix, | 341 offsetMatrix, |
342 colorTexture.get(), | 342 colorTexture.get(), |
343 SkISize::Make(color->width(), | 343 SkISize::Make(color->width(), |
344 color->height())))->un
ref(); | 344 color->height())))->un
ref(); |
345 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 345 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
346 SkMatrix matrix; | 346 SkMatrix matrix; |
347 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo
rBounds.y())); | 347 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo
rBounds.y())); |
348 | 348 |
349 SkAutoTUnref<GrDrawContext> drawContext(context->drawContext(dst->asRend
erTarget())); | 349 sk_sp<GrDrawContext> drawContext(context->drawContext(sk_ref_sp(dst->asR
enderTarget()))); |
350 if (!drawContext) { | 350 if (!drawContext) { |
351 return nullptr; | 351 return nullptr; |
352 } | 352 } |
353 | 353 |
354 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(co
lorBounds)); | 354 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(co
lorBounds)); |
355 | 355 |
356 offset->fX = bounds.left(); | 356 offset->fX = bounds.left(); |
357 offset->fY = bounds.top(); | 357 offset->fY = bounds.top(); |
358 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound
s.height()), | 358 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound
s.height()), |
359 kNeedNewImageUniqueID_SpecialImage, | 359 kNeedNewImageUniqueID_SpecialImage, |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 626 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
627 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 627 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
628 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 628 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
629 | 629 |
630 uint32_t xKey = displacementMap.xChannelSelector(); | 630 uint32_t xKey = displacementMap.xChannelSelector(); |
631 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 631 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
632 | 632 |
633 b->add32(xKey | yKey); | 633 b->add32(xKey | yKey); |
634 } | 634 } |
635 #endif | 635 #endif |
OLD | NEW |