Skip to content

Commit 4c70682

Browse files
committed
Simplify code
1 parent eab151f commit 4c70682

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

src/ImageSharp/Formats/Pbm/BinaryEncoder.cs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ private static void WriteBlackAndWhite<TPixel>(Configuration configuration, Stre
179179
using IMemoryOwner<L8> row = allocator.Allocate<L8>(width);
180180
Span<L8> rowSpan = row.GetSpan();
181181

182-
int previousValue = 0;
183182
for (int y = 0; y < height; y++)
184183
{
185184
Span<TPixel> pixelSpan = pixelBuffer.DangerousGetRowSpan(y);
@@ -191,7 +190,7 @@ private static void WriteBlackAndWhite<TPixel>(Configuration configuration, Stre
191190

192191
for (int x = 0; x < width;)
193192
{
194-
int value = previousValue;
193+
int value = 0;
195194
int stopBit = Math.Min(8, width - x);
196195
for (int i = 0; i < stopBit; i++)
197196
{
@@ -201,16 +200,9 @@ private static void WriteBlackAndWhite<TPixel>(Configuration configuration, Stre
201200
}
202201

203202
x++;
204-
205-
// End each row on a byte boundary.
206-
if (x == width)
207-
{
208-
break;
209-
}
210203
}
211204

212205
stream.WriteByte((byte)value);
213-
previousValue = 0;
214206
}
215207
}
216208
}

0 commit comments

Comments
 (0)