Index: src/effects/SkLightingImageFilter.cpp |
diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp |
index 740ad029699fc30c887b5452023f6ac91432a061..bf9877e044a2dc839bc9635a47c33dbddf33c83d 100644 |
--- a/src/effects/SkLightingImageFilter.cpp |
+++ b/src/effects/SkLightingImageFilter.cpp |
@@ -290,6 +290,9 @@ |
SkDiffuseLightingImageFilter(SkLight* light, SkScalar surfaceScale, |
SkScalar kd, SkImageFilter* input, const CropRect* cropRect, |
uint32_t uniqueID); |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+ explicit SkDiffuseLightingImageFilter(SkReadBuffer& buffer); |
+#endif |
virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE; |
@@ -319,6 +322,9 @@ |
SkSpecularLightingImageFilter(SkLight* light, SkScalar surfaceScale, SkScalar ks, |
SkScalar shininess, SkImageFilter* input, const CropRect*, |
uint32_t uniqueID); |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+ explicit SkSpecularLightingImageFilter(SkReadBuffer& buffer); |
+#endif |
virtual void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE; |
virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, |
SkBitmap* result, SkIPoint* offset) const SK_OVERRIDE; |
@@ -936,6 +942,15 @@ |
SkLightingImageFilter::~SkLightingImageFilter() {} |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+SkLightingImageFilter::SkLightingImageFilter(SkReadBuffer& buffer) |
+ : INHERITED(1, buffer) { |
+ fLight.reset(SkLight::UnflattenLight(buffer)); |
+ fSurfaceScale = buffer.readScalar(); |
+ buffer.validate(SkScalarIsFinite(fSurfaceScale)); |
+} |
+#endif |
+ |
void SkLightingImageFilter::flatten(SkWriteBuffer& buffer) const { |
this->INHERITED::flatten(buffer); |
fLight->flattenLight(buffer); |
@@ -965,6 +980,15 @@ |
fKD(kd) |
{ |
} |
+ |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+SkDiffuseLightingImageFilter::SkDiffuseLightingImageFilter(SkReadBuffer& buffer) |
+ : INHERITED(buffer) |
+{ |
+ fKD = buffer.readScalar(); |
+ buffer.validate(SkScalarIsFinite(fKD) && (fKD >= 0)); |
+} |
+#endif |
SkFlattenable* SkDiffuseLightingImageFilter::CreateProc(SkReadBuffer& buffer) { |
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |
@@ -1071,6 +1095,17 @@ |
fShininess(shininess) |
{ |
} |
+ |
+#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING |
+SkSpecularLightingImageFilter::SkSpecularLightingImageFilter(SkReadBuffer& buffer) |
+ : INHERITED(buffer) |
+{ |
+ fKS = buffer.readScalar(); |
+ fShininess = buffer.readScalar(); |
+ buffer.validate(SkScalarIsFinite(fKS) && (fKS >= 0) && |
+ SkScalarIsFinite(fShininess)); |
+} |
+#endif |
SkFlattenable* SkSpecularLightingImageFilter::CreateProc(SkReadBuffer& buffer) { |
SK_IMAGEFILTER_UNFLATTEN_COMMON(common, 1); |