diff options
author | Robert Phillips <robertphillips@google.com> | 2017-02-10 12:32:08 +0000 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-02-10 12:32:21 +0000 |
commit | 19c22e946dd9f18de82f7728db80934efe262847 (patch) | |
tree | c456f09aaf8dc3039dc12d6f838125fb7d4fbf60 | |
parent | b8b51e6b2f431c89907139bec52ed64b7ed303ed (diff) |
Revert "Roll minimum picture version up to 44."
This reverts commit e037d12625b1dbb7952ae8a6553d6830e8b3ebbf.
Reason for revert: Checking to see if this broke the Chrome DEPS roll
Original change's description:
> 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 <reed@google.com>
> Commit-Queue: Mike Klein <mtklein@chromium.org>
>
TBR=mtklein@chromium.org,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
Change-Id: I9202591c7945c9421f335e544bf12461e38acdc6
Reviewed-on: https://skia-review.googlesource.com/8305
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
-rw-r--r-- | gn/utils.gni | 2 | ||||
-rw-r--r-- | include/core/SkPicture.h | 11 | ||||
-rw-r--r-- | src/core/SkFontDescriptor.cpp | 12 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 20 | ||||
-rw-r--r-- | src/ports/SkGlobalInitialization_default.cpp | 3 | ||||
-rw-r--r-- | src/utils/SkBitmapSourceDeserializer.cpp | 31 | ||||
-rw-r--r-- | src/utils/SkBitmapSourceDeserializer.h | 21 |
7 files changed, 97 insertions, 3 deletions
diff --git a/gn/utils.gni b/gn/utils.gni index 9c69c54bab..8d860f5b00 100644 --- a/gn/utils.gni +++ b/gn/utils.gni @@ -29,6 +29,8 @@ 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 29525953e2..8047858b16 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -201,9 +201,18 @@ 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 = 44; // Produced by Chrome M54 + static const uint32_t MIN_PICTURE_VERSION = 35; // Produced by Chrome M39. 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 94fe23d446..73ea2058ce 100644 --- a/src/core/SkFontDescriptor.cpp +++ b/src/core/SkFontDescriptor.cpp @@ -20,6 +20,7 @@ enum { // defines for names in its 'name' table. kFontAxes = 0xFC, kFontIndex = 0xFD, + kFontFileName = 0xFE, // Remove when MIN_PICTURE_VERSION > 41 kSentinel = 0xFF, }; @@ -33,6 +34,14 @@ 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); @@ -85,6 +94,9 @@ 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 d0309879d5..be2e5dbe04 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,6 +329,22 @@ 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 2096993bd7..dd6ef873b3 100644 --- a/src/ports/SkGlobalInitialization_default.cpp +++ b/src/ports/SkGlobalInitialization_default.cpp @@ -10,6 +10,7 @@ #include "SkAlphaThresholdFilter.h" #include "../../src/effects/SkArithmeticModePriv.h" #include "SkArcToPathEffect.h" +#include "SkBitmapSourceDeserializer.h" #include "SkBlurDrawLooper.h" #include "SkBlurImageFilter.h" #include "SkBlurMaskFilter.h" @@ -64,6 +65,8 @@ * 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 new file mode 100644 index 0000000000..1f8cc1c7bd --- /dev/null +++ b/src/utils/SkBitmapSourceDeserializer.cpp @@ -0,0 +1,31 @@ +/* + * 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<SkFlattenable> 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<SkImage> 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 new file mode 100644 index 0000000000..e017599918 --- /dev/null +++ b/src/utils/SkBitmapSourceDeserializer.h @@ -0,0 +1,21 @@ +/* + * 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 |