Skip to content

Commit 1c6283e

Browse files
committed
RENAME: MemoryManager -> MemoryAllocator
1 parent 07e9867 commit 1c6283e

File tree

10 files changed

+28
-28
lines changed

10 files changed

+28
-28
lines changed

src/ImageSharp.Drawing/Primitives/ShapeRegion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public override int Scan(float y, Span<float> buffer, Configuration configuratio
4545
var start = new PointF(this.Bounds.Left - 1, y);
4646
var end = new PointF(this.Bounds.Right + 1, y);
4747

48-
using (IBuffer<PointF> tempBuffer = configuration.MemoryManager.Allocate<PointF>(buffer.Length))
48+
using (IBuffer<PointF> tempBuffer = configuration.MemoryAllocator.Allocate<PointF>(buffer.Length))
4949
{
5050
Span<PointF> innerBuffer = tempBuffer.GetSpan();
5151
int count = this.Shape.FindIntersections(start, end, innerBuffer);

src/ImageSharp.Drawing/Processing/Drawing/Brushes/BrushApplicator.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ internal BrushApplicator(ImageFrame<TPixel> target, GraphicsOptions options)
6565
/// <remarks>scanlineBuffer will be > scanlineWidth but provide and offset in case we want to share a larger buffer across runs.</remarks>
6666
internal virtual void Apply(Span<float> scanline, int x, int y)
6767
{
68-
MemoryManager memoryManager = this.Target.MemoryManager;
68+
MemoryAllocator memoryAllocator = this.Target.MemoryAllocator;
6969

70-
using (IBuffer<float> amountBuffer = memoryManager.Allocate<float>(scanline.Length))
71-
using (IBuffer<TPixel> overlay = memoryManager.Allocate<TPixel>(scanline.Length))
70+
using (IBuffer<float> amountBuffer = memoryAllocator.Allocate<float>(scanline.Length))
71+
using (IBuffer<TPixel> overlay = memoryAllocator.Allocate<TPixel>(scanline.Length))
7272
{
7373
Span<float> amountSpan = amountBuffer.GetSpan();
7474
Span<TPixel> overlaySpan = overlay.GetSpan();
@@ -88,7 +88,7 @@ internal virtual void Apply(Span<float> scanline, int x, int y)
8888
}
8989

9090
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
91-
this.Blender.Blend(memoryManager, destinationRow, destinationRow, overlaySpan, amountSpan);
91+
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, overlaySpan, amountSpan);
9292
}
9393
}
9494
}

src/ImageSharp.Drawing/Processing/Drawing/Brushes/ImageBrush{TPixel}.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@ public override void Dispose()
118118
internal override void Apply(Span<float> scanline, int x, int y)
119119
{
120120
// Create a span for colors
121-
using (IBuffer<float> amountBuffer = this.Target.MemoryManager.Allocate<float>(scanline.Length))
122-
using (IBuffer<TPixel> overlay = this.Target.MemoryManager.Allocate<TPixel>(scanline.Length))
121+
using (IBuffer<float> amountBuffer = this.Target.MemoryAllocator.Allocate<float>(scanline.Length))
122+
using (IBuffer<TPixel> overlay = this.Target.MemoryAllocator.Allocate<TPixel>(scanline.Length))
123123
{
124124
Span<float> amountSpan = amountBuffer.GetSpan();
125125
Span<TPixel> overlaySpan = overlay.GetSpan();
@@ -138,7 +138,7 @@ internal override void Apply(Span<float> scanline, int x, int y)
138138
}
139139

140140
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
141-
this.Blender.Blend(this.source.MemoryManager, destinationRow, destinationRow, overlaySpan, amountSpan);
141+
this.Blender.Blend(this.source.MemoryAllocator, destinationRow, destinationRow, overlaySpan, amountSpan);
142142
}
143143
}
144144
}

src/ImageSharp.Drawing/Processing/Drawing/Brushes/PatternBrush{TPixel}.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ public override void Dispose()
151151
internal override void Apply(Span<float> scanline, int x, int y)
152152
{
153153
int patternY = y % this.pattern.Rows;
154-
MemoryManager memoryManager = this.Target.MemoryManager;
154+
MemoryAllocator memoryAllocator = this.Target.MemoryAllocator;
155155

156-
using (IBuffer<float> amountBuffer = memoryManager.Allocate<float>(scanline.Length))
157-
using (IBuffer<TPixel> overlay = memoryManager.Allocate<TPixel>(scanline.Length))
156+
using (IBuffer<float> amountBuffer = memoryAllocator.Allocate<float>(scanline.Length))
157+
using (IBuffer<TPixel> overlay = memoryAllocator.Allocate<TPixel>(scanline.Length))
158158
{
159159
Span<float> amountSpan = amountBuffer.GetSpan();
160160
Span<TPixel> overlaySpan = overlay.GetSpan();
@@ -168,7 +168,7 @@ internal override void Apply(Span<float> scanline, int x, int y)
168168
}
169169

170170
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
171-
this.Blender.Blend(memoryManager, destinationRow, destinationRow, overlaySpan, amountSpan);
171+
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, overlaySpan, amountSpan);
172172
}
173173
}
174174
}

src/ImageSharp.Drawing/Processing/Drawing/Brushes/RecolorBrush{TPixel}.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ public override void Dispose()
136136
/// <inheritdoc />
137137
internal override void Apply(Span<float> scanline, int x, int y)
138138
{
139-
MemoryManager memoryManager = this.Target.MemoryManager;
139+
MemoryAllocator memoryAllocator = this.Target.MemoryAllocator;
140140

141-
using (IBuffer<float> amountBuffer = memoryManager.Allocate<float>(scanline.Length))
142-
using (IBuffer<TPixel> overlay = memoryManager.Allocate<TPixel>(scanline.Length))
141+
using (IBuffer<float> amountBuffer = memoryAllocator.Allocate<float>(scanline.Length))
142+
using (IBuffer<TPixel> overlay = memoryAllocator.Allocate<TPixel>(scanline.Length))
143143
{
144144
Span<float> amountSpan = amountBuffer.GetSpan();
145145
Span<TPixel> overlaySpan = overlay.GetSpan();
@@ -156,7 +156,7 @@ internal override void Apply(Span<float> scanline, int x, int y)
156156
}
157157

158158
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
159-
this.Blender.Blend(memoryManager, destinationRow, destinationRow, overlaySpan, amountSpan);
159+
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, overlaySpan, amountSpan);
160160
}
161161
}
162162
}

src/ImageSharp.Drawing/Processing/Drawing/Brushes/SolidBrush{TPixel}.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ private class SolidBrushApplicator : BrushApplicator<TPixel>
5858
public SolidBrushApplicator(ImageFrame<TPixel> source, TPixel color, GraphicsOptions options)
5959
: base(source, options)
6060
{
61-
this.Colors = source.MemoryManager.Allocate<TPixel>(source.Width);
61+
this.Colors = source.MemoryAllocator.Allocate<TPixel>(source.Width);
6262
this.Colors.GetSpan().Fill(color);
6363
}
6464

@@ -88,15 +88,15 @@ internal override void Apply(Span<float> scanline, int x, int y)
8888
{
8989
Span<TPixel> destinationRow = this.Target.GetPixelRowSpan(y).Slice(x, scanline.Length);
9090

91-
MemoryManager memoryManager = this.Target.MemoryManager;
91+
MemoryAllocator memoryAllocator = this.Target.MemoryAllocator;
9292

9393
if (this.Options.BlendPercentage == 1f)
9494
{
95-
this.Blender.Blend(memoryManager, destinationRow, destinationRow, this.Colors.GetSpan(), scanline);
95+
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, this.Colors.GetSpan(), scanline);
9696
}
9797
else
9898
{
99-
using (IBuffer<float> amountBuffer = memoryManager.Allocate<float>(scanline.Length))
99+
using (IBuffer<float> amountBuffer = memoryAllocator.Allocate<float>(scanline.Length))
100100
{
101101
Span<float> amountSpan = amountBuffer.GetSpan();
102102

@@ -105,7 +105,7 @@ internal override void Apply(Span<float> scanline, int x, int y)
105105
amountSpan[i] = scanline[i] * this.Options.BlendPercentage;
106106
}
107107

108-
this.Blender.Blend(memoryManager, destinationRow, destinationRow, this.Colors.GetSpan(), amountSpan);
108+
this.Blender.Blend(memoryAllocator, destinationRow, destinationRow, this.Colors.GetSpan(), amountSpan);
109109
}
110110
}
111111
}

src/ImageSharp.Drawing/Processing/Drawing/Processors/DrawImageProcessor.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle source
133133

134134
int width = maxX - minX;
135135

136-
MemoryManager memoryManager = this.Image.GetConfiguration().MemoryManager;
136+
MemoryAllocator memoryAllocator = this.Image.GetConfiguration().MemoryAllocator;
137137

138-
using (IBuffer<float> amount = memoryManager.Allocate<float>(width))
138+
using (IBuffer<float> amount = memoryAllocator.Allocate<float>(width))
139139
{
140140
amount.GetSpan().Fill(this.Opacity);
141141

@@ -147,7 +147,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle source
147147
{
148148
Span<TPixel> background = source.GetPixelRowSpan(y).Slice(minX, width);
149149
Span<TPixel> foreground = targetImage.GetPixelRowSpan(y - locationY).Slice(targetX, width);
150-
blender.Blend(memoryManager, background, background, foreground, amount.GetSpan());
150+
blender.Blend(memoryAllocator, background, background, foreground, amount.GetSpan());
151151
});
152152
}
153153
}

src/ImageSharp.Drawing/Processing/Drawing/Processors/FillProcessor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle source
7777
startY = 0;
7878
}
7979

80-
using (IBuffer<float> amount = source.MemoryManager.Allocate<float>(width))
80+
using (IBuffer<float> amount = source.MemoryAllocator.Allocate<float>(width))
8181
using (BrushApplicator<TPixel> applicator = this.brush.CreateApplicator(
8282
source,
8383
sourceRectangle,

src/ImageSharp.Drawing/Processing/Drawing/Processors/FillRegionProcessor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ protected override void OnFrameApply(ImageFrame<TPixel> source, Rectangle source
9696
using (BrushApplicator<TPixel> applicator = this.Brush.CreateApplicator(source, rect, this.Options))
9797
{
9898
int scanlineWidth = maxX - minX;
99-
using (IBuffer<float> bBuffer = source.MemoryManager.Allocate<float>(maxIntersections))
100-
using (IBuffer<float> bScanline = source.MemoryManager.Allocate<float>(scanlineWidth))
99+
using (IBuffer<float> bBuffer = source.MemoryAllocator.Allocate<float>(maxIntersections))
100+
using (IBuffer<float> bScanline = source.MemoryAllocator.Allocate<float>(scanlineWidth))
101101
{
102102
bool scanlineDirty = true;
103103
float subpixelFraction = 1f / subpixelCount;

tests/ImageSharp.Tests/FakeImageOperationsProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public FakeImageOperations(Image<TPixel> source, bool mutate)
5555

5656
public List<AppliedOperation> Applied { get; } = new List<AppliedOperation>();
5757

58-
public MemoryManager MemoryManager => this.Source.GetConfiguration().MemoryManager;
58+
public MemoryAllocator MemoryAllocator => this.Source.GetConfiguration().MemoryAllocator;
5959

6060
public Image<TPixel> Apply()
6161
{

0 commit comments

Comments
 (0)