SKStream readXXX now return bool and have an out parameter for the value

This commit is contained in:
Matthew Leibowitz 2018-09-04 21:58:34 +02:00
Родитель b52e69feff
Коммит 3473c45954
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 3650EBE4AA155AF9
3 изменённых файлов: 86 добавлений и 26 удалений

Просмотреть файл

@ -18,32 +18,86 @@ namespace SkiaSharp
public SByte ReadSByte ()
{
return SkiaApi.sk_stream_read_s8 (Handle);
if (ReadSByte (out var buffer))
return buffer;
return default (SByte);
}
public Int16 ReadInt16 ()
{
return SkiaApi.sk_stream_read_s16 (Handle);
if (ReadInt16 (out var buffer))
return buffer;
return default (Int16);
}
public Int32 ReadInt32 ()
{
return SkiaApi.sk_stream_read_s32 (Handle);
if (ReadInt32 (out var buffer))
return buffer;
return default (Int32);
}
public Byte ReadByte ()
{
return SkiaApi.sk_stream_read_u8 (Handle);
if (ReadByte (out var buffer))
return buffer;
return default (Byte);
}
public UInt16 ReadUInt16 ()
{
return SkiaApi.sk_stream_read_u16 (Handle);
if (ReadUInt16 (out var buffer))
return buffer;
return default (UInt16);
}
public UInt32 ReadUInt32 ()
{
return SkiaApi.sk_stream_read_u32 (Handle);
if (ReadUInt32 (out var buffer))
return buffer;
return default (UInt32);
}
public bool ReadBool ()
{
if (ReadBool (out var buffer))
return buffer;
return default (bool);
}
public bool ReadSByte (out SByte buffer)
{
return SkiaApi.sk_stream_read_s8 (Handle, out buffer);
}
public bool ReadInt16 (out Int16 buffer)
{
return SkiaApi.sk_stream_read_s16 (Handle, out buffer);
}
public bool ReadInt32 (out Int32 buffer)
{
return SkiaApi.sk_stream_read_s32 (Handle, out buffer);
}
public bool ReadByte (out Byte buffer)
{
return SkiaApi.sk_stream_read_u8 (Handle, out buffer);
}
public bool ReadUInt16 (out UInt16 buffer)
{
return SkiaApi.sk_stream_read_u16 (Handle, out buffer);
}
public bool ReadUInt32 (out UInt32 buffer)
{
return SkiaApi.sk_stream_read_u32 (Handle, out buffer);
}
public bool ReadBool (out Boolean buffer)
{
return SkiaApi.sk_stream_read_bool (Handle, out buffer);
}
public int Read (byte[] buffer, int size)

Просмотреть файл

@ -1080,20 +1080,26 @@ namespace SkiaSharp
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_is_at_end(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static SByte sk_stream_read_s8(sk_stream_t stream);
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_read_s8(sk_stream_t stream, out sbyte buffer);
[return: MarshalAs(UnmanagedType.I1)]
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static Int16 sk_stream_read_s16(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static Int32 sk_stream_read_s32(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static Byte sk_stream_read_u8(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static UInt16 sk_stream_read_u16(sk_stream_t stream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static UInt32 sk_stream_read_u32(sk_stream_t stream);
public extern static bool sk_stream_read_s16(sk_stream_t stream, out short buffer);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_read_bool(sk_stream_t stream);
public extern static bool sk_stream_read_s32(sk_stream_t stream, out int buffer);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_read_u8(sk_stream_t stream, out byte buffer);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_read_u16(sk_stream_t stream, out ushort buffer);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_read_u32(sk_stream_t stream, out uint buffer);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_read_bool(sk_stream_t stream, [MarshalAs (UnmanagedType.I1)] out bool buffer);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_stream_rewind(sk_stream_t stream);
@ -1179,25 +1185,25 @@ namespace SkiaSharp
public extern static IntPtr sk_wstream_bytes_written(sk_wstream_t cstream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_8(sk_wstream_t cstream, Byte value);
public extern static bool sk_wstream_write_8(sk_wstream_t cstream, byte value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_16(sk_wstream_t cstream, UInt16 value);
public extern static bool sk_wstream_write_16(sk_wstream_t cstream, ushort value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_32(sk_wstream_t cstream, UInt32 value);
public extern static bool sk_wstream_write_32(sk_wstream_t cstream, uint value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_text(sk_wstream_t cstream, [MarshalAs(UnmanagedType.LPStr)] string value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_dec_as_text(sk_wstream_t cstream, Int32 value);
public extern static bool sk_wstream_write_dec_as_text(sk_wstream_t cstream, int value);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_bigdec_as_text(sk_wstream_t cstream, Int64 value, int minDigits);
public extern static bool sk_wstream_write_bigdec_as_text(sk_wstream_t cstream, long value, int minDigits);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_hex_as_text(sk_wstream_t cstream, UInt32 value, int minDigits);
public extern static bool sk_wstream_write_hex_as_text(sk_wstream_t cstream, uint value, int minDigits);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
[return: MarshalAs(UnmanagedType.I1)]
public extern static bool sk_wstream_write_scalar_as_text(sk_wstream_t cstream, float value);
@ -1328,9 +1334,9 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static byte sk_bitmap_get_addr_8(sk_bitmap_t cbitmap, int x, int y);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static UInt16 sk_bitmap_get_addr_16(sk_bitmap_t cbitmap, int x, int y);
public extern static ushort sk_bitmap_get_addr_16(sk_bitmap_t cbitmap, int x, int y);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static UInt32 sk_bitmap_get_addr_32(sk_bitmap_t cbitmap, int x, int y);
public extern static uint sk_bitmap_get_addr_32(sk_bitmap_t cbitmap, int x, int y);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr sk_bitmap_get_addr(sk_bitmap_t cbitmap, int x, int y);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]

2
externals/skia поставляемый

@ -1 +1 @@
Subproject commit 8070b1f821d1510f14c70e4a03eab456b6ca48d9
Subproject commit eae9c1abbb11acf1661f4059f67eb1892dcac249