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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 GrTexture* src, | 347 GrTexture* src, |
348 const SkMatrix& matrix, | 348 const SkMatrix& matrix, |
349 const GrClip& clip, | 349 const GrClip& clip, |
350 const SkRect& dstRect, | 350 const SkRect& dstRect, |
351 BoundaryMode boundaryMode, | 351 BoundaryMode boundaryMode, |
352 const SkIRect& bounds) const { | 352 const SkIRect& bounds) const { |
353 SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar
(bounds.y())); | 353 SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar
(bounds.y())); |
354 GrPaint paint; | 354 GrPaint paint; |
355 GrFragmentProcessor* fp = this->getFragmentProcessor(src, matrix, bounds, bo
undaryMode); | 355 GrFragmentProcessor* fp = this->getFragmentProcessor(src, matrix, bounds, bo
undaryMode); |
356 paint.addColorFragmentProcessor(fp)->unref(); | 356 paint.addColorFragmentProcessor(fp)->unref(); |
| 357 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
357 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); | 358 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); |
358 } | 359 } |
359 | 360 |
360 bool SkLightingImageFilterInternal::filterImageGPU(Proxy* proxy, | 361 bool SkLightingImageFilterInternal::filterImageGPU(Proxy* proxy, |
361 const SkBitmap& src, | 362 const SkBitmap& src, |
362 const Context& ctx, | 363 const Context& ctx, |
363 SkBitmap* result, | 364 SkBitmap* result, |
364 SkIPoint* offset) const { | 365 SkIPoint* offset) const { |
365 SkBitmap input = src; | 366 SkBitmap input = src; |
366 SkIPoint srcOffset = SkIPoint::Make(0, 0); | 367 SkIPoint srcOffset = SkIPoint::Make(0, 0); |
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2028 | 2029 |
2029 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2030 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2030 } | 2031 } |
2031 | 2032 |
2032 #endif | 2033 #endif |
2033 | 2034 |
2034 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2035 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2035 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2036 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2036 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2037 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2037 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2038 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |