From 546add4889d3a28fad888fb5cf6515c0b86b562c Mon Sep 17 00:00:00 2001 From: Charlenni Date: Fri, 21 Dec 2018 21:38:57 +0100 Subject: [PATCH] Changed return type of NewPictureSnapshot from SKPicture to IntPtr Changed some typos Changed function name NewPictureSnapshot() to ToPicture() --- binding/Binding/SKDrawable.cs | 14 +++++++------- externals/skia | 2 +- samples/Basic/Desktop/SkiaSharpSample/Form1.cs | 6 ++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/binding/Binding/SKDrawable.cs b/binding/Binding/SKDrawable.cs index 011f690f..51ee2bf5 100644 --- a/binding/Binding/SKDrawable.cs +++ b/binding/Binding/SKDrawable.cs @@ -16,7 +16,7 @@ namespace SkiaSharp [UnmanagedFunctionPointer (CallingConvention.Cdecl)] internal delegate void getBounds_delegate (IntPtr managedDrawablePtr, out SKRect rect); [UnmanagedFunctionPointer (CallingConvention.Cdecl)] - internal delegate SKPicture newPictureSnapshot_delegate (IntPtr managedDrawablePtr); + internal delegate IntPtr newPictureSnapshot_delegate (IntPtr managedDrawablePtr); // delegate fields private static readonly draw_delegate fDraw; @@ -46,7 +46,7 @@ namespace SkiaSharp : base (SkiaApi.sk_manageddrawable_new (), owns) { if (Handle == IntPtr.Zero) { - throw new InvalidOperationException ("Unable to create a new SKAbstractDrawable instance."); + throw new InvalidOperationException ("Unable to create a new SKDrawable instance."); } managedDrawables.TryAdd (Handle, this); @@ -77,7 +77,7 @@ namespace SkiaSharp base.Dispose (disposing); } - public uint GenerationID => SkiaApi.sk_drawable_get_generation_id (Handle); + public uint GenerationId => SkiaApi.sk_drawable_get_generation_id (Handle); public SKRect Bounds { get { @@ -97,7 +97,7 @@ namespace SkiaSharp SkiaApi.sk_drawable_draw (Handle, canvas.Handle, ref matrix); } - public SKPicture NewPictureSnapshot () + public SKPicture ToPicture () { return GetObject (SkiaApi.sk_drawable_new_picture_snapshot (Handle)); } @@ -139,9 +139,9 @@ namespace SkiaSharp } [MonoPInvokeCallback(typeof(newPictureSnapshot_delegate))] - private static SKPicture NewPictureSnapshotInternal (IntPtr managedDrawablePtr) + private static IntPtr NewPictureSnapshotInternal (IntPtr managedDrawablePtr) { - return GetObject (AsManagedDrawable (managedDrawablePtr).OnNewPictureSnapshot ().Handle); + return AsManagedDrawable (managedDrawablePtr).OnNewPictureSnapshot ().Handle; } private static SKDrawable AsManagedDrawable (IntPtr ptr) @@ -149,7 +149,7 @@ namespace SkiaSharp if (AsManagedDrawable (ptr, out var target)) { return target; } - throw new ObjectDisposedException ("SKAbstractDrawable: " + ptr); + throw new ObjectDisposedException ("SKDrawable: " + ptr); } private static bool AsManagedDrawable (IntPtr ptr, out SKDrawable target) diff --git a/externals/skia b/externals/skia index 949376ad..13c58be9 160000 --- a/externals/skia +++ b/externals/skia @@ -1 +1 @@ -Subproject commit 949376ad5b1d25d0d165f418f3ec3fc2e9e1b321 +Subproject commit 13c58be9021faed94caef204cf077aef9a47995c diff --git a/samples/Basic/Desktop/SkiaSharpSample/Form1.cs b/samples/Basic/Desktop/SkiaSharpSample/Form1.cs index 4ee14fa3..6a60229e 100644 --- a/samples/Basic/Desktop/SkiaSharpSample/Form1.cs +++ b/samples/Basic/Desktop/SkiaSharpSample/Form1.cs @@ -41,8 +41,8 @@ namespace SkiaSharpSample var drawable = new Class1(); var bounds = drawable.Bounds; canvas.DrawDrawable(drawable, 0, 0); - drawable.NewPictureSnapshot(); - var id = drawable.GenerationID; + drawable.ToPicture(); + var id = drawable.GenerationId; drawable.NotifyDrawingChanged(); var recorder = new SKPictureRecorder(); @@ -50,6 +50,8 @@ namespace SkiaSharpSample recorderCanvas.DrawRect(new SKRect(20,20,80,80), paint); var d = recorder.EndRecordingAsDrawable(); bounds = d.Bounds; + + var temp = new SKDrawable(true); } } }