Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(151)

Unified Diff: src/effects/SkLightingImageFilter.cpp

Issue 13602013: Allow single-pass filters (which use asNewEffect()) to participate in the image filter DAG. This w… (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Fix return value of SkImageFilter::asNewEffect(). Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/effects/SkLightingImageFilter.cpp
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp
index a22bc6f8e923a34c69799fcbd1d87a9fe57cba83..bb2927bbf402809970604e270ef53268645df5ec 100644
--- a/src/effects/SkLightingImageFilter.cpp
+++ b/src/effects/SkLightingImageFilter.cpp
@@ -264,7 +264,9 @@ public:
SkScalar kd, SkImageFilter* input);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiffuseLightingImageFilter)
+#if SK_SUPPORT_GPU
virtual bool asNewEffect(GrEffectRef** effect, GrTexture*) const SK_OVERRIDE;
+#endif
SkScalar kd() const { return fKD; }
protected:
@@ -284,7 +286,10 @@ public:
SkSpecularLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar ks, SkScalar shininess, SkImageFilter* input);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSpecularLightingImageFilter)
+#if SK_SUPPORT_GPU
virtual bool asNewEffect(GrEffectRef** effect, GrTexture*) const SK_OVERRIDE;
+#endif
+
SkScalar ks() const { return fKS; }
SkScalar shininess() const { return fShininess; }
@@ -859,19 +864,15 @@ bool SkDiffuseLightingImageFilter::onFilterImage(Proxy*,
return true;
}
-bool SkDiffuseLightingImageFilter::asNewEffect(GrEffectRef** effect,
- GrTexture* texture) const {
#if SK_SUPPORT_GPU
+bool SkDiffuseLightingImageFilter::asNewEffect(GrEffectRef** effect, GrTexture* texture) const {
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
}
+#endif
///////////////////////////////////////////////////////////////////////////////
@@ -928,19 +929,15 @@ bool SkSpecularLightingImageFilter::onFilterImage(Proxy*,
return true;
}
-bool SkSpecularLightingImageFilter::asNewEffect(GrEffectRef** effect,
- GrTexture* texture) const {
#if SK_SUPPORT_GPU
+bool SkSpecularLightingImageFilter::asNewEffect(GrEffectRef** effect, GrTexture* texture) const {
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
}
+#endif
///////////////////////////////////////////////////////////////////////////////

Powered by Google App Engine
This is Rietveld 408576698