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

Unified Diff: src/effects/SkLightingImageFilter.cpp

Issue 768183002: Revert of Remove SK_SUPPORT_LEGACY_DEEPFLATTENING. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | « src/effects/SkLerpXfermode.cpp ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « src/effects/SkLerpXfermode.cpp ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698