| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 The Android Open Source Project | 2 * Copyright 2012 The Android Open Source Project |
| 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 "SkLightingImageFilter.h" | 8 #include "SkLightingImageFilter.h" |
| 9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext, | 383 void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext, |
| 384 GrTexture* src, | 384 GrTexture* src, |
| 385 const SkMatrix& matrix, | 385 const SkMatrix& matrix, |
| 386 const GrClip& clip, | 386 const GrClip& clip, |
| 387 const SkRect& dstRect, | 387 const SkRect& dstRect, |
| 388 BoundaryMode boundaryMode, | 388 BoundaryMode boundaryMode, |
| 389 const SkIRect* srcBounds, | 389 const SkIRect* srcBounds, |
| 390 const SkIRect& bounds) const { | 390 const SkIRect& bounds) const { |
| 391 SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar
(bounds.y())); | 391 SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar
(bounds.y())); |
| 392 GrPaint paint; | 392 GrPaint paint; |
| 393 // SRGBTODO: AllowSRGBInputs? | 393 paint.setAllowSRGBInputs(drawContext->isGammaCorrect()); |
| 394 sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(src, matrix, srcBo
unds, | 394 sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(src, matrix, srcBo
unds, |
| 395 boundaryMode)); | 395 boundaryMode)); |
| 396 paint.addColorFragmentProcessor(std::move(fp)); | 396 paint.addColorFragmentProcessor(std::move(fp)); |
| 397 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 397 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
| 398 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); | 398 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); |
| 399 } | 399 } |
| 400 | 400 |
| 401 sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(SkSpecialIma
ge* source, | 401 sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU(SkSpecialIma
ge* source, |
| 402 SkSpecialIma
ge* input, | 402 SkSpecialIma
ge* input, |
| 403 const SkIRec
t& offsetBounds, | 403 const SkIRec
t& offsetBounds, |
| (...skipping 1767 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2171 | 2171 |
| 2172 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2172 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
| 2173 } | 2173 } |
| 2174 | 2174 |
| 2175 #endif | 2175 #endif |
| 2176 | 2176 |
| 2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
| 2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
| 2179 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2179 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
| 2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
| OLD | NEW |