aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-01-03 13:17:18 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-03 20:03:59 +0000
commitc5166a9dcbf2eeb95cb8e2918271132aa34bf5cd (patch)
tree552bcec5b3d9d6a6889ed1787c5811e72c706212 /src
parent3c36ef6be93400368fee3ea2e0dca6cff4972bb0 (diff)
Revert "Revert "remove legacy support for old old picture versions""
This reverts commit 6f1151140f331c78d99ede3cac10462dc8b32cde. Chrome has been updated, so this should be able to land. Bug: skia: Change-Id: I5a66782a39fecfac00edeb66fbd03dae4df1712c Reviewed-on: https://skia-review.googlesource.com/90205 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/core/SkReadBuffer.h2
-rw-r--r--src/core/SkTextBlob.cpp11
-rw-r--r--src/effects/SkMergeImageFilter.cpp20
-rw-r--r--src/shaders/SkComposeShader.cpp9
4 files changed, 7 insertions, 35 deletions
diff --git a/src/core/SkReadBuffer.h b/src/core/SkReadBuffer.h
index 3c021582ed..f4e9f6a0d8 100644
--- a/src/core/SkReadBuffer.h
+++ b/src/core/SkReadBuffer.h
@@ -68,10 +68,10 @@ public:
kGradientShaderFloatColor_Version = 49,
kXfermodeToBlendMode_Version = 50,
kXfermodeToBlendMode2_Version = 51,
- */
kTextBlobImplicitRunCount_Version = 52,
kComposeShaderCanLerp_Version = 54,
kNoModesInMergeImageFilter_Verison = 55,
+ */
kTileModeInBlurImageFilter_Version = 56,
kTileInfoInSweepGradient_Version = 57,
k2PtConicalNoFlip_Version = 58,
diff --git a/src/core/SkTextBlob.cpp b/src/core/SkTextBlob.cpp
index 91ec79bcbf..6d89e6f135 100644
--- a/src/core/SkTextBlob.cpp
+++ b/src/core/SkTextBlob.cpp
@@ -790,20 +790,13 @@ void SkTextBlob::flatten(SkWriteBuffer& buffer) const {
}
sk_sp<SkTextBlob> SkTextBlob::MakeFromBuffer(SkReadBuffer& reader) {
- const int runCount = reader.isVersionLT(SkReadBuffer::kTextBlobImplicitRunCount_Version)
- ? reader.read32() : std::numeric_limits<int>::max();
- if (runCount < 0) {
- return nullptr;
- }
-
SkRect bounds;
reader.readRect(&bounds);
SkTextBlobBuilder blobBuilder;
- for (int i = 0; i < runCount; ++i) {
+ for (;;) {
int glyphCount = reader.read32();
- if (glyphCount == 0 &&
- !reader.isVersionLT(SkReadBuffer::kTextBlobImplicitRunCount_Version)) {
+ if (glyphCount == 0) {
// End-of-runs marker.
break;
}
diff --git a/src/effects/SkMergeImageFilter.cpp b/src/effects/SkMergeImageFilter.cpp
index 1d425ed04e..1da4d41a0a 100644
--- a/src/effects/SkMergeImageFilter.cpp
+++ b/src/effects/SkMergeImageFilter.cpp
@@ -111,26 +111,10 @@ sk_sp<SkImageFilter> SkMergeImageFilter::onMakeColorSpace(SkColorSpaceXformer* x
sk_sp<SkFlattenable> SkMergeImageFilter::CreateProc(SkReadBuffer& buffer) {
Common common;
- if (!common.unflatten(buffer, -1)) {
+ if (!common.unflatten(buffer, -1) || !buffer.isValid()) {
return nullptr;
}
-
- const int count = common.inputCount();
- if (buffer.isVersionLT(SkReadBuffer::kNoModesInMergeImageFilter_Verison)) {
- bool hasModes = buffer.readBool();
- if (hasModes) {
- // Older pictures may have stored blendmodes, but by inspection we think these were
- // all src-over, so we have removed support for storing these.
- SkAutoSTArray<4, uint8_t> modes8(count);
- if (!buffer.readByteArray(modes8.get(), count)) {
- return nullptr;
- }
- if (!buffer.isValid()) {
- return nullptr;
- }
- }
- }
- return Make(common.inputs(), count, &common.cropRect());
+ return Make(common.inputs(), common.inputCount(), &common.cropRect());
}
void SkMergeImageFilter::flatten(SkWriteBuffer& buffer) const {
diff --git a/src/shaders/SkComposeShader.cpp b/src/shaders/SkComposeShader.cpp
index 34e54863b7..2feae7788e 100644
--- a/src/shaders/SkComposeShader.cpp
+++ b/src/shaders/SkComposeShader.cpp
@@ -43,17 +43,12 @@ sk_sp<SkFlattenable> SkComposeShader::CreateProc(SkReadBuffer& buffer) {
sk_sp<SkShader> dst(buffer.readShader());
sk_sp<SkShader> src(buffer.readShader());
unsigned mode = buffer.read32();
-
- float lerp = 1;
- if (!buffer.isVersionLT(SkReadBuffer::kComposeShaderCanLerp_Version)) {
- lerp = buffer.readScalar();
- }
+ float lerp = buffer.readScalar();
// check for valid mode before we cast to the enum type
- if (mode > (unsigned)SkBlendMode::kLastMode) {
+ if (!buffer.validate(mode <= (unsigned)SkBlendMode::kLastMode)) {
return nullptr;
}
-
return MakeCompose(std::move(dst), std::move(src), static_cast<SkBlendMode>(mode), lerp);
}