[C# API] Fixed the delegates calling convention and some bitmap changes

This commit is contained in:
Matthew Leibowitz 2016-01-22 02:23:07 +02:00
Родитель 81f4b45944
Коммит c6f4edd97c
5 изменённых файлов: 18 добавлений и 5 удалений

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

@ -25,8 +25,8 @@
<Compile Include="$(MSBuildThisFileDirectory)SKTypeface.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKStream.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKManagedStream.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\SkiaSharp\Properties\SkiaSharpAssemblyInfo.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKBitmap.cs" />
<Compile Include="$(MSBuildThisFileDirectory)SKImageDecoder.cs" />
<Compile Include="$(MSBuildThisFileDirectory)..\SkiaSharp\Properties\SkiaSharpAssemblyInfo.cs" />
</ItemGroup>
</Project>

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

@ -129,7 +129,11 @@ namespace SkiaSharp
}
public SKImageInfo Info {
get { return SkiaApi.sk_bitmap_get_info (handle); }
get {
SKImageInfo info;
SkiaApi.sk_bitmap_get_info (handle, out info);
return info;
}
}
public int Width {
@ -177,7 +181,7 @@ namespace SkiaSharp
public SKColor[] Pixels {
get {
var info = SkiaApi.sk_bitmap_get_info (handle);
var info = Info;
var pixels = new SKColor[info.Width * info.Height];
SkiaApi.sk_bitmap_get_pixel_colors (handle, pixels);
return pixels;

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

@ -23,14 +23,23 @@ namespace SkiaSharp
private static readonly Dictionary<IntPtr, WeakReference<SKManagedStream>> managedStreams = new Dictionary<IntPtr, WeakReference<SKManagedStream>>();
// delegate declarations
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr read_delegate (IntPtr managedStreamPtr, IntPtr buffer, IntPtr size);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool isAtEnd_delegate (IntPtr managedStreamPtr);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool rewind_delegate (IntPtr managedStreamPtr);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr getPosition_delegate (IntPtr managedStreamPtr);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool seek_delegate (IntPtr managedStreamPtr, IntPtr position);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate bool move_delegate (IntPtr managedStreamPtr, long offset);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr getLength_delegate (IntPtr managedStreamPtr);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate IntPtr createNew_delegate (IntPtr managedStreamPtr);
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
internal delegate void destroy_delegate (IntPtr managedStreamPtr);
// delegate fields

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

@ -360,7 +360,7 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static void sk_bitmap_destructor(sk_bitmap_t b);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static SKImageInfo sk_bitmap_get_info(sk_bitmap_t b);
public extern static bool sk_bitmap_get_info(sk_bitmap_t b, out SKImageInfo info);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static IntPtr sk_bitmap_get_pixels(sk_bitmap_t b, out IntPtr length);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]

2
skia

@ -1 +1 @@
Subproject commit 26d323001058bc2ab42392226bd4d6cd19851b6f
Subproject commit 78632b7a27306e2be91b08f1b4b72bab144a3a16