aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/effects/SkLightingImageFilter.h
diff options
context:
space:
mode:
authorGravatar robertphillips <robertphillips@google.com>2016-04-08 16:28:09 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-08 16:28:09 -0700
commit12fa47d33f1e9eb69bb20d9daad2eccfc7288944 (patch)
tree3a691901d49bc1e7ce0a0200090052e9093addf4 /include/effects/SkLightingImageFilter.h
parent601e36a5c5858d1940a8c381f832e2867acbfb8e (diff)
Update LightingImageFilter to sk_sp
Diffstat (limited to 'include/effects/SkLightingImageFilter.h')
-rw-r--r--include/effects/SkLightingImageFilter.h71
1 files changed, 57 insertions, 14 deletions
diff --git a/include/effects/SkLightingImageFilter.h b/include/effects/SkLightingImageFilter.h
index fb356c52e4..3ba3348ca9 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