66
77namespace OxyPlot . SkiaSharp
88{
9- using global ::SkiaSharp ;
10- using global ::SkiaSharp . HarfBuzz ;
11- using HarfBuzzSharp ;
12- using OxyPlot . Rendering ;
139 using System ;
1410 using System . Collections . Generic ;
1511 using System . Linq ;
16- using System . Security . Cryptography ;
12+ using global ::SkiaSharp ;
13+ using global ::SkiaSharp . HarfBuzz ;
14+ using OxyPlot . Rendering ;
1715
1816 /// <summary>
1917 /// Implements <see cref="IRenderContext" /> based on SkiaSharp.
@@ -30,7 +28,7 @@ public class SkiaRenderContext : IRenderContext, IDisposable, ITextMeasurer
3028 /// </summary>
3129 public SkiaRenderContext ( )
3230 {
33- TextArranger = new TextArranger ( this ) ;
31+ this . TextArranger = new TextArranger ( this ) ;
3432 }
3533
3634 /// <summary>
@@ -243,7 +241,7 @@ public void DrawPolygon(
243241 double [ ] dashArray = null ,
244242 LineJoin lineJoin = LineJoin . Miter )
245243 {
246- if ( ! fill . IsVisible ( ) && ! ( stroke . IsVisible ( ) || thickness <= 0 ) || points . Count < 2 )
244+ if ( ( ! fill . IsVisible ( ) && ! ( stroke . IsVisible ( ) || thickness <= 0 ) ) || points . Count < 2 )
247245 {
248246 return ;
249247 }
@@ -276,7 +274,7 @@ public void DrawPolygons(
276274 double [ ] dashArray = null ,
277275 LineJoin lineJoin = LineJoin . Miter )
278276 {
279- if ( ! fill . IsVisible ( ) && ! ( stroke . IsVisible ( ) || thickness <= 0 ) || polygons . Count == 0 )
277+ if ( ( ! fill . IsVisible ( ) && ! ( stroke . IsVisible ( ) || thickness <= 0 ) ) || polygons . Count == 0 )
280278 {
281279 return ;
282280 }
@@ -333,7 +331,7 @@ public void DrawRectangle(OxyRect rectangle, OxyColor fill, OxyColor stroke, dou
333331 /// <inheritdoc/>
334332 public void DrawRectangles ( IList < OxyRect > rectangles , OxyColor fill , OxyColor stroke , double thickness , EdgeRenderingMode edgeRenderingMode )
335333 {
336- if ( ! fill . IsVisible ( ) && ! ( stroke . IsVisible ( ) || thickness <= 0 ) || rectangles . Count == 0 )
334+ if ( ( ! fill . IsVisible ( ) && ! ( stroke . IsVisible ( ) || thickness <= 0 ) ) || rectangles . Count == 0 )
337335 {
338336 return ;
339337 }
@@ -381,7 +379,7 @@ public void DrawText(
381379 var x = this . Convert ( p . X ) ;
382380 var y = this . Convert ( p . Y ) ;
383381
384- using var _ = new SKAutoCanvasRestore ( this . SkCanvas ) ;
382+ using var canvasRestore = new SKAutoCanvasRestore ( this . SkCanvas ) ;
385383 this . SkCanvas . Translate ( x , y ) ;
386384 this . SkCanvas . RotateDegrees ( ( float ) rotation ) ;
387385
@@ -398,7 +396,7 @@ public void DrawText(
398396 HorizontalAlignment . Left => SKTextAlign . Left ,
399397 HorizontalAlignment . Center => SKTextAlign . Center ,
400398 HorizontalAlignment . Right => SKTextAlign . Right ,
401- _ => throw new ArgumentOutOfRangeException ( nameof ( horizontalAlignment ) )
399+ _ => throw new ArgumentOutOfRangeException ( nameof ( horizontalAlignment ) ) ,
402400 } ;
403401 }
404402
@@ -455,7 +453,7 @@ public void SetToolTip(string text)
455453 /// <inheritdoc/>
456454 public FontMetrics GetFontMetrics ( string fontFamily , double fontSize , double fontWeight )
457455 {
458- var lineSpacing = paint . GetFontMetrics ( out var metrics ) ;
456+ var lineSpacing = this . paint . GetFontMetrics ( out var metrics ) ;
459457 var ascender = this . ConvertBack ( Math . Abs ( metrics . Ascent ) ) ;
460458 var descender = this . ConvertBack ( Math . Abs ( metrics . Descent ) ) ;
461459 var leading = this . ConvertBack ( Math . Abs ( metrics . Leading ) ) ;
@@ -791,7 +789,7 @@ private SKPaint GetLinePaint(OxyColor strokeColor, double strokeThickness, EdgeR
791789 LineJoin . Miter => SKStrokeJoin . Miter ,
792790 LineJoin . Round => SKStrokeJoin . Round ,
793791 LineJoin . Bevel => SKStrokeJoin . Bevel ,
794- _ => throw new ArgumentOutOfRangeException ( nameof ( lineJoin ) )
792+ _ => throw new ArgumentOutOfRangeException ( nameof ( lineJoin ) ) ,
795793 } ;
796794
797795 return paint ;
@@ -952,12 +950,12 @@ public FontDescriptor(string fontFamily, double fontWeight)
952950 }
953951
954952 /// <summary>
955- /// The font family.
953+ /// Gets the font family.
956954 /// </summary>
957955 public string FontFamily { get ; }
958956
959957 /// <summary>
960- /// The font weight.
958+ /// Gets the font weight.
961959 /// </summary>
962960 public double FontWeight { get ; }
963961
@@ -971,8 +969,8 @@ public override bool Equals(object obj)
971969 public override int GetHashCode ( )
972970 {
973971 var hashCode = - 1030903623 ;
974- hashCode = hashCode * - 1521134295 + EqualityComparer < string > . Default . GetHashCode ( this . FontFamily ) ;
975- hashCode = hashCode * - 1521134295 + this . FontWeight . GetHashCode ( ) ;
972+ hashCode = ( hashCode * - 1521134295 ) + EqualityComparer < string > . Default . GetHashCode ( this . FontFamily ) ;
973+ hashCode = ( hashCode * - 1521134295 ) + this . FontWeight . GetHashCode ( ) ;
976974 return hashCode ;
977975 }
978976 }
0 commit comments