Skip to content

Commit 636b27e

Browse files
SimonCroppJimBobSquarePants
authored andcommitted
Cleanup (SixLabors#965)
* redundant () * redundant stirng interpolation * use method groups * redundant unsafe * redundant qualifiers * redundant () * redundant init * redundant init * redundant casts * redundant casts
1 parent 08644cf commit 636b27e

File tree

8 files changed

+27
-26
lines changed

8 files changed

+27
-26
lines changed

src/ImageSharp.Drawing/Processing/Processors/Drawing/FillRegionProcessor{TPixel}.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle source
9494
}
9595

9696
float yPlusOne = y + 1;
97-
for (float subPixel = (float)y; subPixel < yPlusOne; subPixel += subpixelFraction)
97+
for (float subPixel = y; subPixel < yPlusOne; subPixel += subpixelFraction)
9898
{
9999
int pointsFound = region.Scan(subPixel + offset, buffer, configuration);
100100
if (pointsFound == 0)
@@ -192,4 +192,4 @@ private bool IsSolidBrushWithoutBlending(out SolidBrush solidBrush)
192192
return this.definition.Options.IsOpaqueColorWithoutBlending(solidBrush.Color);
193193
}
194194
}
195-
}
195+
}

src/ImageSharp.Drawing/Processing/Processors/Text/DrawTextProcessor{TPixel}.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,21 +135,22 @@ private class CachingGlyphRenderer : IGlyphRenderer, IDisposable
135135

136136
private readonly PathBuilder builder;
137137

138-
private Point currentRenderPosition = default;
139-
private (GlyphRendererParameters glyph, PointF subPixelOffset) currentGlyphRenderParams = default;
140-
private readonly int offset = 0;
141-
private PointF currentPoint = default(PointF);
138+
private Point currentRenderPosition;
139+
private (GlyphRendererParameters glyph, PointF subPixelOffset) currentGlyphRenderParams;
140+
private readonly int offset;
141+
private PointF currentPoint;
142142

143143
private readonly Dictionary<(GlyphRendererParameters glyph, PointF subPixelOffset), GlyphRenderData>
144144
glyphData = new Dictionary<(GlyphRendererParameters glyph, PointF subPixelOffset), GlyphRenderData>();
145145

146-
private readonly bool renderOutline = false;
147-
private readonly bool renderFill = false;
148-
private bool rasterizationRequired = false;
146+
private readonly bool renderOutline;
147+
private readonly bool renderFill;
148+
private bool rasterizationRequired;
149149

150150
public CachingGlyphRenderer(MemoryAllocator memoryAllocator, int size, IPen pen, bool renderFill)
151151
{
152152
this.MemoryAllocator = memoryAllocator;
153+
this.currentRenderPosition = default;
153154
this.Pen = pen;
154155
this.renderFill = renderFill;
155156
this.renderOutline = pen != null;
@@ -326,7 +327,7 @@ private Buffer2D<float> Render(IPath path)
326327
bool scanlineDirty = false;
327328
float yPlusOne = y + 1;
328329

329-
for (float subPixel = (float)y; subPixel < yPlusOne; subPixel += subpixelFraction)
330+
for (float subPixel = y; subPixel < yPlusOne; subPixel += subpixelFraction)
330331
{
331332
var start = new PointF(path.Bounds.Left - 1, subPixel);
332333
var end = new PointF(path.Bounds.Right + 1, subPixel);

tests/ImageSharp.Tests/Drawing/FillSolidBrushTests.cs

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

44
using System;
@@ -111,7 +111,7 @@ public void FillRegion_WorksOnWrappedMemoryImage<TPixel>(
111111
}
112112

113113
public static readonly TheoryData<bool, string, float, PixelColorBlendingMode, float> BlendData =
114-
new TheoryData<bool, string, float, PixelColorBlendingMode, float>()
114+
new TheoryData<bool, string, float, PixelColorBlendingMode, float>
115115
{
116116
{ false, "Blue", 0.5f, PixelColorBlendingMode.Normal, 1.0f },
117117
{ false, "Blue", 1.0f, PixelColorBlendingMode.Normal, 0.5f },
@@ -196,4 +196,4 @@ public void BlendFillColorOverBackground<TPixel>(
196196
}
197197
}
198198
}
199-
}
199+
}

tests/ImageSharp.Tests/Drawing/Paths/ShapeRegionTests.cs

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

44
using SixLabors.ImageSharp.Primitives;
@@ -56,7 +56,7 @@ public int FindIntersections(PointF s, PointF e, Span<PointF> buffer)
5656

5757
public ShapeRegionTests()
5858
{
59-
this.pathMock = new Mock<MockPath>() { CallBase = true };
59+
this.pathMock = new Mock<MockPath> { CallBase = true };
6060

6161
this.bounds = new RectangleF(10.5f, 10, 10, 10);
6262
this.pathMock.Setup(x => x.Bounds).Returns(this.bounds);
@@ -124,4 +124,4 @@ public void ShapeRegionFromShapeMaxIntersectionsProxyToShape()
124124
this.pathMock.Verify(x => x.MaxIntersections);
125125
}
126126
}
127-
}
127+
}

tests/ImageSharp.Tests/Drawing/Utils/QuickSortTests.cs

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

44
namespace SixLabors.ImageSharp.Tests.Drawing.Utils
@@ -12,7 +12,7 @@ namespace SixLabors.ImageSharp.Tests.Drawing.Utils
1212

1313
public class QuickSortTests
1414
{
15-
public static readonly TheoryData<float[]> Data = new TheoryData<float[]>()
15+
public static readonly TheoryData<float[]> Data = new TheoryData<float[]>
1616
{
1717
new float[]{ 3, 2, 1 },
1818
new float[0],
@@ -48,4 +48,4 @@ public void SortSlice()
4848
Assert.Equal(actual, expected);
4949
}
5050
}
51-
}
51+
}

tests/ImageSharp.Tests/FakeImageOperationsProvider.cs

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

44
using System.Collections.Generic;
@@ -69,7 +69,7 @@ public Size GetCurrentSize()
6969

7070
public IImageProcessingContext ApplyProcessor(IImageProcessor processor, Rectangle rectangle)
7171
{
72-
this.Applied.Add(new AppliedOperation()
72+
this.Applied.Add(new AppliedOperation
7373
{
7474
Rectangle = rectangle,
7575
NonGenericProcessor = processor
@@ -79,7 +79,7 @@ public IImageProcessingContext ApplyProcessor(IImageProcessor processor, Rectang
7979

8080
public IImageProcessingContext ApplyProcessor(IImageProcessor processor)
8181
{
82-
this.Applied.Add(new AppliedOperation()
82+
this.Applied.Add(new AppliedOperation
8383
{
8484
NonGenericProcessor = processor
8585
});
@@ -90,7 +90,7 @@ public struct AppliedOperation
9090
{
9191
public Rectangle? Rectangle { get; set; }
9292
public IImageProcessor<TPixel> GenericProcessor { get; set; }
93-
93+
9494
public IImageProcessor NonGenericProcessor { get; set; }
9595
}
9696
}

tests/ImageSharp.Tests/ImageOperationTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public ImageOperationTests()
3030
Mock<IImageProcessor> processorMock = new Mock<IImageProcessor>();
3131
this.processorDefinition = processorMock.Object;
3232

33-
this.image = new Image<Rgba32>(new Configuration()
33+
this.image = new Image<Rgba32>(new Configuration
3434
{
3535
ImageOperationsProvider = this.provider
3636
}, 1, 1);

tests/ImageSharp.Tests/TestFont.cs

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

44
using System.Collections.Generic;
@@ -54,7 +54,7 @@ private static string GetFontsDirectory()
5454

5555
AddFormatsDirectoryFromTestAssemblyPath(directories);
5656

57-
string directory = directories.FirstOrDefault(x => Directory.Exists(x));
57+
string directory = directories.FirstOrDefault(Directory.Exists);
5858

5959
if (directory != null)
6060
{

0 commit comments

Comments
 (0)