Bump min picture version.
Chrome Stable is M39, which produces picture format v35:
https://chromium.googlesource.com/skia/+/chrome/m39/include/core/SkPicture.h
We don't need any code to deal with pictures older than v35.
(When M40 goes stable, we can step up to v37, the current latest version.)
BUG=skia:
Review URL: https://codereview.chromium.org/770703002
diff --git a/src/core/SkFlattenable.cpp b/src/core/SkFlattenable.cpp
index b0c1697..f8fdd4f 100644
--- a/src/core/SkFlattenable.cpp
+++ b/src/core/SkFlattenable.cpp
@@ -13,7 +13,7 @@
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
bool SkFlattenable::NeedsDeepUnflatten(const SkReadBuffer& buffer) {
- return buffer.isVersionLT(SkReadBuffer::kFlattenCreateProc_Version);
+ return false; // TODO: looks like all this can go away too now?
}
#endif
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 79f04b8..297565c 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -100,11 +100,7 @@
uint32_t flags = buffer.readUInt();
fCropRect = CropRect(rect, flags);
- if (buffer.isVersionLT(SkReadBuffer::kImageFilterUniqueID_Version)) {
- fUniqueID = next_image_filter_unique_id();
- } else {
- fUniqueID = buffer.readUInt();
- }
+ fUniqueID = buffer.readUInt();
return buffer.isValid();
}
diff --git a/src/core/SkLocalMatrixShader.cpp b/src/core/SkLocalMatrixShader.cpp
index a7d2c15..62d5e36 100644
--- a/src/core/SkLocalMatrixShader.cpp
+++ b/src/core/SkLocalMatrixShader.cpp
@@ -9,9 +9,6 @@
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkLocalMatrixShader::SkLocalMatrixShader(SkReadBuffer& buffer) : INHERITED(buffer) {
- if (buffer.isVersionLT(SkReadBuffer::kSimplifyLocalMatrix_Version)) {
- buffer.readMatrix(&(INHERITED::fLocalMatrix));
- }
fProxyShader.reset(buffer.readShader());
if (NULL == fProxyShader.get()) {
sk_throw();
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp
index d81784a..162988b 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1799,11 +1799,10 @@
#endif
enum FlatFlags {
- kHasTypeface_FlatFlag = 0x01,
- kHasEffects_FlatFlag = 0x02,
- kHasNonDefaultPaintOptionsAndroid_FlatFlag = 0x04,
+ kHasTypeface_FlatFlag = 0x1,
+ kHasEffects_FlatFlag = 0x2,
- kFlatFlagMask = 0x7,
+ kFlatFlagMask = 0x3,
};
enum BitsPerField {
@@ -1839,37 +1838,6 @@
return (FlatFlags)(packed & kFlatFlagMask);
}
-// V22_COMPATIBILITY_CODE
-static FlatFlags unpack_paint_flags_v22(SkPaint* paint, uint32_t packed) {
- enum {
- kFilterBitmap_Flag = 0x02,
- kHighQualityFilterBitmap_Flag = 0x4000,
-
- kAll_Flags = kFilterBitmap_Flag | kHighQualityFilterBitmap_Flag
- };
-
- // previously flags:16, textAlign:8, flatFlags:8
- // now flags:16, hinting:4, textAlign:4, flatFlags:8
- unsigned flags = packed >> 16;
- int filter = 0;
- if (flags & kFilterBitmap_Flag) {
- filter |= 1;
- }
- if (flags & kHighQualityFilterBitmap_Flag) {
- filter |= 2;
- }
- paint->setFilterLevel((SkPaint::FilterLevel)filter);
- flags &= ~kAll_Flags; // remove these (now dead) bit flags
-
- paint->setFlags(flags);
-
- // hinting added later. 0 in this nibble means use the default.
- uint32_t hinting = (packed >> 12) & 0xF;
- paint->setHinting(0 == hinting ? SkPaint::kNormal_Hinting : static_cast<SkPaint::Hinting>(hinting-1));
- paint->setTextAlign(static_cast<SkPaint::Align>((packed >> 8) & 0xF));
- return (FlatFlags)(packed & kFlatFlagMask);
-}
-
// The size of a flat paint's POD fields
static const uint32_t kPODPaintSize = 5 * sizeof(SkScalar) +
1 * sizeof(SkColor) +
@@ -1948,12 +1916,7 @@
this->setStrokeMiter(read_scalar(pod));
this->setColor(*pod++);
- unsigned flatFlags = 0;
- if (buffer.isVersionLT(SkReadBuffer::kFilterLevelIsEnum_Version)) {
- flatFlags = unpack_paint_flags_v22(this, *pod++);
- } else {
- flatFlags = unpack_paint_flags(this, *pod++);
- }
+ unsigned flatFlags = unpack_paint_flags(this, *pod++);
uint32_t tmp = *pod++;
this->setStrokeCap(static_cast<Cap>((tmp >> 24) & 0xFF));
@@ -1990,14 +1953,6 @@
this->setLooper(NULL);
this->setImageFilter(NULL);
}
-
- if (buffer.isVersionLT(SkReadBuffer::kRemoveAndroidPaintOpts_Version) &&
- flatFlags & kHasNonDefaultPaintOptionsAndroid_FlatFlag) {
- SkString tag;
- buffer.readUInt();
- buffer.readString(&tag);
- buffer.readBool();
- }
}
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkPicture.cpp b/src/core/SkPicture.cpp
index 3e006c1..0d7773b 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -356,22 +356,10 @@
}
info.fVersion = stream->readU32();
-
-#ifndef V35_COMPATIBILITY_CODE
- if (info.fVersion < 35) {
- info.fCullRect.fLeft = 0;
- info.fCullRect.fTop = 0;
- info.fCullRect.fRight = SkIntToScalar(stream->readU32());
- info.fCullRect.fBottom = SkIntToScalar(stream->readU32());
- } else {
-#endif
- info.fCullRect.fLeft = stream->readScalar();
- info.fCullRect.fTop = stream->readScalar();
- info.fCullRect.fRight = stream->readScalar();
- info.fCullRect.fBottom = stream->readScalar();
-#ifndef V35_COMPATIBILITY_CODE
- }
-#endif
+ info.fCullRect.fLeft = stream->readScalar();
+ info.fCullRect.fTop = stream->readScalar();
+ info.fCullRect.fRight = stream->readScalar();
+ info.fCullRect.fBottom = stream->readScalar();
info.fFlags = stream->readU32();
@@ -395,20 +383,7 @@
}
info.fVersion = buffer->readUInt();
-
-#ifndef V35_COMPATIBILITY_CODE
- if (info.fVersion < 35) {
- info.fCullRect.fLeft = 0;
- info.fCullRect.fTop = 0;
- info.fCullRect.fRight = SkIntToScalar(buffer->readUInt());
- info.fCullRect.fBottom = SkIntToScalar(buffer->readUInt());
- } else {
-#endif
- buffer->readRect(&info.fCullRect);
-#ifndef V35_COMPATIBILITY_CODE
- }
-#endif
-
+ buffer->readRect(&info.fCullRect);
info.fFlags = buffer->readUInt();
if (!IsValidPictInfo(info)) {
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp
index 2dff8eb..2b22654 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -321,17 +321,7 @@
break;
case SK_PICT_FACTORY_TAG: {
SkASSERT(!haveBuffer);
- // Remove this code when v21 and below are no longer supported. At the
- // same time add a new 'count' variable and use it rather then reusing 'size'.
-#ifndef DISABLE_V21_COMPATIBILITY_CODE
- if (fInfo.fVersion >= 22) {
- // in v22 this tag's size represents the size of the chunk in bytes
- // and the number of factory strings is written out separately
-#endif
- size = stream->readU32();
-#ifndef DISABLE_V21_COMPATIBILITY_CODE
- }
-#endif
+ size = stream->readU32();
fFactoryPlayback = SkNEW_ARGS(SkFactoryPlayback, (size));
for (size_t i = 0; i < size; i++) {
SkString str;
diff --git a/src/core/SkReadBuffer.cpp b/src/core/SkReadBuffer.cpp
index 390b6b1..58a4ac4 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -265,17 +265,8 @@
// larger deserialize.
bitmap->setInfo(SkImageInfo::MakeUnknown(width, height));
return true;
- } else {
- // A size of zero means the SkBitmap was simply flattened.
- if (this->isVersionLT(kNoMoreBitmapFlatten_Version)) {
- SkBitmap tmp;
- tmp.legacyUnflatten(*this);
- // just throw this guy away
- } else {
- if (SkBitmap::ReadRawPixels(this, bitmap)) {
- return true;
- }
- }
+ } else if (SkBitmap::ReadRawPixels(this, bitmap)) {
+ return true;
}
}
// Could not read the SkBitmap. Use a placeholder bitmap.
diff --git a/src/core/SkReadBuffer.h b/src/core/SkReadBuffer.h
index f87fb75..4b14117 100644
--- a/src/core/SkReadBuffer.h
+++ b/src/core/SkReadBuffer.h
@@ -39,6 +39,7 @@
virtual ~SkReadBuffer();
enum Version {
+ /*
kFilterLevelIsEnum_Version = 23,
kGradientFlippedFlag_Version = 24,
kDashWritesPhaseIntervals_Version = 25,
@@ -49,6 +50,7 @@
kImageFilterUniqueID_Version = 31,
kRemoveAndroidPaintOpts_Version = 32,
kFlattenCreateProc_Version = 33,
+ */
kRemoveColorTableAlpha_Version = 36,
kDropShadowMode_Version = 37,
};
@@ -112,7 +114,7 @@
virtual void readIRect(SkIRect* rect);
virtual void readRect(SkRect* rect);
virtual void readRegion(SkRegion* region);
-
+
virtual void readPath(SkPath* path);
void readPaint(SkPaint* paint) { paint->unflatten(*this); }
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp
index df615bd..39e8ed3 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -273,15 +273,6 @@
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkColorShader::SkColorShader(SkReadBuffer& b) : INHERITED(b) {
- // V25_COMPATIBILITY_CODE We had a boolean to make the color shader inherit the paint's
- // color. We don't support that any more.
- if (b.isVersionLT(SkReadBuffer::kColorShaderNoBool_Version)) {
- if (b.readBool()) {
- SkDEBUGFAIL("We shouldn't have pictures that recorded the inherited case.");
- fColor = SK_ColorWHITE;
- return;
- }
- }
fColor = b.readColor();
}
#endif
diff --git a/src/effects/SkBitmapSource.cpp b/src/effects/SkBitmapSource.cpp
index 1d8078d..4da77a9 100644
--- a/src/effects/SkBitmapSource.cpp
+++ b/src/effects/SkBitmapSource.cpp
@@ -28,11 +28,7 @@
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkBitmapSource::SkBitmapSource(SkReadBuffer& buffer) : INHERITED(0, buffer) {
- if (buffer.isVersionLT(SkReadBuffer::kNoMoreBitmapFlatten_Version)) {
- fBitmap.legacyUnflatten(buffer);
- } else {
- buffer.readBitmap(&fBitmap);
- }
+ buffer.readBitmap(&fBitmap);
buffer.readRect(&fSrcRect);
buffer.readRect(&fDstRect);
buffer.validate(buffer.isValid() && SkIsValidRect(fSrcRect) && SkIsValidRect(fDstRect));
diff --git a/src/effects/SkDashPathEffect.cpp b/src/effects/SkDashPathEffect.cpp
index 412965e..f31d883 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -52,7 +52,7 @@
rect->outset(radius, radius);
}
-// Attempt to trim the line to minimally cover the cull rect (currently
+// Attempt to trim the line to minimally cover the cull rect (currently
// only works for horizontal and vertical lines).
// Return true if processing should continue; false otherwise.
static bool cull_line(SkPoint* pts, const SkStrokeRec& rec,
@@ -377,16 +377,7 @@
, fInitialDashLength(0)
, fInitialDashIndex(0)
, fIntervalLength(0) {
- bool useOldPic = buffer.isVersionLT(SkReadBuffer::kDashWritesPhaseIntervals_Version);
- if (useOldPic) {
- fInitialDashIndex = buffer.readInt();
- fInitialDashLength = buffer.readScalar();
- fIntervalLength = buffer.readScalar();
- buffer.readBool(); // Dummy for old ScalarToFit field
- } else {
- fPhase = buffer.readScalar();
- }
-
+ fPhase = buffer.readScalar();
fCount = buffer.getArrayCount();
size_t allocSize = sizeof(SkScalar) * fCount;
if (buffer.validateAvailable(allocSize)) {
@@ -396,20 +387,10 @@
fIntervals = NULL;
}
- if (useOldPic) {
- fPhase = 0;
- if (fInitialDashLength != -1) { // Signal for bad dash interval
- for (int i = 0; i < fInitialDashIndex; ++i) {
- fPhase += fIntervals[i];
- }
- fPhase += fIntervals[fInitialDashIndex] - fInitialDashLength;
- }
- } else {
- // set the internal data members, fPhase should have been between 0 and intervalLength
- // when written to buffer so no need to adjust it
- SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount,
- &fInitialDashLength, &fInitialDashIndex, &fIntervalLength);
- }
+ // set the internal data members, fPhase should have been between 0 and intervalLength
+ // when written to buffer so no need to adjust it
+ SkDashPath::CalcDashParameters(fPhase, fIntervals, fCount,
+ &fInitialDashLength, &fInitialDashIndex, &fIntervalLength);
}
#endif
diff --git a/src/effects/gradients/SkGradientShader.cpp b/src/effects/gradients/SkGradientShader.cpp
index a84c6fd..d7b5144 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -209,11 +209,6 @@
}
SkGradientShaderBase::SkGradientShaderBase(SkReadBuffer& buffer) : INHERITED(buffer) {
- if (buffer.isVersionLT(SkReadBuffer::kNoUnitMappers_Version)) {
- // skip the old SkUnitMapper slot
- buffer.skipFlattenable();
- }
-
int colorCount = fColorCount = buffer.getArrayCount();
if (colorCount > kColorStorageCount) {
size_t allocSize = (sizeof(SkColor) + sizeof(SkScalar) + sizeof(Rec)) * colorCount;
@@ -318,10 +313,6 @@
memcpy(colorDst, colorsTemp.get(), count * sizeof(SkColor));
}
-void SkGradientShaderBase::flipGradientColors() {
- FlipGradientColors(fOrigColors, fRecs, fOrigColors, fRecs, fColorCount);
-}
-
bool SkGradientShaderBase::isOpaque() const {
return fColorsAreOpaque;
}
diff --git a/src/effects/gradients/SkGradientShaderPriv.h b/src/effects/gradients/SkGradientShaderPriv.h
index 2ec78e7..ecc5e34 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -102,7 +102,7 @@
class DescriptorScope : public Descriptor {
public:
DescriptorScope() {}
-
+
bool unflatten(SkReadBuffer&);
// fColors and fPos always point into local memory, so they can be safely mutated
@@ -250,11 +250,6 @@
SkColor* colorSrc, Rec* recSrc,
int count);
- // V23_COMPATIBILITY_CODE
- // Used for 2-pt conical gradients since we sort start/end cirlces by radius
- // Assumes space has already been allocated for fOrigColors
- void flipGradientColors();
-
private:
enum {
kColorStorageCount = 4, // more than this many colors, and we'll use sk_malloc for the space
diff --git a/src/effects/gradients/SkTwoPointConicalGradient.cpp b/src/effects/gradients/SkTwoPointConicalGradient.cpp
index bb3b9b3..5410f6a 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -346,27 +346,14 @@
#ifdef SK_SUPPORT_LEGACY_DEEPFLATTENING
SkTwoPointConicalGradient::SkTwoPointConicalGradient(
SkReadBuffer& buffer)
- : INHERITED(buffer),
- fCenter1(buffer.readPoint()),
- fCenter2(buffer.readPoint()),
- fRadius1(buffer.readScalar()),
- fRadius2(buffer.readScalar()) {
- if (buffer.isVersionLT(SkReadBuffer::kGradientFlippedFlag_Version)) {
- // V23_COMPATIBILITY_CODE
- // Sort gradient by radius size for old pictures
- if (fRadius2 < fRadius1) {
- SkTSwap(fCenter1, fCenter2);
- SkTSwap(fRadius1, fRadius2);
- this->flipGradientColors();
- fFlippedGrad = true;
- } else {
- fFlippedGrad = false;
- }
- } else {
- fFlippedGrad = buffer.readBool();
- }
+ : INHERITED(buffer)
+ , fCenter1(buffer.readPoint())
+ , fCenter2(buffer.readPoint())
+ , fRadius1(buffer.readScalar())
+ , fRadius2(buffer.readScalar())
+ , fFlippedGrad(buffer.readBool()) {
this->init();
-};
+}
#endif
SkFlattenable* SkTwoPointConicalGradient::CreateProc(SkReadBuffer& buffer) {