aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar mtklein <mtklein@chromium.org>2014-12-01 06:56:38 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-01 06:56:38 -0800
commit88fd0fbcccea615f2d2cd61a121ac9e3185adfe4 (patch)
treef0b13b3d4de8d110ce75f9f03e6cc18fb9aef744
parentbb25e44593ff9c318d9fe1dbb5cf30bc2b89eb76 (diff)
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
-rw-r--r--include/core/SkPicture.h2
-rw-r--r--src/core/SkFlattenable.cpp2
-rw-r--r--src/core/SkImageFilter.cpp6
-rw-r--r--src/core/SkLocalMatrixShader.cpp3
-rw-r--r--src/core/SkPaint.cpp53
-rw-r--r--src/core/SkPicture.cpp35
-rw-r--r--src/core/SkPictureData.cpp12
-rw-r--r--src/core/SkReadBuffer.cpp13
-rw-r--r--src/core/SkReadBuffer.h4
-rw-r--r--src/core/SkShader.cpp9
-rw-r--r--src/effects/SkBitmapSource.cpp6
-rw-r--r--src/effects/SkDashPathEffect.cpp31
-rw-r--r--src/effects/gradients/SkGradientShader.cpp9
-rw-r--r--src/effects/gradients/SkGradientShaderPriv.h7
-rw-r--r--src/effects/gradients/SkTwoPointConicalGradient.cpp27
-rw-r--r--tools/skpinfo.cpp13
16 files changed, 35 insertions, 197 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h
index 07eca144b8..c63a201cd8 100644
--- a/include/core/SkPicture.h
+++ b/include/core/SkPicture.h
@@ -251,7 +251,7 @@ private:
// steps to generate new SKPs in (only accessible to Googlers): http://goo.gl/qATVcw
// Only SKPs within the min/current picture version range (inclusive) can be read.
- static const uint32_t MIN_PICTURE_VERSION = 19;
+ static const uint32_t MIN_PICTURE_VERSION = 35; // Produced by Chrome M39.
static const uint32_t CURRENT_PICTURE_VERSION = 37;
void createHeader(SkPictInfo* info) const;
diff --git a/src/core/SkFlattenable.cpp b/src/core/SkFlattenable.cpp
index b0c1697d2b..f8fdd4f00e 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 79f04b88ec..297565cd7e 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -100,11 +100,7 @@ bool SkImageFilter::Common::unflatten(SkReadBuffer& buffer, int expectedCount) {
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 a7d2c15b0c..62d5e36d89 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 d81784ace4..162988beeb 100644
--- a/src/core/SkPaint.cpp
+++ b/src/core/SkPaint.cpp
@@ -1799,11 +1799,10 @@ static uint32_t pack_4(unsigned a, unsigned b, unsigned c, unsigned d) {
#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 @@ static FlatFlags unpack_paint_flags(SkPaint* paint, uint32_t packed) {
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 @@ void SkPaint::unflatten(SkReadBuffer& buffer) {
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 @@ void SkPaint::unflatten(SkReadBuffer& buffer) {
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 3e006c1672..0d7773b520 100644
--- a/src/core/SkPicture.cpp
+++ b/src/core/SkPicture.cpp
@@ -356,22 +356,10 @@ bool SkPicture::InternalOnly_StreamIsSKP(SkStream* stream, SkPictInfo* pInfo) {
}
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 @@ bool SkPicture::InternalOnly_BufferIsSKP(SkReadBuffer* buffer, SkPictInfo* pInfo
}
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 2dff8eb1d7..2b2265403f 100644
--- a/src/core/SkPictureData.cpp
+++ b/src/core/SkPictureData.cpp
@@ -321,17 +321,7 @@ bool SkPictureData::parseStreamTag(SkStream* stream,
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 390b6b1372..58a4ac42db 100644
--- a/src/core/SkReadBuffer.cpp
+++ b/src/core/SkReadBuffer.cpp
@@ -265,17 +265,8 @@ bool SkReadBuffer::readBitmap(SkBitmap* bitmap) {
// 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 f87fb7514a..4b14117964 100644
--- a/src/core/SkReadBuffer.h
+++ b/src/core/SkReadBuffer.h
@@ -39,6 +39,7 @@ public:
virtual ~SkReadBuffer();
enum Version {
+ /*
kFilterLevelIsEnum_Version = 23,
kGradientFlippedFlag_Version = 24,
kDashWritesPhaseIntervals_Version = 25,
@@ -49,6 +50,7 @@ public:
kImageFilterUniqueID_Version = 31,
kRemoveAndroidPaintOpts_Version = 32,
kFlattenCreateProc_Version = 33,
+ */
kRemoveColorTableAlpha_Version = 36,
kDropShadowMode_Version = 37,
};
@@ -112,7 +114,7 @@ public:
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 df615bda5a..39e8ed35f5 100644
--- a/src/core/SkShader.cpp
+++ b/src/core/SkShader.cpp
@@ -273,15 +273,6 @@ bool SkColorShader::isOpaque() const {
#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 1d8078d59f..4da77a9e02 100644
--- a/src/effects/SkBitmapSource.cpp
+++ b/src/effects/SkBitmapSource.cpp
@@ -28,11 +28,7 @@ SkBitmapSource::SkBitmapSource(const SkBitmap& bitmap, const SkRect& srcRect, co
#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 412965e883..f31d883c8e 100644
--- a/src/effects/SkDashPathEffect.cpp
+++ b/src/effects/SkDashPathEffect.cpp
@@ -52,7 +52,7 @@ static void outset_for_stroke(SkRect* rect, const SkStrokeRec& rec) {
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 @@ SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer)
, 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 @@ SkDashPathEffect::SkDashPathEffect(SkReadBuffer& buffer)
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 a84c6fda25..d7b51440b3 100644
--- a/src/effects/gradients/SkGradientShader.cpp
+++ b/src/effects/gradients/SkGradientShader.cpp
@@ -209,11 +209,6 @@ static uint32_t unpack_flags(uint32_t packed) {
}
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 @@ void SkGradientShaderBase::FlipGradientColors(SkColor* colorDst, Rec* recDst,
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 2ec78e727d..ecc5e34fbe 100644
--- a/src/effects/gradients/SkGradientShaderPriv.h
+++ b/src/effects/gradients/SkGradientShaderPriv.h
@@ -102,7 +102,7 @@ public:
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 @@ protected:
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 bb3b9b3715..5410f6a9df 100644
--- a/src/effects/gradients/SkTwoPointConicalGradient.cpp
+++ b/src/effects/gradients/SkTwoPointConicalGradient.cpp
@@ -346,27 +346,14 @@ SkShader::GradientType SkTwoPointConicalGradient::asAGradient(
#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) {
diff --git a/tools/skpinfo.cpp b/tools/skpinfo.cpp
index 55229650f3..c7fd8c8708 100644
--- a/tools/skpinfo.cpp
+++ b/tools/skpinfo.cpp
@@ -59,8 +59,8 @@ int tool_main(int argc, char** argv) {
SkDebugf("Version: %d\n", info.fVersion);
}
if (FLAGS_cullRect && !FLAGS_quiet) {
- SkDebugf("Cull Rect: %f,%f,%f,%f\n",
- info.fCullRect.fLeft, info.fCullRect.fTop,
+ SkDebugf("Cull Rect: %f,%f,%f,%f\n",
+ info.fCullRect.fLeft, info.fCullRect.fTop,
info.fCullRect.fRight, info.fCullRect.fBottom);
}
if (FLAGS_flags && !FLAGS_quiet) {
@@ -106,15 +106,6 @@ int tool_main(int argc, char** argv) {
if (FLAGS_tags && !FLAGS_quiet) {
SkDebugf("SK_PICT_FACTORY_TAG %d\n", chunkSize);
}
- // Remove this code when v21 and below are no longer supported
-#ifndef DISABLE_V21_COMPATIBILITY_CODE
- if (info.fVersion < 22) {
- if (!FLAGS_quiet) {
- SkDebugf("Exiting early due to format limitations\n");
- }
- return kSuccess; // TODO: need to store size in bytes
- }
-#endif
break;
case SK_PICT_TYPEFACE_TAG:
if (FLAGS_tags && !FLAGS_quiet) {