Skip to content

Commit 6f91008

Browse files
committed
Fix warnings
1 parent 267b3ba commit 6f91008

62 files changed

Lines changed: 201 additions & 271 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ indent_style = tab
7575

7676
[*.{cs,csx,cake,vb,vbx}]
7777
# Default Severity for all .NET Code Style rules below
78-
dotnet_analyzer_diagnostic.severity = warning
78+
dotnet_analyzer_diagnostic.category-style.severity = warning
7979

8080
##########################################
8181
# Language Rules

src/ImageSharp.Drawing/Common/Extensions/GraphicsOptionsExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the Apache License, Version 2.0.
33

44
using System.Numerics;
5-
using SixLabors.ImageSharp.Drawing.Processing;
65
using SixLabors.ImageSharp.PixelFormats;
76

87
namespace SixLabors.ImageSharp.Drawing

src/ImageSharp.Drawing/Processing/Brushes.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors.
1+
// Copyright (c) Six Labors.
22
// Licensed under the Apache License, Version 2.0.
33

44
namespace SixLabors.ImageSharp.Drawing.Processing
@@ -219,4 +219,4 @@ public static PatternBrush BackwardDiagonal(Color foreColor) =>
219219
public static PatternBrush BackwardDiagonal(Color foreColor, Color backColor) =>
220220
new PatternBrush(foreColor, backColor, BackwardDiagonalPattern);
221221
}
222-
}
222+
}

src/ImageSharp.Drawing/Processing/ColorStop.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors.
1+
// Copyright (c) Six Labors.
22
// Licensed under the Apache License, Version 2.0.
33

44
using System.Diagnostics;
@@ -32,4 +32,4 @@ public ColorStop(float ratio, in Color color)
3232
/// </summary>
3333
public Color Color { get; }
3434
}
35-
}
35+
}

src/ImageSharp.Drawing/Processing/DrawingOptions.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
// Copyright (c) Six Labors.
22
// Licensed under the Apache License, Version 2.0.
33

4-
using System;
54
using System.Numerics;
6-
using SixLabors.ImageSharp.PixelFormats;
7-
using SixLabors.ImageSharp.Processing;
85

96
namespace SixLabors.ImageSharp.Drawing.Processing
107
{

src/ImageSharp.Drawing/Processing/GradientBrush.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;
5-
using System.Buffers;
65
using System.Numerics;
7-
using System.Threading;
86
using SixLabors.ImageSharp.Drawing.Utilities;
97
using SixLabors.ImageSharp.Memory;
108
using SixLabors.ImageSharp.PixelFormats;
@@ -197,7 +195,7 @@ protected override void Dispose(bool disposing)
197195
this.isDisposed = true;
198196
}
199197

200-
private (ColorStop from, ColorStop to) GetGradientSegment(float positionOnCompleteGradient)
198+
private (ColorStop From, ColorStop To) GetGradientSegment(float positionOnCompleteGradient)
201199
{
202200
ColorStop localGradientFrom = this.colorStops[0];
203201
ColorStop localGradientTo = default;

src/ImageSharp.Drawing/Processing/GradientRepetitionMode.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors.
1+
// Copyright (c) Six Labors.
22
// Licensed under the Apache License, Version 2.0.
33

44
namespace SixLabors.ImageSharp.Drawing.Processing
@@ -34,4 +34,4 @@ public enum GradientRepetitionMode
3434
/// </summary>
3535
DontFill
3636
}
37-
}
37+
}

src/ImageSharp.Drawing/Processing/IPen.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Six Labors.
1+
// Copyright (c) Six Labors.
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;
@@ -25,4 +25,4 @@ public interface IPen
2525
/// </summary>
2626
ReadOnlySpan<float> StrokePattern { get; }
2727
}
28-
}
28+
}

src/ImageSharp.Drawing/Processing/LinearGradientBrush.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;
5-
65
using SixLabors.ImageSharp.PixelFormats;
76

87
namespace SixLabors.ImageSharp.Drawing.Processing

src/ImageSharp.Drawing/Processing/PathGradientBrush.cs

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,10 @@
22
// Licensed under the Apache License, Version 2.0.
33

44
using System;
5-
using System.Buffers;
65
using System.Collections.Generic;
76
using System.Linq;
87
using System.Numerics;
9-
using System.Threading;
108
using SixLabors.ImageSharp.Drawing.Utilities;
11-
using SixLabors.ImageSharp.Memory;
129
using SixLabors.ImageSharp.PixelFormats;
1310

1411
namespace SixLabors.ImageSharp.Drawing.Processing
@@ -114,7 +111,7 @@ private static Color CalculateCenterColor(Color[] colors)
114111

115112
private static float DistanceBetween(PointF p1, PointF p2) => ((Vector2)(p2 - p1)).Length();
116113

117-
private struct Intersection
114+
private readonly struct Intersection
118115
{
119116
public Intersection(PointF point, float distance)
120117
{
@@ -189,7 +186,7 @@ private sealed class PathGradientBrushApplicator<TPixel> : BrushApplicator<TPixe
189186

190187
private readonly TPixel transparentPixel;
191188

192-
private ThreadLocalBlenderBuffers<TPixel> blenderBuffers;
189+
private readonly ThreadLocalBlenderBuffers<TPixel> blenderBuffers;
193190

194191
private bool isDisposed;
195192

@@ -218,7 +215,7 @@ public PathGradientBrushApplicator(
218215
this.centerColor = (Vector4)centerColor;
219216
this.hasSpecialCenterColor = hasSpecialCenterColor;
220217
this.centerPixel = centerColor.ToPixel<TPixel>();
221-
this.maxDistance = points.Select(p => (Vector2)(p - this.center)).Max(d => d.Length());
218+
this.maxDistance = points.Select(p => p - this.center).Max(d => d.Length());
222219
this.transparentPixel = Color.Transparent.ToPixel<TPixel>();
223220
this.blenderBuffers = new ThreadLocalBlenderBuffers<TPixel>(configuration.MemoryAllocator, source.Width);
224221
}
@@ -259,15 +256,15 @@ public PathGradientBrushApplicator(
259256
var direction = Vector2.Normalize(point - this.center);
260257
Vector2 end = point + (direction * this.maxDistance);
261258

262-
(Edge edge, Vector2 point)? isc = this.FindIntersection(point, end);
259+
(Edge Edge, Vector2 Point)? isc = this.FindIntersection(point, end);
263260

264261
if (!isc.HasValue)
265262
{
266263
return this.transparentPixel;
267264
}
268265

269-
Vector2 intersection = isc.Value.point;
270-
Vector4 edgeColor = isc.Value.edge.ColorAt(intersection);
266+
Vector2 intersection = isc.Value.Point;
267+
Vector4 edgeColor = isc.Value.Edge.ColorAt(intersection);
271268

272269
float length = DistanceBetween(intersection, this.center);
273270
float ratio = length > 0 ? DistanceBetween(intersection, point) / length : 0;
@@ -327,7 +324,7 @@ protected override void Dispose(bool disposing)
327324
this.isDisposed = true;
328325
}
329326

330-
private (Edge edge, Vector2 point)? FindIntersection(
327+
private (Edge Edge, Vector2 Point)? FindIntersection(
331328
PointF start,
332329
PointF end)
333330
{
@@ -350,7 +347,7 @@ protected override void Dispose(bool disposing)
350347
}
351348
}
352349

353-
return closestEdge != null ? (closestEdge, closestIntersection) : ((Edge edge, Vector2 point)?)null;
350+
return closestEdge != null ? (closestEdge, closestIntersection) : ((Edge Edge, Vector2 Point)?)null;
354351
}
355352

356353
private static bool FindPointOnTriangle(Vector2 v1, Vector2 v2, Vector2 v3, Vector2 point, out float u, out float v)

0 commit comments

Comments
 (0)