Stylecop pass · oxyplot/oxyplot@1927d3d · GitHub
Skip to content

Commit 1927d3d

Browse files
committed
Stylecop pass
1 parent 552c8a0 commit 1927d3d

10 files changed

Lines changed: 155 additions & 149 deletions

File tree

‎Source/OxyPlot.ImageSharp/ImageRenderContext.cs‎

Lines changed: 5 additions & 5 deletions

‎Source/OxyPlot.ImageSharp/SvgExporter.cs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,15 @@ public class SvgExporter : OxyPlot.SvgExporter, IDisposable
2525
/// <summary>
2626
/// Initializes a new instance of the <see cref="SvgExporter" /> class.
2727
/// </summary>
28+
/// <param name="width">The width.</param>
29+
/// <param name="height">The height.</param>
30+
/// <param name="resolution">The resolution in dots per inch.</param>
2831
public SvgExporter(double width, double height, double resolution = 96)
2932
{
3033
this.Width = width;
3134
this.Height = height;
3235
this.irc = new ImageRenderContext(1, 1, OxyColors.Undefined, resolution);
33-
this.TextMeasurer = irc;
36+
this.TextMeasurer = this.irc;
3437
}
3538

3639
/// <summary>

‎Source/OxyPlot.SkiaSharp/SkiaRenderContext.cs‎

Lines changed: 15 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66

77
namespace 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
}

‎Source/OxyPlot.WindowsForms/GraphicsRenderContext.cs‎

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,6 @@ namespace OxyPlot.WindowsForms
3030
/// </summary>
3131
public class GraphicsRenderContext : RenderContextBase, IDisposable, ITextMeasurer
3232
{
33-
/// <summary>
34-
/// Gets or sets the <see cref="TextArranger"/> for this instance.
35-
/// </summary>
36-
public TextArranger TextArranger { get; set; }
37-
3833
/// <summary>
3934
/// The font size factor.
4035
/// </summary>
@@ -87,6 +82,11 @@ public GraphicsRenderContext(Graphics graphics = null)
8782
this.TextArranger = new TextArranger(this);
8883
}
8984

85+
/// <summary>
86+
/// Gets or sets the <see cref="TextArranger"/> for this instance.
87+
/// </summary>
88+
public TextArranger TextArranger { get; set; }
89+
9090
/// <summary>
9191
/// Sets the graphics target.
9292
/// </summary>
@@ -113,7 +113,7 @@ public override void DrawEllipse(OxyRect rect, OxyColor fill, OxyColor stroke, d
113113
{
114114
return;
115115
}
116-
116+
117117
var pen = this.GetCachedPen(stroke, thickness);
118118
this.g.DrawEllipse(pen, (float)rect.Left, (float)rect.Top, (float)rect.Width, (float)rect.Height);
119119
}
@@ -231,7 +231,6 @@ public override void DrawText(
231231

232232
this.g.TranslateTransform((float)p.X, (float)p.Y);
233233

234-
//var layoutRectangle = new RectangleF(0, 0, size.Width, size.Height);
235234
if (Math.Abs(rotation) > double.Epsilon)
236235
{
237236
this.g.RotateTransform((float)rotation);

‎Source/OxyPlot.WindowsForms/OxyPlot.WindowsForms.csproj‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<ProjectReference Include="..\OxyPlot\OxyPlot.csproj" />
2121
</ItemGroup>
2222
<ItemGroup>
23-
<None Include="..\..\Icons\OxyPlot_128.png" Pack="true" PackagePath="\"/>
23+
<None Include="..\..\Icons\OxyPlot_128.png" Pack="true" PackagePath="\" />
2424
</ItemGroup>
2525
<ItemGroup>
2626
<None Include="OxyPlot.WindowsForms.snk" />

‎Source/OxyPlot.Wpf/OxyPlot.Wpf.csproj‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,13 @@
2727
<Reference Include="System.Printing" />
2828
</ItemGroup>
2929
<ItemGroup>
30-
<ProjectReference Include="..\OxyPlot.Wpf.Shared\OxyPlot.Wpf.Shared.csproj"/>
31-
<ProjectReference Include="..\OxyPlot\OxyPlot.csproj"/>
30+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164">
31+
<PrivateAssets>all</PrivateAssets>
32+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
33+
</PackageReference>
34+
</ItemGroup>
35+
<ItemGroup>
36+
<ProjectReference Include="..\OxyPlot.Wpf.Shared\OxyPlot.Wpf.Shared.csproj" />
37+
<ProjectReference Include="..\OxyPlot\OxyPlot.csproj" />
3238
</ItemGroup>
3339
</Project>

‎Source/OxyPlot/Pdf/PdfRenderContext.cs‎

Lines changed: 6 additions & 6 deletions

0 commit comments

Comments
 (0)