From e037d12625b1dbb7952ae8a6553d6830e8b3ebbf Mon Sep 17 00:00:00 2001 From: Mike Klein Date: Thu, 9 Feb 2017 16:16:08 -0500 Subject: [PATCH] Roll minimum picture version up to 44. This is the version produced by Chrome M54. M56 is stable now. I am most interested in deleting SkBitmapSourceDeserializer, because it awkwardly calls from core into effects (SkImageSource). Change-Id: I58b8b990017ba43372ab3333a4ef8312e75abc61 Reviewed-on: https://skia-review.googlesource.com/8286 Reviewed-by: Mike Reed Commit-Queue: Mike Klein --- gn/utils.gni | 2 -- include/core/SkPicture.h | 11 +--------- src/core/SkFontDescriptor.cpp | 12 ----------- src/core/SkPicturePlayback.cpp | 20 ++---------------- src/ports/SkGlobalInitialization_default.cpp | 3 --- src/utils/SkBitmapSourceDeserializer.cpp | 31 ---------------------------- src/utils/SkBitmapSourceDeserializer.h | 21 ------------------- 7 files changed, 3 insertions(+), 97 deletions(-) delete mode 100644 src/utils/SkBitmapSourceDeserializer.cpp delete mode 100644 src/utils/SkBitmapSourceDeserializer.h diff --git a/gn/utils.gni b/gn/utils.gni index 8d860f5..9c69c54 100644 --- a/gn/utils.gni +++ b/gn/utils.gni @@ -29,8 +29,6 @@ skia_utils_sources = [ "$_src/utils/SkBase64.cpp", "$_src/utils/SkBase64.h", - "$_src/utils/SkBitmapSourceDeserializer.cpp", - "$_src/utils/SkBitmapSourceDeserializer.h", "$_src/utils/SkBitSet.h", "$_src/utils/SkBoundaryPatch.cpp", "$_src/utils/SkFrontBufferedStream.cpp", diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 8047858..2952595 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -201,18 +201,9 @@ private: // V51: more SkXfermode -> SkBlendMode // 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 MIN_PICTURE_VERSION = 44; // Produced by Chrome M54 static const uint32_t CURRENT_PICTURE_VERSION = 51; - static_assert(MIN_PICTURE_VERSION <= 41, - "Remove kFontFileName and related code from SkFontDescriptor.cpp."); - - static_assert(MIN_PICTURE_VERSION <= 42, - "Remove COMMENT API handlers from SkPicturePlayback.cpp"); - - static_assert(MIN_PICTURE_VERSION <= 43, - "Remove SkBitmapSourceDeserializer."); - static_assert(MIN_PICTURE_VERSION <= 45, "Remove decoding of old SkTypeface::Style from SkFontDescriptor.cpp."); diff --git a/src/core/SkFontDescriptor.cpp b/src/core/SkFontDescriptor.cpp index 73ea205..94fe23d 100644 --- a/src/core/SkFontDescriptor.cpp +++ b/src/core/SkFontDescriptor.cpp @@ -20,7 +20,6 @@ enum { // defines for names in its 'name' table. kFontAxes = 0xFC, kFontIndex = 0xFD, - kFontFileName = 0xFE, // Remove when MIN_PICTURE_VERSION > 41 kSentinel = 0xFF, }; @@ -34,14 +33,6 @@ static void read_string(SkStream* stream, SkString* string) { } } -// Remove when MIN_PICTURE_VERSION > 41 -static void skip_string(SkStream* stream) { - const uint32_t length = SkToU32(stream->readPackedUInt()); - if (length > 0) { - stream->skip(length); - } -} - static void write_string(SkWStream* stream, const SkString& string, uint32_t id) { if (!string.isEmpty()) { stream->writePackedUInt(id); @@ -94,9 +85,6 @@ bool SkFontDescriptor::Deserialize(SkStream* stream, SkFontDescriptor* result) { case kFontIndex: index = read_uint(stream); break; - case kFontFileName: // Remove when MIN_PICTURE_VERSION > 41 - skip_string(stream); - break; default: SkDEBUGFAIL("Unknown id used by a font descriptor"); return false; diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index be2e5db..d030987 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -134,8 +134,8 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader, reader->skip(size - 4); } break; case CLIP_PATH: { - const SkPath& path = fPictureData->getPath(reader); - uint32_t packed = reader->readInt(); + const SkPath& path = fPictureData->getPath(reader); + uint32_t packed = reader->readInt(); SkClipOp clipOp = ClipParams_unpackRegionOp(reader, packed); bool doAA = ClipParams_unpackDoAA(packed); size_t offsetToRestore = reader->readInt(); @@ -329,22 +329,6 @@ void SkPicturePlayback::handleOp(SkReadBuffer* reader, canvas->drawDRRect(outer, inner, *paint); } } break; - case BEGIN_COMMENT_GROUP: { - SkString tmp; - reader->readString(&tmp); - // deprecated (M44) - break; - } - case COMMENT: { - SkString tmp; - reader->readString(&tmp); - reader->readString(&tmp); - // deprecated (M44) - break; - } - case END_COMMENT_GROUP: - // deprecated (M44) - break; case DRAW_IMAGE: { const SkPaint* paint = fPictureData->getPaint(reader); const SkImage* image = fPictureData->getImage(reader); diff --git a/src/ports/SkGlobalInitialization_default.cpp b/src/ports/SkGlobalInitialization_default.cpp index dd6ef87..2096993 100644 --- a/src/ports/SkGlobalInitialization_default.cpp +++ b/src/ports/SkGlobalInitialization_default.cpp @@ -10,7 +10,6 @@ #include "SkAlphaThresholdFilter.h" #include "../../src/effects/SkArithmeticModePriv.h" #include "SkArcToPathEffect.h" -#include "SkBitmapSourceDeserializer.h" #include "SkBlurDrawLooper.h" #include "SkBlurImageFilter.h" #include "SkBlurMaskFilter.h" @@ -65,8 +64,6 @@ * will automatically be called before any of skia's effects are asked to be deserialized. */ void SkFlattenable::PrivateInitializer::InitEffects() { - SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapSourceDeserializer) - // MaskFilter SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmbossMaskFilter) SkBlurMaskFilter::InitializeFlattenables(); diff --git a/src/utils/SkBitmapSourceDeserializer.cpp b/src/utils/SkBitmapSourceDeserializer.cpp deleted file mode 100644 index 1f8cc1c..0000000 --- a/src/utils/SkBitmapSourceDeserializer.cpp +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "SkBitmapSourceDeserializer.h" - -#include "SkBitmap.h" -#include "SkFilterQuality.h" -#include "SkImage.h" -#include "SkImageSource.h" -#include "SkReadBuffer.h" - -sk_sp SkBitmapSourceDeserializer::CreateProc(SkReadBuffer& buffer) { - SkFilterQuality filterQuality; - if (buffer.isVersionLT(SkReadBuffer::kBitmapSourceFilterQuality_Version)) { - filterQuality = kHigh_SkFilterQuality; - } else { - filterQuality = (SkFilterQuality)buffer.readInt(); - } - SkRect src, dst; - buffer.readRect(&src); - buffer.readRect(&dst); - sk_sp image = buffer.readBitmapAsImage(); - if (image) { - return SkImageSource::Make(std::move(image), src, dst, filterQuality); - } - return nullptr; -} diff --git a/src/utils/SkBitmapSourceDeserializer.h b/src/utils/SkBitmapSourceDeserializer.h deleted file mode 100644 index e017599..0000000 --- a/src/utils/SkBitmapSourceDeserializer.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBitmapSourceDeserializer_DEFINED -#define SkBitmapSourceDeserializer_DEFINED - -#include "SkFlattenable.h" - -// A temporary utility class to support deserializing legacy SkBitmapSource as SkImageSource. -// Should be removed when SKP versions which may contain SkBitmapSource records are phased out. -class SkBitmapSourceDeserializer : public SkFlattenable { -public: - SK_DEFINE_FLATTENABLE_TYPE(SkImageFilter) - SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkBitmapSource) -}; - -#endif -- 2.7.4