diff options
author | 2017-12-16 08:41:28 -0500 | |
---|---|---|
committer | 2017-12-16 14:21:32 +0000 | |
commit | ef0384835757df463f5157145650a60ba8b14a63 (patch) | |
tree | d33ade7923e75b2166f891cf1cbbd2a2ef18c4b8 /include | |
parent | 594706566a62da1e00fa1bb678cc84c36464e811 (diff) |
remove deprecated SkPixelSerializer
Bug: skia:
Change-Id: I25d33517f1ec7c08551c79d03763c676d1a662f5
Reviewed-on: https://skia-review.googlesource.com/86360
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkImage.h | 22 | ||||
-rw-r--r-- | include/core/SkPicture.h | 15 | ||||
-rw-r--r-- | include/core/SkPixelSerializer.h | 51 | ||||
-rw-r--r-- | include/core/SkWriteBuffer.h | 6 |
4 files changed, 9 insertions, 85 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h index c0f8272c48..03d463d098 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -24,7 +24,6 @@ class SkCanvas; class SkImageGenerator; class SkPaint; class SkPicture; -class SkPixelSerializer; class SkString; class SkSurface; class GrBackendTexture; @@ -352,28 +351,21 @@ public: CachingHint cachingHint = kAllow_CachingHint) const; /** - * Encode the image's pixels and return the result as SkData. + * Encode the image's pixels and return the result as SkData. This will ignore any possible + * existing encoded data (see refEncodedData()), and will always attempt to encode the + * image using the specified encoded image format. * * If the image type cannot be encoded, or the requested encoder format is - * not supported, this will return NULL. + * not supported, this will return nullptr. */ sk_sp<SkData> encodeToData(SkEncodedImageFormat encodedImageFormat, int quality) const; /** * Encode the image and return the result as SkData. This will attempt to reuse existing - * encoded data (as returned by refEncodedData). - * - * We defer to the SkPixelSerializer both for vetting existing encoded data - * (useEncodedData) and for encoding the image (encode) when no such data is - * present or is rejected by the serializer. - * - * If not specified, we use a default serializer which 1) always accepts existing data - * (in any format) and 2) encodes to PNG. - * - * If no compatible encoded data exists and encoding fails, this method will also - * fail (return NULL). + * encoded data (as returned by refEncodedData). If there is no eisting data, the image + * will be encoded using PNG. On an error, this returns nullptr. */ - sk_sp<SkData> encodeToData(SkPixelSerializer* pixelSerializer = nullptr) const; + sk_sp<SkData> encodeToData() const; /** * If the image already has its contents in encoded form (e.g. PNG or JPEG), return that diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index 016be3759a..8edd183ede 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -21,7 +21,6 @@ struct SkDeserialProcs; class SkImage; class SkPath; class SkPictureData; -class SkPixelSerializer; class SkReadBuffer; class SkRefCntSet; struct SkSerialProcs; @@ -107,21 +106,11 @@ public: /** Returns a non-zero value unique among all pictures. */ uint32_t uniqueID() const; - /** - * Serialize the picture to SkData. If non nullptr, pixel-serializer will be used to - * customize how images reference by the picture are serialized/compressed. - */ - sk_sp<SkData> serialize(SkPixelSerializer* = nullptr) const; - + sk_sp<SkData> serialize() const; + void serialize(SkWStream*) const; sk_sp<SkData> serialize(const SkSerialProcs&) const; /** - * Serialize to a stream. If non nullptr, pixel-serializer will be used to - * customize how images reference by the picture are serialized/compressed. - */ - void serialize(SkWStream*, SkPixelSerializer* = nullptr) const; - - /** * Serialize to a buffer. */ void flatten(SkWriteBuffer&) const; diff --git a/include/core/SkPixelSerializer.h b/include/core/SkPixelSerializer.h deleted file mode 100644 index 28d5f5d2e6..0000000000 --- a/include/core/SkPixelSerializer.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPixelSerializer_DEFINED -#define SkPixelSerializer_DEFINED - -#include "SkData.h" -#include "SkPixmap.h" -#include "SkRefCnt.h" - -/** - * Interface for serializing pixels, e.g. SkBitmaps in an SkPicture. - */ -class SkPixelSerializer : public SkRefCnt { -public: - virtual ~SkPixelSerializer() {} - - /** - * Call to determine if the client wants to serialize the encoded data. If - * false, serialize another version (e.g. the result of encodePixels). - */ - bool useEncodedData(const void* data, size_t len) { - return this->onUseEncodedData(data, len); - } - - /** - * Call to get the client's version of encoding these pixels. If it - * returns NULL, serialize the raw pixels. - */ - sk_sp<SkData> encodeToData(const SkPixmap& pixmap) { - return sk_sp<SkData>(this->onEncode(pixmap)); - } - -protected: - /** - * Return true if you want to serialize the encoded data, false if you want - * another version serialized (e.g. the result of this->encode()). - */ - virtual bool onUseEncodedData(const void* data, size_t len) = 0; - - /** - * If you want to encode these pixels, return the encoded data as an SkData - * Return null if you want to serialize the raw pixels. - */ - virtual SkData* onEncode(const SkPixmap&) = 0; -}; -#endif // SkPixelSerializer_DEFINED diff --git a/include/core/SkWriteBuffer.h b/include/core/SkWriteBuffer.h index 0b1ae0c1aa..5d03e91caa 100644 --- a/include/core/SkWriteBuffer.h +++ b/include/core/SkWriteBuffer.h @@ -18,8 +18,6 @@ #include "SkWriter32.h" #include "../private/SkTHash.h" -#include "SkPixelSerializer.h" - class SkBitmap; class SkDeduper; class SkFactorySet; @@ -153,8 +151,6 @@ public: SkFactorySet* setFactoryRecorder(SkFactorySet*); SkRefCntSet* setTypefaceRecorder(SkRefCntSet*); - void setPixelSerializer(sk_sp<SkPixelSerializer>); - private: const uint32_t fFlags; SkFactorySet* fFactorySet; @@ -164,8 +160,6 @@ private: // Only used if we do not have an fFactorySet SkTHashMap<SkString, uint32_t> fFlattenableDict; - - sk_sp<SkPixelSerializer> fPS; }; #endif // SkWriteBuffer_DEFINED |