Skip to content

Commit f07800c

Browse files
committed
original C api must be kept
1 parent 6609362 commit f07800c

File tree

3 files changed

+17
-4
lines changed

3 files changed

+17
-4
lines changed

include/c/sk_codec.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ SK_C_PLUS_PLUS_BEGIN_GUARD
1616

1717
SK_C_API size_t sk_codec_min_buffered_bytes_needed(void);
1818

19-
SK_C_API sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream, sk_codec_result_t* result, sk_png_chunk_reader_t* chunk_reader, sk_codec_selection_policy_t policy);
20-
SK_C_API sk_codec_t* sk_codec_new_from_data(sk_data_t* data, sk_png_chunk_reader_t* chunk_reader);
19+
SK_C_API sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream, sk_codec_result_t* result);
20+
SK_C_API sk_codec_t* sk_codec_new_from_data(sk_data_t* data);
21+
SK_C_API sk_codec_t* sk_codec_new_from_stream_with_png_chunk_reader_and_selection_policy(sk_stream_t* stream, sk_codec_result_t* result, sk_png_chunk_reader_t* chunk_reader, sk_codec_selection_policy_t policy);
22+
SK_C_API sk_codec_t* sk_codec_new_from_data_with_png_chunk_reader(sk_data_t* data, sk_png_chunk_reader_t* chunk_reader);
2123
SK_C_API void sk_codec_destroy(sk_codec_t* codec);
2224
SK_C_API void sk_codec_get_info(sk_codec_t* codec, sk_imageinfo_t* info);
2325
SK_C_API sk_encodedorigin_t sk_codec_get_origin(sk_codec_t* codec);

src/c/sk_codec.cpp

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,21 @@ size_t sk_codec_min_buffered_bytes_needed(void) {
1717
return SkCodec::MinBufferedBytesNeeded();
1818
}
1919

20-
sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream, sk_codec_result_t* result, sk_png_chunk_reader_t* chunk_reader, sk_codec_selection_policy_t policy) {
20+
sk_codec_t* sk_codec_new_from_stream(sk_stream_t* stream, sk_codec_result_t* result) {
21+
std::unique_ptr<SkStream> skstream(AsStream(stream));
22+
return ToCodec(SkCodec::MakeFromStream(std::move(skstream), (SkCodec::Result*)result).release());
23+
}
24+
25+
sk_codec_t* sk_codec_new_from_data(sk_data_t* data) {
26+
return ToCodec(SkCodec::MakeFromData(sk_ref_sp(AsData(data))).release());
27+
}
28+
29+
sk_codec_t* sk_codec_new_from_stream_with_png_chunk_reader_and_selection_policy(sk_stream_t* stream, sk_codec_result_t* result, sk_png_chunk_reader_t* chunk_reader, sk_codec_selection_policy_t policy) {
2130
std::unique_ptr<SkStream> skstream(AsStream(stream));
2231
return ToCodec(SkCodec::MakeFromStream(std::move(skstream), (SkCodec::Result*)result, AsPngChunkReader(chunk_reader), (SkCodec::SelectionPolicy)policy).release());
2332
}
2433

25-
sk_codec_t* sk_codec_new_from_data(sk_data_t* data, sk_png_chunk_reader_t* chunk_reader) {
34+
sk_codec_t* sk_codec_new_from_data_with_png_chunk_reader(sk_data_t* data, sk_png_chunk_reader_t* chunk_reader) {
2635
return ToCodec(SkCodec::MakeFromData(sk_ref_sp(AsData(data)), AsPngChunkReader(chunk_reader)).release());
2736
}
2837

src/xamarin/SkiaKeeper.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ void** KeepSkiaCSymbols (void)
7171
(void*)sk_codec_min_buffered_bytes_needed,
7272
(void*)sk_codec_new_from_data,
7373
(void*)sk_codec_new_from_stream,
74+
(void*)sk_codec_new_from_stream_with_png_chunk_reader_and_selection_policy,
75+
(void*)sk_codec_new_from_data_with_png_chunk_reader,
7476
(void*)sk_colorfilter_unref,
7577
(void*)sk_colorspace_unref,
7678
(void*)sk_colortable_unref,

0 commit comments

Comments
 (0)