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 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 scale, | 328 scale, |
329 displTexture.get(), | 329 displTexture.get(), |
330 offsetMatrix, | 330 offsetMatrix, |
331 colorTexture.get(), | 331 colorTexture.get(), |
332 SkISize::Make(color->width(), | 332 SkISize::Make(color->width(), |
333 color->height())))->un
ref(); | 333 color->height())))->un
ref(); |
334 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 334 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
335 SkMatrix matrix; | 335 SkMatrix matrix; |
336 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo
rBounds.y())); | 336 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo
rBounds.y())); |
337 | 337 |
338 sk_sp<GrDrawContext> drawContext(context->newDrawContext(GrContext::kLoo
se_BackingFit, | 338 sk_sp<GrDrawContext> drawContext(context->newDrawContext(SkBackingFit::k
Approx, |
339 bounds.width(),
bounds.height(), | 339 bounds.width(),
bounds.height(), |
340 kSkia8888_GrPix
elConfig)); | 340 kSkia8888_GrPix
elConfig)); |
341 if (!drawContext) { | 341 if (!drawContext) { |
342 return nullptr; | 342 return nullptr; |
343 } | 343 } |
344 | 344 |
345 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(co
lorBounds)); | 345 drawContext->drawRect(GrClip::WideOpen(), paint, matrix, SkRect::Make(co
lorBounds)); |
346 | 346 |
347 offset->fX = bounds.left(); | 347 offset->fX = bounds.left(); |
348 offset->fY = bounds.top(); | 348 offset->fY = bounds.top(); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 617 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
618 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 618 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
619 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 619 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
620 | 620 |
621 uint32_t xKey = displacementMap.xChannelSelector(); | 621 uint32_t xKey = displacementMap.xChannelSelector(); |
622 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 622 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
623 | 623 |
624 b->add32(xKey | yKey); | 624 b->add32(xKey | yKey); |
625 } | 625 } |
626 #endif | 626 #endif |
OLD | NEW |