Image decoder now uses SKString | Fixes #67

This commit is contained in:
Matthew Leibowitz 2016-05-18 02:47:55 +02:00
Родитель c081822c10
Коммит 2fc8476ab5
5 изменённых файлов: 31 добавлений и 5 удалений

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

@ -44,7 +44,7 @@ namespace SkiaSharp
public string FormatName
{
get { return SkiaApi.sk_imagedecoder_get_format_name_from_decoder(Handle); }
get { return (string) GetObject<SKString> (SkiaApi.sk_imagedecoder_get_format_name_from_decoder(Handle)); }
}
public bool SkipWritingZeros
@ -99,7 +99,7 @@ namespace SkiaSharp
public static string GetFormatName(SKImageDecoderFormat format)
{
return SkiaApi.sk_imagedecoder_get_format_name_from_format(format);
return (string) GetObject<SKString> (SkiaApi.sk_imagedecoder_get_format_name_from_format(format));
}
public static bool DecodeStreamBounds(SKStreamRewindable stream, out SKImageInfo info, SKColorType pref = SKColorType.Unknown)

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

@ -682,9 +682,9 @@ namespace SkiaSharp
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static SKImageDecoderFormat sk_imagedecoder_get_stream_format(sk_stream_streamrewindable_t cstream);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static string sk_imagedecoder_get_format_name_from_format(SKImageDecoderFormat cformat);
public extern static sk_string_t sk_imagedecoder_get_format_name_from_format(SKImageDecoderFormat cformat);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static string sk_imagedecoder_get_format_name_from_decoder(sk_imagedecoder_t cdecoder);
public extern static sk_string_t sk_imagedecoder_get_format_name_from_decoder(sk_imagedecoder_t cdecoder);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]
public extern static bool sk_imagedecoder_get_skip_writing_zeros(sk_imagedecoder_t cdecoder);
[DllImport(SKIA, CallingConvention = CallingConvention.Cdecl)]

2
skia

@ -1 +1 @@
Subproject commit d67ead770fdf3a79d369a39261204fd964fa3f0d
Subproject commit fbc0e18166b644c7eeee0cc7239be5999cdca58f

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

@ -81,6 +81,9 @@
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="..\Tests\SKStringTest.cs">
<Link>SKStringTest.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="..\Tests\SKManagedStreamTest.cs">
<Link>SKManagedStreamTest.cs</Link>

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

@ -0,0 +1,23 @@
using System;
using System.Drawing.Imaging;
using System.IO;
using NUnit.Framework;
namespace SkiaSharp.Tests
{
[TestFixture]
public class SKStringTest : SKTest
{
[Test]
public void StringIsMarshaledCorrectly ()
{
var filename = Path.GetTempFileName ();
bitmap.Save (filename, ImageFormat.Png);
var filestream = new SKFileStream (filename);
var decoder = new SKImageDecoder (filestream);
string format1 = decoder.FormatName;
}
}
}