diff options
author | 2017-07-14 20:04:44 +0000 | |
---|---|---|
committer | 2017-07-14 20:29:35 +0000 | |
commit | 1e0779ba1120182c03f5d52a66df043d70efc376 (patch) | |
tree | 6b8a901299a4f6f9b8cfa1ad08209f67a65a66a6 | |
parent | 434a58ab5fefcc1b86588c7fce898b1e5bd248ba (diff) |
Revert "remove dead code for legacy image encode api"
This reverts commit 41ed7f33792c4c32b8444230b8b59cab5e29e45e.
Reason for revert: Need this in temporarily to navigate Flutter and Fuchsia rolls.
Original change's description:
> remove dead code for legacy image encode api
>
> Bug: skia:
> Change-Id: Ia90d776946281473c56cd93006df1b523475696a
> Reviewed-on: https://skia-review.googlesource.com/23022
> Reviewed-by: Leon Scroggins <scroggo@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
TBR=scroggo@google.com,reed@google.com
# Not skipping CQ checks because original CL landed > 1 day ago.
Bug: skia:
Change-Id: I078762fc13de0c455dc6f8a5725d9529af03bffc
Reviewed-on: https://skia-review.googlesource.com/23385
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
-rw-r--r-- | include/core/SkImage.h | 6 | ||||
-rw-r--r-- | include/core/SkPixelSerializer.h | 4 | ||||
-rw-r--r-- | src/image/SkImage.cpp | 15 |
3 files changed, 25 insertions, 0 deletions
diff --git a/include/core/SkImage.h b/include/core/SkImage.h index f63ba41fea..862dc6691e 100644 --- a/include/core/SkImage.h +++ b/include/core/SkImage.h @@ -390,6 +390,12 @@ public: */ sk_sp<SkData> refEncodedData() const; +#ifdef SK_SUPPORT_LEGACY_IMAGE_ENCODE_API + SkData* encode(SkEncodedImageFormat, int quality) const; + SkData* encode(SkPixelSerializer* = nullptr) const; + SkData* refEncoded() const; +#endif + const char* toString(SkString*) const; /** diff --git a/include/core/SkPixelSerializer.h b/include/core/SkPixelSerializer.h index 28d5f5d2e6..c3cbc0ad01 100644 --- a/include/core/SkPixelSerializer.h +++ b/include/core/SkPixelSerializer.h @@ -35,6 +35,10 @@ public: return sk_sp<SkData>(this->onEncode(pixmap)); } +#ifdef SK_SUPPORT_LEGACY_IMAGE_ENCODE_API + SkData* encode(const SkPixmap& pixmap); +#endif + protected: /** * Return true if you want to serialize the encoded data, false if you want diff --git a/src/image/SkImage.cpp b/src/image/SkImage.cpp index 841e83cc2b..8cb526746c 100644 --- a/src/image/SkImage.cpp +++ b/src/image/SkImage.cpp @@ -138,6 +138,21 @@ sk_sp<SkImage> SkImage::MakeFromEncoded(sk_sp<SkData> encoded, const SkIRect* su return SkImage::MakeFromGenerator(SkImageGenerator::MakeFromEncoded(encoded), subset); } +#ifdef SK_SUPPORT_LEGACY_IMAGE_ENCODE_API +SkData* SkImage::encode(SkEncodedImageFormat format, int quality) const { + return this->encodeToData(format, quality).release(); +} +SkData* SkImage::encode(SkPixelSerializer* serial) const { + return this->encodeToData(serial).release(); +} +SkData* SkImage::refEncoded() const { + return this->refEncodedData().release(); +} +SkData* SkPixelSerializer::encode(const SkPixmap& pixmap) { + return this->encodeToData(pixmap).release(); +} +#endif + /////////////////////////////////////////////////////////////////////////////////////////////////// const char* SkImage::toString(SkString* str) const { |