| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 SkColorSpace* colorSpace = ctx.outputProperties().colorSpace(); |
| 340 sk_sp<GrDrawContext> drawContext( | 340 sk_sp<GrDrawContext> drawContext( |
| 341 context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), boun
ds.height(), | 341 context->makeDrawContext(SkBackingFit::kApprox, bounds.width(), boun
ds.height(), |
| 342 GrRenderableConfigForColorSpace(colorSpace)
, | 342 GrRenderableConfigForColorSpace(colorSpace)
, |
| 343 sk_ref_sp(colorSpace))); | 343 sk_ref_sp(colorSpace))); |
| 344 if (!drawContext) { | 344 if (!drawContext) { |
| 345 return nullptr; | 345 return nullptr; |
| 346 } | 346 } |
| 347 paint.setGammaCorrect(drawContext->isGammaCorrect()); |
| 347 | 348 |
| 348 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBound
s)); | 349 drawContext->drawRect(GrNoClip(), paint, matrix, SkRect::Make(colorBound
s)); |
| 349 | 350 |
| 350 offset->fX = bounds.left(); | 351 offset->fX = bounds.left(); |
| 351 offset->fY = bounds.top(); | 352 offset->fY = bounds.top(); |
| 352 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound
s.height()), | 353 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(bounds.width(), bound
s.height()), |
| 353 kNeedNewImageUniqueID_SpecialImage, | 354 kNeedNewImageUniqueID_SpecialImage, |
| 354 drawContext->asTexture(), | 355 drawContext->asTexture(), |
| 355 sk_ref_sp(drawContext->getColorSpace(
))); | 356 sk_ref_sp(drawContext->getColorSpace(
))); |
| 356 } | 357 } |
| (...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, | 622 void GrGLDisplacementMapEffect::GenKey(const GrProcessor& proc, |
| 622 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { | 623 const GrGLSLCaps&, GrProcessorKeyBuilder*
b) { |
| 623 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); | 624 const GrDisplacementMapEffect& displacementMap = proc.cast<GrDisplacementMap
Effect>(); |
| 624 | 625 |
| 625 uint32_t xKey = displacementMap.xChannelSelector(); | 626 uint32_t xKey = displacementMap.xChannelSelector(); |
| 626 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; | 627 uint32_t yKey = displacementMap.yChannelSelector() << kChannelSelectorKeyBit
s; |
| 627 | 628 |
| 628 b->add32(xKey | yKey); | 629 b->add32(xKey | yKey); |
| 629 } | 630 } |
| 630 #endif | 631 #endif |
| OLD | NEW |