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

Unified Diff: include/effects/SkLightingImageFilter.h

Issue 1869763002: Update LightingImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Address code review comments Created 4 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
« no previous file with comments | « gm/lighting.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « gm/lighting.cpp ('k') | samplecode/SampleFilterFuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698