Revert "remove dead code for legacy image encode api"

This reverts commit 41ed7f3379.

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>
This commit is contained in:
Brian Osman 2017-07-14 20:04:44 +00:00 committed by Skia Commit-Bot
parent 434a58ab5f
commit 1e0779ba11
3 changed files with 25 additions and 0 deletions

View File

@ -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;
/**

View File

@ -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

View File

@ -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 {