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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext, | 385 void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext, |
386 GrTexture* src, | 386 GrTexture* src, |
387 const SkMatrix& matrix, | 387 const SkMatrix& matrix, |
388 const GrClip& clip, | 388 const GrClip& clip, |
389 const SkRect& dstRect, | 389 const SkRect& dstRect, |
390 BoundaryMode boundaryMode, | 390 BoundaryMode boundaryMode, |
391 const SkIRect* srcBounds, | 391 const SkIRect* srcBounds, |
392 const SkIRect& bounds) const { | 392 const SkIRect& bounds) const { |
393 SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar
(bounds.y())); | 393 SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar
(bounds.y())); |
394 GrPaint paint; | 394 GrPaint paint; |
395 paint.setAllowSRGBInputs(drawContext->isGammaCorrect()); | 395 paint.setGammaCorrect(drawContext->isGammaCorrect()); |
396 sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(src, matrix, srcBo
unds, | 396 sk_sp<GrFragmentProcessor> fp(this->makeFragmentProcessor(src, matrix, srcBo
unds, |
397 boundaryMode)); | 397 boundaryMode)); |
398 paint.addColorFragmentProcessor(std::move(fp)); | 398 paint.addColorFragmentProcessor(std::move(fp)); |
399 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 399 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
400 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); | 400 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); |
401 } | 401 } |
402 | 402 |
403 sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU( | 403 sk_sp<SkSpecialImage> SkLightingImageFilterInternal::filterImageGPU( |
404 SkSpecialImage* source, | 404 SkSpecialImage* source, |
405 SkSpecialImage* input, | 405 SkSpecialImage* input, |
(...skipping 1768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 | 2174 |
2175 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2175 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2176 } | 2176 } |
2177 | 2177 |
2178 #endif | 2178 #endif |
2179 | 2179 |
2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2180 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2181 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2181 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2182 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2182 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2183 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2183 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |