diff --git a/src/Skia/Perspex.Skia/SkiaSharpExtensions.cs b/src/Skia/Perspex.Skia/SkiaSharpExtensions.cs index a46f37f6ab..1cb0c710be 100644 --- a/src/Skia/Perspex.Skia/SkiaSharpExtensions.cs +++ b/src/Skia/Perspex.Skia/SkiaSharpExtensions.cs @@ -65,5 +65,10 @@ namespace Perspex.Skia case TextAlignment.Right: return SKTextAlign.Right; } } + + public static SKPath Clone(this SKPath src) + { + return src != null ? new SKPath(src) : null; + } } } diff --git a/src/Skia/Perspex.Skia/StreamGeometryImpl.cs b/src/Skia/Perspex.Skia/StreamGeometryImpl.cs index b5a7f9e3c9..ea704f7e38 100644 --- a/src/Skia/Perspex.Skia/StreamGeometryImpl.cs +++ b/src/Skia/Perspex.Skia/StreamGeometryImpl.cs @@ -50,28 +50,23 @@ namespace Perspex.Skia _transformedPath.Dispose(); _transformedPath = null; } - - // TODO: SkiaSharp does not expose Transform yet!!! - //if (!Transform.IsIdentity) - //{ - // _transformedPath = new SKPath(); - // _path.Transform(Transform.ToSKMatrix(), _transformedPath); - //} + + if (!Transform.IsIdentity) + { + _transformedPath = new SKPath(_path); + _transformedPath.Transform(Transform.ToSKMatrix()); + } } public IStreamGeometryImpl Clone() { - // TODO: there is no SKPath.Clone yet!!!!!!!!!!!!! - // - //return new StreamGeometryImpl - //{ - // _path = _path?.Clone(), - // _transformedPath = _transformedPath?.Clone(), - // _transform = Transform, - // Bounds = Bounds - //}; - - return this; // this will probably end bad!! + return new StreamGeometryImpl + { + _path = _path?.Clone(), + _transformedPath = _transformedPath?.Clone(), + _transform = Transform, + Bounds = Bounds + }; } public IStreamGeometryContextImpl Open() @@ -94,15 +89,6 @@ namespace Perspex.Skia public void Dispose() { - // TODO: Not sure what we need to do here. This code left here for reference. - // - // var arr = _elements.ToArray(); - // SkRect rc; - // _path?.Dispose(); - // _path = new SKPath(new SkPath(MethodTable.Instance.CreatePath(arr, arr.Length, out rc))); - // _geometryImpl.ApplyTransform(); - // _geometryImpl.Bounds = rc.ToRect(); - SKRect rc; _path.GetBounds(out rc); _geometryImpl.ApplyTransform(); diff --git a/src/Skia/Perspex.Skia/readme.md b/src/Skia/Perspex.Skia/readme.md index 615564b17f..7c20cf6c2e 100644 --- a/src/Skia/Perspex.Skia/readme.md +++ b/src/Skia/Perspex.Skia/readme.md @@ -17,12 +17,6 @@ RenderTarget - Figure out a cleaner implementation across all platforms - HW acceleration -StreamGeometry -- Paths within Paths may not work right -- Paths cannot be Cloned (lack of SkiaSupport) -- Paths cannot be transformed (lack of SkiaSupport) -- ArcTo - App Bootstrapping - Cleanup the testapplications across all platforms - Add a cleaner Fluent API for the subsystems