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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 kInterior_BoundaryMode, pSrcBounds, offsetBounds); | 446 kInterior_BoundaryMode, pSrcBounds, offsetBounds); |
447 this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, right, k
Right_BoundaryMode, | 447 this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, right, k
Right_BoundaryMode, |
448 pSrcBounds, offsetBounds); | 448 pSrcBounds, offsetBounds); |
449 this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomLe
ft, | 449 this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomLe
ft, |
450 kBottomLeft_BoundaryMode, pSrcBounds, offsetBounds); | 450 kBottomLeft_BoundaryMode, pSrcBounds, offsetBounds); |
451 this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottom, | 451 this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottom, |
452 kBottom_BoundaryMode, pSrcBounds, offsetBounds); | 452 kBottom_BoundaryMode, pSrcBounds, offsetBounds); |
453 this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRi
ght, | 453 this->drawRect(drawContext.get(), inputTexture.get(), matrix, clip, bottomRi
ght, |
454 kBottomRight_BoundaryMode, pSrcBounds, offsetBounds); | 454 kBottomRight_BoundaryMode, pSrcBounds, offsetBounds); |
455 | 455 |
| 456 // TODO: Get the colorSpace from the drawContext (once it has one) |
456 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), off
setBounds.height()), | 457 return SkSpecialImage::MakeFromGpu(SkIRect::MakeWH(offsetBounds.width(), off
setBounds.height()), |
457 kNeedNewImageUniqueID_SpecialImage, | 458 kNeedNewImageUniqueID_SpecialImage, |
458 drawContext->asTexture()); | 459 drawContext->asTexture(), |
| 460 sk_ref_sp(source->getColorSpace())); |
459 } | 461 } |
460 #endif | 462 #endif |
461 | 463 |
462 class SkDiffuseLightingImageFilter : public SkLightingImageFilterInternal { | 464 class SkDiffuseLightingImageFilter : public SkLightingImageFilterInternal { |
463 public: | 465 public: |
464 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilterLight> light, | 466 static sk_sp<SkImageFilter> Make(sk_sp<SkImageFilterLight> light, |
465 SkScalar surfaceScale, | 467 SkScalar surfaceScale, |
466 SkScalar kd, | 468 SkScalar kd, |
467 sk_sp<SkImageFilter>, | 469 sk_sp<SkImageFilter>, |
468 const CropRect*); | 470 const CropRect*); |
(...skipping 1699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2168 | 2170 |
2169 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); | 2171 fragBuilder->codeAppendf("%s(%s)", fLightColorFunc.c_str(), surfaceToLight); |
2170 } | 2172 } |
2171 | 2173 |
2172 #endif | 2174 #endif |
2173 | 2175 |
2174 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) | 2176 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkLightingImageFilter) |
2175 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) | 2177 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkDiffuseLightingImageFilter) |
2176 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) | 2178 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkSpecularLightingImageFilter) |
2177 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END | 2179 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END |
OLD | NEW |