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

Unified Diff: src/core/SkLightingShader.cpp

Issue 1870443002: Serialize invNormRotation in SkLightingShader. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase 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 | « include/core/SkPicture.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkLightingShader.cpp
diff --git a/src/core/SkLightingShader.cpp b/src/core/SkLightingShader.cpp
index eba7d652eb6d1448551599557b7a259319222c80..bc47af60eebaba6bffd3721e66c78d359188ee1d 100644
--- a/src/core/SkLightingShader.cpp
+++ b/src/core/SkLightingShader.cpp
@@ -606,7 +606,12 @@ sk_sp<SkFlattenable> SkLightingShaderImpl::CreateProc(SkReadBuffer& buf) {
SkAutoTUnref<const SkLightingShader::Lights> lights(builder.finish());
- return sk_make_sp<SkLightingShaderImpl>(diffuse, normal, lights, SkVector::Make(1.0f, 0.0f),
+ SkVector invNormRotation = {1,0};
+ if (!buf.isVersionLT(SkReadBuffer::kLightingShaderWritesInvNormRotation)) {
+ invNormRotation = buf.readPoint();
+ }
+
+ return sk_make_sp<SkLightingShaderImpl>(diffuse, normal, lights, invNormRotation,
&diffLocalM, &normLocalM);
}
@@ -634,6 +639,7 @@ void SkLightingShaderImpl::flatten(SkWriteBuffer& buf) const {
buf.writeScalarArray(&light.dir().fX, 3);
}
}
+ buf.writePoint(fInvNormRotation);
}
bool SkLightingShaderImpl::computeNormTotalInverse(const ContextRec& rec,
« no previous file with comments | « include/core/SkPicture.h ('k') | src/core/SkReadBuffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698