| Index: src/effects/SkLightingImageFilter.cpp
|
| diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
|
| index a22bc6f8e923a34c69799fcbd1d87a9fe57cba83..97449f02a6d12fea8392d16d34fffe9eca455bb6 100644
|
| --- a/src/effects/SkLightingImageFilter.cpp
|
| +++ b/src/effects/SkLightingImageFilter.cpp
|
| @@ -264,7 +264,10 @@ public:
|
| SkScalar kd, SkImageFilter* input);
|
| SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiffuseLightingImageFilter)
|
|
|
| - virtual bool asNewEffect(GrEffectRef** effect, GrTexture*) const SK_OVERRIDE;
|
| +#if SK_SUPPORT_GPU
|
| + virtual bool canFilterImageGPU() const { return true; }
|
| + virtual GrEffectRef* asNewEffect(GrTexture*) const SK_OVERRIDE;
|
| +#endif
|
| SkScalar kd() const { return fKD; }
|
|
|
| protected:
|
| @@ -284,7 +287,11 @@ public:
|
| SkSpecularLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, SkImageFilter* input);
|
| SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSpecularLightingImageFilter)
|
|
|
| - virtual bool asNewEffect(GrEffectRef** effect, GrTexture*) const SK_OVERRIDE;
|
| +#if SK_SUPPORT_GPU
|
| + virtual bool canFilterImageGPU() const { return true; }
|
| + virtual GrEffectRef* asNewEffect(GrTexture*) const SK_OVERRIDE;
|
| +#endif
|
| +
|
| SkScalar ks() const { return fKS; }
|
| SkScalar shininess() const { return fShininess; }
|
|
|
| @@ -859,19 +866,12 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy*,
|
| return true;
|
| }
|
|
|
| -bool SkDiffuseLightingImageFilter::asNewEffect(GrEffectRef** effect,
|
| - GrTexture* texture) const {
|
| #if SK_SUPPORT_GPU
|
| - if (effect) {
|
| - SkScalar scale = SkScalarMul(surfaceScale(), SkIntToScalar(255));
|
| - *effect = GrDiffuseLightingEffect::Create(texture, light(), scale, kd());
|
| - }
|
| - return true;
|
| -#else
|
| - SkDEBUGFAIL("Should not call in GPU-less build");
|
| - return false;
|
| -#endif
|
| +GrEffectRef* SkDiffuseLightingImageFilter::asNewEffect(GrTexture* texture) const {
|
| + SkScalar scale = SkScalarMul(surfaceScale(), SkIntToScalar(255));
|
| + return GrDiffuseLightingEffect::Create(texture, light(), scale, kd());
|
| }
|
| +#endif
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
| @@ -928,19 +928,12 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy*,
|
| return true;
|
| }
|
|
|
| -bool SkSpecularLightingImageFilter::asNewEffect(GrEffectRef** effect,
|
| - GrTexture* texture) const {
|
| #if SK_SUPPORT_GPU
|
| - if (effect) {
|
| - SkScalar scale = SkScalarMul(surfaceScale(), SkIntToScalar(255));
|
| - *effect = GrSpecularLightingEffect::Create(texture, light(), scale, ks(), shininess());
|
| - }
|
| - return true;
|
| -#else
|
| - SkDEBUGFAIL("Should not call in GPU-less build");
|
| - return false;
|
| -#endif
|
| +GrEffectRef* SkSpecularLightingImageFilter::asNewEffect(GrTexture* texture) const {
|
| + SkScalar scale = SkScalarMul(surfaceScale(), SkIntToScalar(255));
|
| + return GrSpecularLightingEffect::Create(texture, light(), scale, ks(), shininess());
|
| }
|
| +#endif
|
|
|
| ///////////////////////////////////////////////////////////////////////////////
|
|
|
|
|