Skip to content

Commit 3730a02

Browse files
committed
Fix build after merge
1 parent 6619809 commit 3730a02

File tree

5 files changed

+32
-22
lines changed

5 files changed

+32
-22
lines changed

src/ImageSharp/Formats/Pbm/BinaryDecoder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ private static void ProcessGrayscale<TPixel>(Configuration configuration, Buffer
7373
for (int y = 0; y < height; y++)
7474
{
7575
stream.Read(rowSpan);
76-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
76+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
7777
PixelOperations<TPixel>.Instance.FromL8Bytes(
7878
configuration,
7979
rowSpan,
@@ -95,7 +95,7 @@ private static void ProcessWideGrayscale<TPixel>(Configuration configuration, Bu
9595
for (int y = 0; y < height; y++)
9696
{
9797
stream.Read(rowSpan);
98-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
98+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
9999
PixelOperations<TPixel>.Instance.FromL16Bytes(
100100
configuration,
101101
rowSpan,
@@ -117,7 +117,7 @@ private static void ProcessRgb<TPixel>(Configuration configuration, Buffer2D<TPi
117117
for (int y = 0; y < height; y++)
118118
{
119119
stream.Read(rowSpan);
120-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
120+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
121121
PixelOperations<TPixel>.Instance.FromRgb24Bytes(
122122
configuration,
123123
rowSpan,
@@ -139,7 +139,7 @@ private static void ProcessWideRgb<TPixel>(Configuration configuration, Buffer2D
139139
for (int y = 0; y < height; y++)
140140
{
141141
stream.Read(rowSpan);
142-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
142+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
143143
PixelOperations<TPixel>.Instance.FromRgb48Bytes(
144144
configuration,
145145
rowSpan,
@@ -183,7 +183,7 @@ private static void ProcessBlackAndWhite<TPixel>(Configuration configuration, Bu
183183
}
184184
}
185185

186-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
186+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
187187
PixelOperations<TPixel>.Instance.FromL8(
188188
configuration,
189189
rowSpan,

src/ImageSharp/Formats/Pbm/BinaryEncoder.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,14 @@ private static void WriteGrayscale<TPixel>(Configuration configuration, Stream s
6262
{
6363
int width = image.Width;
6464
int height = image.Height;
65+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
6566
MemoryAllocator allocator = configuration.MemoryAllocator;
6667
using IMemoryOwner<byte> row = allocator.Allocate<byte>(width);
6768
Span<byte> rowSpan = row.GetSpan();
6869

6970
for (int y = 0; y < height; y++)
7071
{
71-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
72+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
7273

7374
PixelOperations<TPixel>.Instance.ToL8Bytes(
7475
configuration,
@@ -86,13 +87,14 @@ private static void WriteWideGrayscale<TPixel>(Configuration configuration, Stre
8687
const int bytesPerPixel = 2;
8788
int width = image.Width;
8889
int height = image.Height;
90+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
8991
MemoryAllocator allocator = configuration.MemoryAllocator;
9092
using IMemoryOwner<byte> row = allocator.Allocate<byte>(width * bytesPerPixel);
9193
Span<byte> rowSpan = row.GetSpan();
9294

9395
for (int y = 0; y < height; y++)
9496
{
95-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
97+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
9698

9799
PixelOperations<TPixel>.Instance.ToL16Bytes(
98100
configuration,
@@ -110,13 +112,14 @@ private static void WriteRgb<TPixel>(Configuration configuration, Stream stream,
110112
const int bytesPerPixel = 3;
111113
int width = image.Width;
112114
int height = image.Height;
115+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
113116
MemoryAllocator allocator = configuration.MemoryAllocator;
114117
using IMemoryOwner<byte> row = allocator.Allocate<byte>(width * bytesPerPixel);
115118
Span<byte> rowSpan = row.GetSpan();
116119

117120
for (int y = 0; y < height; y++)
118121
{
119-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
122+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
120123

121124
PixelOperations<TPixel>.Instance.ToRgb24Bytes(
122125
configuration,
@@ -134,13 +137,14 @@ private static void WriteWideRgb<TPixel>(Configuration configuration, Stream str
134137
const int bytesPerPixel = 6;
135138
int width = image.Width;
136139
int height = image.Height;
140+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
137141
MemoryAllocator allocator = configuration.MemoryAllocator;
138142
using IMemoryOwner<byte> row = allocator.Allocate<byte>(width * bytesPerPixel);
139143
Span<byte> rowSpan = row.GetSpan();
140144

141145
for (int y = 0; y < height; y++)
142146
{
143-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
147+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
144148

145149
PixelOperations<TPixel>.Instance.ToRgb48Bytes(
146150
configuration,
@@ -157,6 +161,7 @@ private static void WriteBlackAndWhite<TPixel>(Configuration configuration, Stre
157161
{
158162
int width = image.Width;
159163
int height = image.Height;
164+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
160165
MemoryAllocator allocator = configuration.MemoryAllocator;
161166
using IMemoryOwner<L8> row = allocator.Allocate<L8>(width);
162167
Span<L8> rowSpan = row.GetSpan();
@@ -165,7 +170,7 @@ private static void WriteBlackAndWhite<TPixel>(Configuration configuration, Stre
165170
int startBit = 0;
166171
for (int y = 0; y < height; y++)
167172
{
168-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
173+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
169174

170175
PixelOperations<TPixel>.Instance.ToL8(
171176
configuration,

src/ImageSharp/Formats/Pbm/PlainDecoder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private static void ProcessGrayscale<TPixel>(Configuration configuration, Buffer
7575
rowSpan[x] = new L8(value);
7676
}
7777

78-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
78+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
7979
PixelOperations<TPixel>.Instance.FromL8(
8080
configuration,
8181
rowSpan,
@@ -101,7 +101,7 @@ private static void ProcessWideGrayscale<TPixel>(Configuration configuration, Bu
101101
rowSpan[x] = new L16(value);
102102
}
103103

104-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
104+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
105105
PixelOperations<TPixel>.Instance.FromL16(
106106
configuration,
107107
rowSpan,
@@ -131,7 +131,7 @@ private static void ProcessRgb<TPixel>(Configuration configuration, Buffer2D<TPi
131131
rowSpan[x] = new Rgb24(red, green, blue);
132132
}
133133

134-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
134+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
135135
PixelOperations<TPixel>.Instance.FromRgb24(
136136
configuration,
137137
rowSpan,
@@ -161,7 +161,7 @@ private static void ProcessWideRgb<TPixel>(Configuration configuration, Buffer2D
161161
rowSpan[x] = new Rgb48(red, green, blue);
162162
}
163163

164-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
164+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
165165
PixelOperations<TPixel>.Instance.FromRgb48(
166166
configuration,
167167
rowSpan,
@@ -187,7 +187,7 @@ private static void ProcessBlackAndWhite<TPixel>(Configuration configuration, Bu
187187
rowSpan[x] = value == 0 ? White : Black;
188188
}
189189

190-
Span<TPixel> pixelSpan = pixels.GetRowSpan(y);
190+
Span<TPixel> pixelSpan = pixels.DangerousGetRowSpan(y);
191191
PixelOperations<TPixel>.Instance.FromL8(
192192
configuration,
193193
rowSpan,

src/ImageSharp/Formats/Pbm/PlainEncoder.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ private static void WriteGrayscale<TPixel>(Configuration configuration, Stream s
7676
{
7777
int width = image.Width;
7878
int height = image.Height;
79+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
7980
MemoryAllocator allocator = configuration.MemoryAllocator;
8081
using IMemoryOwner<L8> row = allocator.Allocate<L8>(width);
8182
Span<L8> rowSpan = row.GetSpan();
@@ -84,7 +85,7 @@ private static void WriteGrayscale<TPixel>(Configuration configuration, Stream s
8485

8586
for (int y = 0; y < height; y++)
8687
{
87-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
88+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
8889
PixelOperations<TPixel>.Instance.ToL8(
8990
configuration,
9091
pixelSpan,
@@ -108,6 +109,7 @@ private static void WriteWideGrayscale<TPixel>(Configuration configuration, Stre
108109
{
109110
int width = image.Width;
110111
int height = image.Height;
112+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
111113
MemoryAllocator allocator = configuration.MemoryAllocator;
112114
using IMemoryOwner<L16> row = allocator.Allocate<L16>(width);
113115
Span<L16> rowSpan = row.GetSpan();
@@ -116,7 +118,7 @@ private static void WriteWideGrayscale<TPixel>(Configuration configuration, Stre
116118

117119
for (int y = 0; y < height; y++)
118120
{
119-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
121+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
120122
PixelOperations<TPixel>.Instance.ToL16(
121123
configuration,
122124
pixelSpan,
@@ -140,6 +142,7 @@ private static void WriteRgb<TPixel>(Configuration configuration, Stream stream,
140142
{
141143
int width = image.Width;
142144
int height = image.Height;
145+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
143146
MemoryAllocator allocator = configuration.MemoryAllocator;
144147
using IMemoryOwner<Rgb24> row = allocator.Allocate<Rgb24>(width);
145148
Span<Rgb24> rowSpan = row.GetSpan();
@@ -148,7 +151,7 @@ private static void WriteRgb<TPixel>(Configuration configuration, Stream stream,
148151

149152
for (int y = 0; y < height; y++)
150153
{
151-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
154+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
152155
PixelOperations<TPixel>.Instance.ToRgb24(
153156
configuration,
154157
pixelSpan,
@@ -178,6 +181,7 @@ private static void WriteWideRgb<TPixel>(Configuration configuration, Stream str
178181
{
179182
int width = image.Width;
180183
int height = image.Height;
184+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
181185
MemoryAllocator allocator = configuration.MemoryAllocator;
182186
using IMemoryOwner<Rgb48> row = allocator.Allocate<Rgb48>(width);
183187
Span<Rgb48> rowSpan = row.GetSpan();
@@ -186,7 +190,7 @@ private static void WriteWideRgb<TPixel>(Configuration configuration, Stream str
186190

187191
for (int y = 0; y < height; y++)
188192
{
189-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
193+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
190194
PixelOperations<TPixel>.Instance.ToRgb48(
191195
configuration,
192196
pixelSpan,
@@ -216,6 +220,7 @@ private static void WriteBlackAndWhite<TPixel>(Configuration configuration, Stre
216220
{
217221
int width = image.Width;
218222
int height = image.Height;
223+
Buffer2D<TPixel> pixelBuffer = image.PixelBuffer;
219224
MemoryAllocator allocator = configuration.MemoryAllocator;
220225
using IMemoryOwner<L8> row = allocator.Allocate<L8>(width);
221226
Span<L8> rowSpan = row.GetSpan();
@@ -224,7 +229,7 @@ private static void WriteBlackAndWhite<TPixel>(Configuration configuration, Stre
224229

225230
for (int y = 0; y < height; y++)
226231
{
227-
Span<TPixel> pixelSpan = image.GetPixelRowSpan(y);
232+
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
228233
PixelOperations<TPixel>.Instance.ToL8(
229234
configuration,
230235
pixelSpan,

tests/ImageSharp.Tests/TestUtilities/ImageComparison/ImageComparingUtils.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
using SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison;
99
using Xunit;
1010

11-
namespace SixLabors.ImageSharp.Tests.Formats.Tga
11+
namespace SixLabors.ImageSharp.Tests.TestUtilities.ImageComparison
1212
{
13-
public static class TgaTestUtils
13+
public static class ImageComparingUtils
1414
{
1515
public static void CompareWithReferenceDecoder<TPixel>(
1616
TestImageProvider<TPixel> provider,

0 commit comments

Comments
 (0)