Serialize invNormRotation in SkLightingShader.

This fixes a serialize-8888 / 8888 GM mismatch.

This requires a picture bump so we know not to bother trying to read the
invNormRotation vector from older .SKPs.   Any chance no one's ever made
one?

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1870443002

Just bumping the picture version.
TBR=reed@google.com

Review URL: https://codereview.chromium.org/1870443002
This commit is contained in:
mtklein 2016-04-08 12:19:50 -07:00 committed by Commit bot
parent 646125114b
commit 0576aa9c07
5 changed files with 10 additions and 63 deletions

View File

@ -206,10 +206,11 @@ private:
// V42: Added a bool to SkPictureShader serialization to indicate did-we-serialize-a-picture?
// V43: Added DRAW_IMAGE and DRAW_IMAGE_RECT opt codes to serialized data
// V44: Move annotations from paint to drawAnnotation
// V45: Add invNormRotation to SkLightingShader.
// Only SKPs within the min/current picture version range (inclusive) can be read.
static const uint32_t MIN_PICTURE_VERSION = 35; // Produced by Chrome M39.
static const uint32_t CURRENT_PICTURE_VERSION = 44;
static const uint32_t CURRENT_PICTURE_VERSION = 45;
static_assert(MIN_PICTURE_VERSION <= 41,
"Remove kFontFileName and related code from SkFontDescriptor.cpp.");

View File

@ -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,

View File

@ -61,6 +61,7 @@ public:
kPictureShaderHasPictureBool_Version = 42,
kHasDrawImageOpCodes_Version = 43,
kAnnotationsMovedToCanvas_Version = 44,
kLightingShaderWritesInvNormRotation = 45,
};
/**

View File

@ -133,10 +133,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -293,10 +289,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -550,10 +542,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -805,10 +793,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -1063,10 +1047,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -1314,10 +1294,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -1567,10 +1543,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -1816,10 +1788,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -2012,10 +1980,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -2301,10 +2265,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -2466,10 +2426,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -2634,10 +2590,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -2819,10 +2771,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -3003,10 +2951,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",
@ -3313,10 +3257,6 @@
"serialize-8888",
"gm",
"_",
"lightingshader",
"serialize-8888",
"gm",
"_",
"verylargebitmap",
"serialize-8888",
"gm",

View File

@ -167,7 +167,6 @@ def get_args(bot):
'fontmgr_bounds',
'fontmgr_match',
'fontmgr_iter',
'lightingshader',
'verylargebitmap', # Windows only.
'verylarge_picture_image']: # Windows only.
blacklist.extend(['serialize-8888', 'gm', '_', test])