From 81b82e227785297a08dbcbf9b8224e0f256355e3 Mon Sep 17 00:00:00 2001 From: treeform Date: Fri, 11 Feb 2022 20:11:01 -0800 Subject: [PATCH] Morepretty --- src/pixie/fileformats/bmp.nim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/pixie/fileformats/bmp.nim b/src/pixie/fileformats/bmp.nim index 673220e..4f2a5bd 100644 --- a/src/pixie/fileformats/bmp.nim +++ b/src/pixie/fileformats/bmp.nim @@ -28,9 +28,9 @@ proc decodeBmp*(data: string): Image {.raises: [PixieError].} = height = data.readInt32(22).int offset = data.readUInt32(10).int # Default channels if header does not contain them: - redChannel = 0x00FF0000.uint32 + redChannel = 0x00FF0000.uint32 greenChannel = 0x0000FF00.uint32 - blueChannel = 0x000000FF.uint32 + blueChannel = 0x000000FF.uint32 alphaChannel = 0xFF000000.uint32 useAlpha = false flipVertical = false @@ -75,7 +75,7 @@ proc decodeBmp*(data: string): Image {.raises: [PixieError].} = if redChannel == 0 or greenChannel == 0 or blueChannel == 0 or alphaChannel == 0: - raise newException(PixieError, "Unsupported 0 channel mask.") + raise newException(PixieError, "Unsupported 0 channel mask.") if bits notin [1, 4, 8, 32, 24]: raise newException(PixieError, "Unsupported BMP data format") @@ -177,7 +177,6 @@ proc decodeBmp*(data: string): Image {.raises: [PixieError].} = result[x, result.height - y - 1] = rgba.rgbx() if bits == 32: - for y in 0 ..< result.height: for x in 0 ..< result.width: if offset >= data.len - 2: