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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext, | 380 void SkLightingImageFilterInternal::drawRect(GrDrawContext* drawContext, |
381 GrTexture* src, | 381 GrTexture* src, |
382 const SkMatrix& matrix, | 382 const SkMatrix& matrix, |
383 const GrClip& clip, | 383 const GrClip& clip, |
384 const SkRect& dstRect, | 384 const SkRect& dstRect, |
385 BoundaryMode boundaryMode, | 385 BoundaryMode boundaryMode, |
386 const SkIRect* srcBounds, | 386 const SkIRect* srcBounds, |
387 const SkIRect& bounds) const { | 387 const SkIRect& bounds) const { |
388 SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar
(bounds.y())); | 388 SkRect srcRect = dstRect.makeOffset(SkIntToScalar(bounds.x()), SkIntToScalar
(bounds.y())); |
389 GrPaint paint; | 389 GrPaint paint; |
| 390 // SRGBTODO: AllowSRGBInputs? |
390 GrFragmentProcessor* fp = this->getFragmentProcessor(src, matrix, srcBounds,
boundaryMode); | 391 GrFragmentProcessor* fp = this->getFragmentProcessor(src, matrix, srcBounds,
boundaryMode); |
391 paint.addColorFragmentProcessor(fp)->unref(); | 392 paint.addColorFragmentProcessor(fp)->unref(); |
392 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); | 393 paint.setPorterDuffXPFactory(SkXfermode::kSrc_Mode); |
393 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); | 394 drawContext->fillRectToRect(clip, paint, SkMatrix::I(), dstRect, srcRect); |
394 } | 395 } |
395 | 396 |
396 bool SkLightingImageFilterInternal::filterImageGPUDeprecated(Proxy* proxy, | 397 bool SkLightingImageFilterInternal::filterImageGPUDeprecated(Proxy* proxy, |
397 const SkBitmap& src
, | 398 const SkBitmap& src
, |
398 const Context& ctx, | 399 const Context& ctx, |
399 SkBitmap* result, | 400 SkBitmap* result, |
(...skipping 1720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2120 | 2121 |
2121 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2122 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2122 } | 2123 } |
2123 | 2124 |
2124 #endif | 2125 #endif |
2125 | 2126 |
2126 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2127 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2127 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2128 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2128 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2129 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2129 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2130 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |