/// <summary> /// Cache path for given stroke width. Takes ownership of a passed path. /// </summary> /// <param name="path">Path to cache.</param> /// <param name="strokeWidth">Stroke width to cache.</param> /// <param name="geometryRenderBounds">Render bounds to use.</param> public void Cache(SKPath path, float strokeWidth, Rect geometryRenderBounds) { if (CachedStrokePath != path) { CachedStrokePath?.Dispose(); } CachedStrokePath = path; CachedGeometryRenderBounds = geometryRenderBounds; _cachedStrokeWidth = strokeWidth; }
/// <summary> /// Invalidate cache state. /// </summary> public void Invalidate() { CachedStrokePath?.Dispose(); CachedGeometryRenderBounds = Rect.Empty; _cachedStrokeWidth = default(float); }