* Adding back some methods to reduce the breaking changes.
* Making sure to force the use of VS2017
* Update all the docs
* Keep the diff in the output
* List the exported symbols on Linux
* Some of the colorspaces created are just references
- SRGB and SRGB Linear colorspaces are static and should never be disposed
* Fix concurrent disposal and creation
- In some cases, a new native object is created with the same memory location while the
managed instances is still being disposed. In this case, we cannot remove the managed
instance from the dictionary, since it is not the current object being disposed anymore.
- SKColorSpace has some members that should not be disposed, since they are static on the
native side. Just, there is no docs for this, so calling dispose will crash everything.
- Added the logic to make sure that all static objects are created before anything, so we can
get a handle on them and make sure they are static managed instances.
* Make sure the objects are not collected when using spans
Changes:
- Added `GCHandleProxy` to debug builds
- this is used to track all `GCHandle` `Alloc` and `Free` calls to ensure that all allocations are freed.
- added some unit tests to make sure this is actually enforced
- as a result, several object are now freed correctly
- Added `ISKReferenceCounted` and `ISKNonVirtualReferenceCounted` interfaces to represent the reference counting types used in the native library
- this helps with automatically de-referencing objects
- `SKAbstractManagedStream`, `SKAbstractManagedWStream` and `SKDrawable` have been re-written to use better delegates
- instead of passing each of the delegates as parameters, they are now a struct that is passed as a single object
- better for extensions (which there shouldn't be) and only a single static field on the type
- removed the usage of `Marshal.GetFunctionPointerForDelegate`, which should help out with WASM (see #876)
- the objects now only keep weak references, meaning that they can now be garbage collected
- instead of trying to resolve the instances with a dictionary, a delegate is used and passed as "user context"
- Moved some of the repetitive logic from the types into the base `SKObject` and `SKNativeObject`
- some logic is automatically executed if the concrete type is `ISKReferenceCounted` or `ISKNonVirtualReferenceCounted`
- with the more centralized logic and stricter patterns, better tests can be written to make sure all memory is freed correctly and timely
- `SKData`, `SKFontManager` and `SKTypeface` now correctly prevent disposal of the "static" instances
- `SKPaint` now references the `Shader`, `MaskFilter`, `ColorFilter`, `ImageFilter`, `Typeface` and `PathEffect` properties
- this prevents accidental collection, or non-collection when the object goes out of scope
- the `SKPath` iterators (`Iterator` and `RawIterator`) and op builder (`OpBuilder`) now correctly own and dispose their native objects
- `SKRegion` objects are now disposed on the native side
- `SKTypeface` construction from a `SKManagedStream` (via both `SKTypeface` and `SKFontManager`) now copy the contents of the .NET `Stream` into a native memory
- typeface construction requires multiple seeks (previously, the stream was copied only if it was non-seekable)
- it also requires "duplicating" the stream, which is not supported on .NET streams
- duplicates or forks of a stream means that each of the streams need to be read concurrently from different locations
- .NET streams can only have a single position
- Updated the NuGets used for the tests
- using the `Xunit.AssemblyFixture` and `Xunit.SkippableFact` NuGets instead of using the code directly
- removed the `Xunit.Categories` NuGet as it was preventing tests from running
This PR has a big set of changes that may be breaking due to bug fixes:
- The `SKAbstractManagedStream`, `SKAbstractManagedWStream` and `SKDrawable` no longer prevent the GC from collecting them. This means that if code no longer references them, they will be disposed.
- As far as I can tell, this should not be a problem for the streams as they are never kept around - they are just used for reading and writing and typically only need to live for as long as a single method, and then need to be disposed by the caller. The `SKTypeface` and `SKDocument` do keep it around for a bit, but then they also take ownership of the stream and keep a hard reference to the streams themselves. They will dispose the streams when they are disposed.
- `SKDrawable` is never kept around and is entirely a user-controlled object. If it goes out of scope, skia doesn't have a reference anyway.
- The `SKFontManager` and `SKTypeface` no longer use the managed streams (`SKManagedStream` or `Stream`) directly
- they make a copy.
- This is simply because skia streams can do things that are not possible for .NET - they can be read concurrently from different positions. If a `SKFileStream` or `SKMemoryStream` are passed, then the streams are not copied.
- Further optimizations can be made in the case of a `MemoryStream` or `byte[]` to not actually copy but use GC pinning to get a handle to the managed data and work with pointers. But this can be done later so that this PR can be merged and tested.
- `dotnet build` will fail because `CodeTaskFactory` factory is not supported, so use regular MSBuild properties
- use the new stages feature
- .net core tests now use libraries instead of nugets
- changed a few things in the pipeline yaml
* Initial implementation of font funcs
* Add a method to reduce verbosity for multi-delegates
* Add missing unit tests
* Remove the concept of "user data"
- this is not really useful to C# and delegates
- it adds complexity
* Remove context from delegates
* Implement UserDataDelegate
* Add the calling convention to the delegates.
* Moved some files around and improved tests
- moved the font functions interop into a new file to help separate logic from interop (helpful for wasm)
- added the various interop and [MarshalAs] attributes for Windows
- reworked the interop api tests to include the harfbuzz apis
- the font name delegates now use strings
- removed single line if braces to reduce code
* Throw correct extensions
* Face can now also use the UserDataDelegate
* Add several overloads that take ReadOnlySpan<byte>
* Update to System.Memory 4.5.3
* Made a few tweaks to the text blob
- copy using new Span<T> CopyTo method
- split runbuffers out into their own file
* Add Span<T> overloads for the blob allocations
* Add hb_face_create_for_tables support
* Fix net core build
* Make sure blobs are reused
* Support cleanup for TableLoader
* Remove extension
* Fix dispose handler and add unit test
* Rework unit tests to reduce file access
* Keep delegate alive
* Improve font usage in unit tests
* Support for iOS
* Remove typeface extension
* Cleanup
* Add unit test
* update the docs before re-gen
* A few tweaks:
- use Parse instead of FromString
- create a "static" Blob type
- remove default param values
- fix tests namespaces and base tests
* More changes:
- unified the destroy delegates
- NativeDelegateContext now supports multiple delegates and contexts for a single pointer
- public Face delegates no longer use pointers
* Reuse the code
* Added lower-level members to SKTypeface
- get the table data without copying to array
- added some TryXXX to avoid exceptions
* Revert parameter name change
* The empty Face is a static face that cannot be disposed
* Make sure to return the same managed instance
* Remove the duplicate iOS build run
- converted default arguments into overloads
- fixed a few whitespaces in unchanged files
- updated all the projects to C# 7.3
- the Buffer propertes are now arrays again, but added methods for the spans
- reduce breaking changes
- the values can be broken if the buffer changes, so use a better named method
- removed the new Point type
- don't want to add another point type to the world
- will use the .net standard 2.0 Point type when we upgrade
- the Font.Scale property is removed for now, but we will add it back with the drawing point type
- the Font GetAdvances are now returning arrays
- the spans were not necessary as the type is an explicit array
- changed the casing of the various script properties
- Use the latest version of MSBuild.Sdk.Extras
- No longer use MSBuild.Sdk.Extras for the net and netstandard monikers as the new .NET Core already supports these nicely
- Update all the Android projects to be 4.4+ as below is no longer realistically supported - both by Xamarin and Google
- Using the Sdk attribute to specify the new project SDK
- previous logic: did not check for nulls, the update did
- new logic: still check for nulls, but now only if we have indicated that there _should_ be text (there is a length)
- added overloads for text pointers that accept an int as opposed to just an IntPtr
- consistency
- `Resize` is for methods that create new objects
- `ScalePixels` is for mthods that COPY pixels INTO a provided object
- uniformity
- all 3 imageing types have pixel scaling capabilities
- improved obsolete desriptions
- added new methods instead of just obsoleting
- added more tests
- SKCodec can now decode more imputs (bytes, streams)
- SKImage no longer unnecessarily copies image data all over when decoding
- SKBitmap no longer copies data unnecessarily
- A bunch of changes to no longer wrpa a managed stream for non-ASCII paths on Windows
- All paths are now converted to a UTF-8 path before been shipped over to native code
- Fixes#697
- no "clever" mapping from types, just cast
- removing variables, just use a direct call
- sk_imageinfo_t still requires mapping because of the sk_sp<T> must be mapped to a T*
- sksurfaceprops_t is now a class
- use "real" types instead of just IntPtr in the interop layer to make things easier to read
- using some new C# features
- corrected the use of the "fixed" keyword to no longer require arrays to have elements
* Prepare the bits to build the linux platforms
* Adding just the required native packages
* Update mdoc and add the --quiet flag to reduce output noise
* Moved the linux native assets into a separate nuget
* Updated the UWP signing key
* Remove the old index8 members
Current temprary hacks for tizen-x86 RID are still needed because the Tizen 4.0 platform
including .NETCore 2.0 does not understand the tizen-x86 RID.
In this changes, Use TizenTPKFiles defined in Tizen.NET.Sdk instead of Link and CopyToOutputDirectory
to solve following problems.
- The linked file (runtime/linux-x86/native/foo.so) is displayed in VS Project tree.
- The linked file is always copied to tpkroot/bin even when RID is specified.
- The linked file can't be excluded using the file excluding features of Tizen.NET.Sdk.
- this includes the Tizen bits from the PR
- the config.h for harfbuzz is no longer from the repo, but an actual config
- added a basic Tizen-only sample
- SkiaSharp.HarfBuzz.NetStandard and SkiaSharp.views.Forms.NetStandard should have died long time ago