diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkPicture.h | 3 | ||||
-rw-r--r-- | include/core/SkSerialProcs.h | 21 |
2 files changed, 18 insertions, 6 deletions
diff --git a/include/core/SkPicture.h b/include/core/SkPicture.h index b2beb56b86..1a5ecb360b 100644 --- a/include/core/SkPicture.h +++ b/include/core/SkPicture.h @@ -168,10 +168,11 @@ private: // V59: No more LocalSpace option on PictureImageFilter // V60: Remove flags in picture header // V61: Change SkDrawPictureRec to take two colors rather than two alphas + // V62: Don't negate size of custom encoded images (don't write origin x,y either) // Only SKPs within the min/current picture version range (inclusive) can be read. static const uint32_t MIN_PICTURE_VERSION = 56; // august 2017 - static const uint32_t CURRENT_PICTURE_VERSION = 61; + static const uint32_t CURRENT_PICTURE_VERSION = 62; static bool IsValidPictInfo(const SkPictInfo& info); static sk_sp<SkPicture> Forwardport(const SkPictInfo&, diff --git a/include/core/SkSerialProcs.h b/include/core/SkSerialProcs.h index 0c20f08b5c..e5a886a332 100644 --- a/include/core/SkSerialProcs.h +++ b/include/core/SkSerialProcs.h @@ -18,7 +18,7 @@ * If null is returned, then Skia will take its default action. * * The default action for pictures is to use Skia's internal format. - * The default action for images is to encode using PNG. + * The default action for images is to encode either in its native format or PNG. * The default action for typefaces is to use Skia's internal format. */ @@ -27,13 +27,24 @@ typedef sk_sp<SkData> (*SkSerialImageProc)(SkImage*, void* ctx); typedef sk_sp<SkData> (*SkSerialTypefaceProc)(SkTypeface*, void* ctx); /** - * A deserial-proc is given the serialized form previously returned by the corresponding - * serial-proc, and should return the re-constituted object. In case of an error, the proc - * can return nullptr. + * Called with the encoded form of a picture (previously written with a custom + * SkSerialPictureProc proc). Return a picture object, or nullptr indicating failure. */ - typedef sk_sp<SkPicture> (*SkDeserialPictureProc)(const void* data, size_t length, void* ctx); + +/** + * Called with the encoded from of an image. The proc can return an image object, or if it + * returns nullptr, then Skia will take its default action to try to create an image from the data. + * + * Note that unlike SkDeserialPictureProc and SkDeserialTypefaceProc, return nullptr from this + * does not indicate failure, but is a signal for Skia to take its default action. + */ typedef sk_sp<SkImage> (*SkDeserialImageProc)(const void* data, size_t length, void* ctx); + +/** + * Called with the encoded form of a typeface (previously written with a custom + * SkSerialTypefaceProc proc). Return a typeface object, or nullptr indicating failure. + */ typedef sk_sp<SkTypeface> (*SkDeserialTypefaceProc)(const void* data, size_t length, void* ctx); struct SK_API SkSerialProcs { |