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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 fYChannelSelector, | 329 fYChannelSelector, |
330 scale, | 330 scale, |
331 displTexture.get(), | 331 displTexture.get(), |
332 offsetMatrix, | 332 offsetMatrix, |
333 colorTexture.get(), | 333 colorTexture.get(), |
334 SkISize::Make(color->width(), color->h
eight()))); | 334 SkISize::Make(color->width(), color->h
eight()))); |
335 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 335 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
336 SkMatrix matrix; | 336 SkMatrix matrix; |
337 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo
rBounds.y())); | 337 matrix.setTranslate(-SkIntToScalar(colorBounds.x()), -SkIntToScalar(colo
rBounds.y())); |
338 | 338 |
| 339 SkColorSpace* colorSpace = ctx.outputProperties().colorSpace(); |
339 sk_sp<GrDrawContext> drawContext( | 340 sk_sp<GrDrawContext> drawContext( |
340 context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), boun
ds.height(), | 341 context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), boun
ds.height(), |
341 GrRenderableConfigForColorSpace(source->get
ColorSpace()), | 342 GrRenderableConfigForColorSpace(colorSpace)
, |
342 sk_ref_sp(source->getColorSpace()))); | 343 sk_ref_sp(colorSpace))); |
343 if (!drawContext) { | 344 if (!drawContext) { |
344 return nullptr; | 345 return nullptr; |
345 } | 346 } |
346 | 347 |
347 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBound
s)); | 348 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBound
s)); |
348 | 349 |
349 offset->fX = bounds.left(); | 350 offset->fX = bounds.left(); |
350 offset->fY = bounds.top(); | 351 offset->fY = bounds.top(); |
351 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound
s.height()), | 352 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound
s.height()), |
352 kNeedNewImageUniqueID_SpecialImage, | 353 kNeedNewImageUniqueID_SpecialImage, |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 621 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
621 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 622 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
622 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 623 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
623 | 624 |
624 uint32_t xKey = displacementMap.xChannelSelector(); | 625 uint32_t xKey = displacementMap.xChannelSelector(); |
625 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 626 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
626 | 627 |
627 b->add32(xKey | yKey); | 628 b->add32(xKey | yKey); |
628 } | 629 } |
629 #endif | 630 #endif |
OLD | NEW |