aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-12-28 16:30:52 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-29 02:52:00 +0000
commitf3504d430cec35330017aa2af3a51083801c7dd9 (patch)
tree077a8bc5dc1bc0b648fa98051b27b89703d7bf82
parent2a2dfcbb4267e1c7e4aac39e0d78bc41695a2259 (diff)
remove legacy support for old old picture versions
Bug: skia: Change-Id: Ieb97eabdb18e8c7bfa86e6a1fc6e0389cd096daa Reviewed-on: https://skia-review.googlesource.com/89860 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
-rw-r--r--include/core/SkPicture.h2
-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
5 files changed, 8 insertions, 36 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 5ca60ca82c..2949f0709d 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -162,7 +162,7 @@ private:
// V59: No more LocalSpace option on PictureImageFilter
// Only SKPs within the min/current picture version range (inclusive) can be read.
- static const uint32_t MIN_PICTURE_VERSION = 51; // Produced by Chrome ~M56.
+ static const uint32_t MIN_PICTURE_VERSION = 56; // august 2017
static const uint32_t CURRENT_PICTURE_VERSION = 59;
static bool IsValidPictInfo(const SkPictInfo& info);
diff --git a/src/core/SkReadBuffer.h b/src/core/SkReadBuffer.h
index 665f4080e3..69aaf02ab8 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);
}