Граф коммитов

342 Коммитов

Автор SHA1 Сообщение Дата
Matthew Leibowitz 354d85d129
Always reference netstandard (#1250) 2020-04-26 10:29:35 +02:00
Matthew Leibowitz 2550d14410
[Android.Views] Refresh the surface when recreated (#1234)
Fixes #1232
2020-04-16 18:07:19 +02:00
Michael S. Scherotter 58a9a7b9c2
Update SKTouchHandler.cs to fix crash bug caused by passing incorrect parameter, added pressure and eraser handling (#1212)
* Fixed crash bug where id was incorrectly passed instead pointer to evt.GetToolType().
* Added stylus pressure for Android
* Added eraser handling - to map to middle button.
2020-04-07 11:10:12 +02:00
Matthew Leibowitz 792b9056f3
Release the skia objects when the view is unloaded (#1213)
* Release the skia objects when the view is unloaded

This was originally changed in 8039d0d0bb
for the AngleSwapChainPanel view. But, this was not also extended to include
the skia objects in SKSwapChainPanel.

Nothing needs to be re-created because it is all done in the first paint operation.
2020-04-07 01:03:49 +02:00
Michael S. Scherotter 689017845b
Added device type to touch events (touch, mouse, pen) (#1191) 2020-03-30 13:02:44 +02:00
Matthew Leibowitz 73bfe55954
Re-work views to avoid incorrect disposal (#1180) 2020-03-24 18:09:38 +02:00
Matthew Leibowitz 5e48f0dea2
Add the expected overload for newer versions XF.Tizen (#1117)
- Updating Xamarin.Forms to v4.4.0.991757
- Work around the portable PDB issue for UWP for now
2020-03-15 15:24:45 +02:00
Matthew Leibowitz ee0e668235
Use vcpkg to build ANGLE (#1158)
* Use vcpkg to build ANGLE
* Use a separate step to build ANGLE for now
* Use the new ANGLE constants
2020-03-03 00:09:52 +02:00
Matthew Leibowitz b0088442cc
Make sure the view is still in the hierarchy (#1143)
In the case of virtualized list views, the control may no longer be in screen, so we have to ignore touch events.
Fixes #978
2020-02-13 14:25:32 +02:00
Matthew Leibowitz 089c26314a
Before drawing, MakeCurrent (#1141)
Fixes #920
2020-02-12 01:42:24 +02:00
Matthew Leibowitz e6f9334a4d
Queue the redraw. Fixes #1074 (#1135)
macOS and iOS draw immediately, so rather queue the redraw.
Not only does this fix the stack overflow, but is now more consistent with the other platforms.
2020-02-11 17:56:35 +02:00
Matthew Leibowitz 148a4d39ad
Prevent double load issue. Fixes #1118 (#1133)
For some reason, some controls (such as the ScrollViewer's LeftHeader, TopHeader, TopLeftHeader) are loaded twice.
We work around this by just adding a counter.
This will also fix any other controls that are a bit weird.
2020-02-09 20:07:55 +02:00
Matthew Leibowitz c5fa9aa04e
More Improvements (#1123)
* Make more members readonly (the generator now makes the equality members readonly)
* split the SKMatrix file into SKMatrix44, SKRotationScaleMatrix, SK3dView
* split the SKColorSpace structs/classes into a separate file
* reworked/renamed all the poorly designed SKMatrix (and related) members to be actually useful
* Make sure the obsolete items are invisible
* Make sure everything implements IEquatable<T>
* Update docs and changelogs
* ISKGLViewController is public
2020-02-04 19:00:41 +02:00
Matthew Leibowitz b2d486ad17
Update Xamarin.Forms to v4.2.0.910310 (#1109)
* Use mono 6.4.0
* Things have moved around in Forms
2020-01-19 06:42:42 +02:00
Matthew Leibowitz ea9dd88f76
Fix issues with buffer samples #1087 (#1098) 2020-01-14 04:42:20 +02:00
Zbigniew Pytka 54ec9301cc SKGLViewRenderer dispose corrections (#1095) 2020-01-10 17:56:28 +02:00
Matthew Leibowitz e2514cda18
[WIP] Add GTK views for Xamarin.Forms (#1089)
* Adding GTK extension methods
* Add initial implementation for Xamarin.Forms GTK
* Better exceptions
* GTK v2 does not build on Windows CI
   This is because of mono not being installed. I could install it, but typically
   this is not available on normal dev boxes. So, to make things easier, just
   build on mac and linux.
2020-01-08 15:35:23 +02:00
Void² a82cecb0e8 Fix broken antialiasing with UWP SKSwapChainPanel (#1086) 2019-12-31 14:03:23 +02:00
Matthew Leibowitz 247569e095
Fix some issues with macOS SKGLView (#1083)
Fixes some of #977
2019-12-28 17:22:23 +02:00
Matthew Leibowitz 2f36be4761
Multi-target SkiaSharp.Views.Windows.Forms (#1082)
Related to #1029
2019-12-27 23:01:05 +02:00
Alexandr 0c8b543a47 WPF Mouse Wheel on Touch Event (#1079) 2019-12-27 15:05:30 +02:00
Matthew Leibowitz e84ba47396
Upgrade to VS2019 and .NET Core 3.0 (#1030)
* Upgraded a good few things
 - multitargeting for netstandard1.3, netstandard2.0, netcoreapp3.0 and net45
 - iOS, tvOS, macOS, watchOS now builds on non-macOS (not embedded binaries)
 - removed empty assembly infos
 - using Directory.Build.* to clean up a few things
 - improved the msbuild tasks to properly skip
* Add the targets file to the nuget
* Let all the tests run before failing the build
* Pack and validate in one go
* Update the samples to use the new projects
* Use VS 2017 for native builds for now
* Update Dockerfiles
* removed references from Views.WPF to OpenTK #1029 (#1078)
* Install the type redirector
* Update depot_tools
* Don't do any signing for macOS

Co-authored-by: Tyson Williams <34664007+bender2k14@users.noreply.github.com>
2019-12-22 18:50:47 +02:00
Matthew Leibowitz 975b47a913
Don't go straight for the max samples (#1060)
- The max may be 32 which may be too many for some GPUs
- Fixes #1053
2019-12-13 07:26:37 +02:00
Matthew Leibowitz dc9b306e28
Improve native build process + add Nano Server (#1040)
* Add Nano Server to the list (Fixes #676)
* Make separate cake files for native builds
2019-12-04 03:12:12 +02:00
Matthew Leibowitz a6a514c71d
Improve stability of UWP GPU View (#1024) 2019-11-21 05:00:56 +02:00
Matthew Leibowitz b1c0681e32
Correction of #879 (#1022) 2019-11-20 06:36:53 +02:00
Matthew Leibowitz 2e2914f625
Final tweaks to prepare for release (#1013)
* PRs should use a custom prerelease label
* Update some docs
* Release the mouse when the button is released  
  We must not require that the Handled == true because in many
  cases it is not an action that is really handled. Especially if the
  mouse is captured - nobody else is receiving events.
2019-11-17 05:45:08 +02:00
Matthew Leibowitz cd257ad48f
Free memory when the view is detached. Fixes #1004 (#1005) 2019-11-12 00:51:42 +02:00
Matthew Leibowitz ff7cc7823c
Update the docs and reduce diff (#979)
* 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
2019-10-17 14:29:31 +02:00
Matthew Leibowitz d5aa34a787
Re-work the managed-native types (#900)
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.
2019-07-30 03:26:21 +02:00
Matthew Leibowitz e6b7934556
Add the WPF backend for Xamarin.Forms (#917)
Add a new NuGet
- add a targets file to the nuget to warn if the platform packages were not installed

Update the pipeline:
- use build artifacts everywhere
- just disable tizen for Windows
2019-07-26 15:05:54 +02:00
Matthew Leibowitz ec5f04fea1
Update Xamarin.Forms (#916)
- so we can update OpenTK
- so we can add WPF and GTK
2019-07-23 14:19:25 +02:00
Matthew Leibowitz 5e8dc3e2c9
Split the desktop projects and packages (#899)
* Removed v2.3.1 and renamed Flags to BufferFlags
* Updated some API and Doc
* Add Gtk3 views
* Reworked the samples logic
 - handle the more varied project structure
 - build the generated zip to test it
 - always use the local nuget cache
* macOS is always Any CPU
* Rename SKWidget to SKDrawingArea for GTK#3
 - this allows us to have a single moniker for docs
 - it indicates that it is not quite the same as the widget in GTK#2
 - is is more specific so we can have more GTK# controls
* merge all the views (except forms) into a single moniker so it is better for browsing in the docs portal
* SK3dView is not actually obsolete :)
* Add readmes to the samples
2019-07-23 03:02:20 +02:00
Matthew Leibowitz c4a29d82bf
A few tweaks to harfbuzz (#915) 2019-07-21 21:15:59 +02:00
Benedikt Schroeder 1b0f3e371c Update HarfBuzz to v2.5.3 (#904)
- Update HarfBuzz to v2.5.3
 - Add UnicodeFunctions SetDelegate
 - Statically linked libstdc++ for Linux
2019-07-13 07:33:15 +02:00
Matthew Leibowitz 8c9750c87e
Improve the test runners (#903)
- `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
2019-07-13 05:14:48 +02:00
Benedikt Schroeder 82815f8aa7 [HarfBuzzSharp] font funcs (#881)
* 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
2019-06-27 20:06:55 +02:00
Matthew Leibowitz ce09f74fc1
Fix implementation of the iOS canvas (#879) 2019-06-24 10:55:42 +02:00
Odirb 25a78800e6 Fix #849 : function ToSKPixmap create display artifacts with transparent bitmaps (#863) 2019-06-24 03:36:53 +02:00
Matthew Leibowitz 8ab343f523
Fix whitespace 2019-06-22 21:09:32 +02:00
Matthew Leibowitz b135ac4efb
Don't create a bitmap if it is going to be zero 2019-06-22 21:07:26 +02:00
Matthew Leibowitz 650f2e43f7
Update some versions and fix the sample builds (#869)
- Xamarin.Forms is now the last v3.x (v3.6)
 - Build using the latest Android (v9.0)
 - Update UWP samples so they can build again
2019-06-21 02:20:42 +02:00
Matthew Leibowitz 37336c3e6a
Raster views shouldn't allocate 0 bytes. Fixes #759 (#761) 2019-06-21 01:56:37 +02:00
Matthew Leibowitz fb51b90761
[harfbuzz] Allow loading face by table data (#862)
* 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
2019-06-18 16:33:10 +02:00
Matthew Leibowitz 87bd5c6d01
Moving Documentation to SkiaSharp-API-docs (#843)
* Added the docs repo submodule
2019-05-17 11:53:05 -07:00
Matthew Leibowitz 915ca1746a
Made a few tweaks to better fit the "style"
- 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
2019-03-29 00:39:10 +02:00
Benedikt Schroeder 84105c5e2b Add font features 2019-03-17 20:02:45 +01:00
Benedikt Schroeder d678134cf5 Add unicode funcs 2019-03-01 15:43:18 +01:00
Benedikt Schroeder 1588e472f3 Add more tests 2019-02-25 15:58:52 +01:00
Benedikt Schroeder eb1a0e60aa Add initial unit tests
Replace uint with int to better fit into the .Net world.
2019-02-19 16:18:08 +01:00