Index: include/effects/SkLightingImageFilter.h |
diff --git a/include/effects/SkLightingImageFilter.h b/include/effects/SkLightingImageFilter.h |
index fb356c52e43413a019d57ee7514b86713ae4a28d..3ba3348ca96aa3bd8d35c730a591f43325b41d3e 100644 |
--- a/include/effects/SkLightingImageFilter.h |
+++ b/include/effects/SkLightingImageFilter.h |
@@ -17,34 +17,76 @@ struct SkPoint3; |
class SK_API SkLightingImageFilter : public SkImageFilter { |
public: |
- static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction, |
+ static sk_sp<SkImageFilter> MakeDistantLitDiffuse(const SkPoint3& direction, |
SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
- SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
+ sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr); |
+ static sk_sp<SkImageFilter> MakePointLitDiffuse(const SkPoint3& location, |
+ SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
+ sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr); |
+ static sk_sp<SkImageFilter> MakeSpotLitDiffuse(const SkPoint3& location, |
+ const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
+ SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
+ sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr); |
+ static sk_sp<SkImageFilter> MakeDistantLitSpecular(const SkPoint3& direction, |
+ SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
+ SkScalar shininess, sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr); |
+ static sk_sp<SkImageFilter> MakePointLitSpecular(const SkPoint3& location, |
+ SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
+ SkScalar shininess, sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr); |
+ static sk_sp<SkImageFilter> MakeSpotLitSpecular(const SkPoint3& location, |
+ const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
+ SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
+ SkScalar shininess, sk_sp<SkImageFilter> input, const CropRect* cropRect = nullptr); |
+ |
+ SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
+ |
+#ifdef SK_SUPPORT_LEGACY_IMAGEFILTER_PTR |
+ static SkImageFilter* CreateDistantLitDiffuse(const SkPoint3& direction, |
+ SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
+ SkImageFilter* input = NULL, const CropRect* cropRect = NULL) { |
+ return MakeDistantLitDiffuse(direction, lightColor, surfaceScale, kd, |
+ sk_ref_sp<SkImageFilter>(input), cropRect).release(); |
+ } |
static SkImageFilter* CreatePointLitDiffuse(const SkPoint3& location, |
SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
- SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
+ SkImageFilter* input = NULL, const CropRect* cropRect = NULL) { |
+ return MakePointLitDiffuse(location, lightColor, surfaceScale, kd, |
+ sk_ref_sp<SkImageFilter>(input), cropRect).release(); |
+ } |
static SkImageFilter* CreateSpotLitDiffuse(const SkPoint3& location, |
const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
SkColor lightColor, SkScalar surfaceScale, SkScalar kd, |
- SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
+ SkImageFilter* input = NULL, const CropRect* cropRect = NULL) { |
+ return MakeSpotLitDiffuse(location, target, specularExponent, cutoffAngle, |
+ lightColor, surfaceScale, kd, |
+ sk_ref_sp<SkImageFilter>(input), cropRect).release(); |
+ } |
static SkImageFilter* CreateDistantLitSpecular(const SkPoint3& direction, |
SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
- SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
+ SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL) { |
+ return MakeDistantLitSpecular(direction, lightColor, surfaceScale, ks, shininess, |
+ sk_ref_sp<SkImageFilter>(input), cropRect).release(); |
+ } |
static SkImageFilter* CreatePointLitSpecular(const SkPoint3& location, |
SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
- SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
+ SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL) { |
+ return MakePointLitSpecular(location, lightColor, surfaceScale, ks, shininess, |
+ sk_ref_sp<SkImageFilter>(input), cropRect).release(); |
+ } |
static SkImageFilter* CreateSpotLitSpecular(const SkPoint3& location, |
const SkPoint3& target, SkScalar specularExponent, SkScalar cutoffAngle, |
SkColor lightColor, SkScalar surfaceScale, SkScalar ks, |
- SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL); |
- ~SkLightingImageFilter(); |
- |
- SK_DECLARE_FLATTENABLE_REGISTRAR_GROUP() |
+ SkScalar shininess, SkImageFilter* input = NULL, const CropRect* cropRect = NULL) { |
+ return MakeSpotLitSpecular(location, target, specularExponent, cutoffAngle, |
+ lightColor, surfaceScale, ks, shininess, |
+ sk_ref_sp<SkImageFilter>(input), cropRect).release(); |
+ } |
+#endif |
protected: |
- SkLightingImageFilter(SkImageFilterLight* light, |
+ SkLightingImageFilter(sk_sp<SkImageFilterLight> light, |
SkScalar surfaceScale, |
- SkImageFilter* input, |
+ sk_sp<SkImageFilter> input, |
const CropRect* cropRect); |
void flatten(SkWriteBuffer&) const override; |
const SkImageFilterLight* light() const { return fLight.get(); } |
@@ -52,9 +94,10 @@ protected: |
bool affectsTransparentBlack() const override { return true; } |
private: |
- typedef SkImageFilter INHERITED; |
- SkAutoTUnref<SkImageFilterLight> fLight; |
+ sk_sp<SkImageFilterLight> fLight; |
SkScalar fSurfaceScale; |
+ |
+ typedef SkImageFilter INHERITED; |
}; |
#endif |