Skip to content

Commit 0a8bae0

Browse files
committed
Refactor: use Span.Fill for block color assignment
Replaced manual for loop with Span.Fill to efficiently assign a color value to the output span in ASTC block decoding. This improves code readability and performance.
1 parent a7a12fd commit 0a8bae0

1 file changed

Lines changed: 1 addition & 4 deletions

File tree

‎AssetRipper.TextureDecoder/Astc/AstcDecoder.cs‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,7 @@ private static void DecodeBlock(ReadOnlySpan<byte> input, int blockWidth, int bl
6666
if (input[0] == 0xfc && (input[1] & 1) == 1)
6767
{
6868
ColorRGBA<byte> c = new(input[9], input[11], input[13], input[15]);
69-
for (int i = 0; i < blockWidth * blockHeight; i++)
70-
{
71-
output[i] = c;
72-
}
69+
output[..(blockWidth * blockHeight)].Fill(c);
7370
}
7471
else
7572
{

0 commit comments

Comments
 (0)