From 42763400740a06009d4cbcecf32a82501fbfc154 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Wed, 27 Jul 2022 21:32:48 +1000 Subject: [PATCH] Sorted formats by n --- src/PIL/DdsImagePlugin.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/PIL/DdsImagePlugin.py b/src/PIL/DdsImagePlugin.py index 0f2cce1e50d..bba48016140 100644 --- a/src/PIL/DdsImagePlugin.py +++ b/src/PIL/DdsImagePlugin.py @@ -82,6 +82,7 @@ DDS_CUBEMAP_POSITIVEZ = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_POSITIVEZ DDS_CUBEMAP_NEGATIVEZ = DDSCAPS2_CUBEMAP | DDSCAPS2_CUBEMAP_NEGATIVEZ + # DXT1 DXT1_FOURCC = 0x31545844 @@ -155,6 +156,14 @@ def _open(self): elif fourcc == b"DXT5": self.pixel_format = "DXT5" n = 3 + elif fourcc == b"ATI1": + self.pixel_format = "BC4" + n = 4 + self.mode = "L" + elif fourcc == b"ATI2": + self.pixel_format = "BC5" + n = 5 + self.mode = "RGB" elif fourcc == b"BC5S": self.pixel_format = "BC5S" n = 5 @@ -192,14 +201,6 @@ def _open(self): raise NotImplementedError( f"Unimplemented DXGI format {dxgi_format}" ) - elif fourcc == b"ATI1": - self.pixel_format = "BC4" - n = 4 - self.mode = "L" - elif fourcc == b"ATI2": - self.pixel_format = "BC5" - n = 5 - self.mode = "RGB" else: raise NotImplementedError(f"Unimplemented pixel format {repr(fourcc)}")