Browse Source

Fixed up Skia's StreamGeometryImpl now that SkiaSharp contains SKPath cloning and transforming.

pull/530/head
Jason Jarvis 10 years ago
parent
commit
5d8e339744
  1. 5
      src/Skia/Perspex.Skia/SkiaSharpExtensions.cs
  2. 40
      src/Skia/Perspex.Skia/StreamGeometryImpl.cs
  3. 6
      src/Skia/Perspex.Skia/readme.md

5
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;
}
}
}

40
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();

6
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

Loading…
Cancel
Save