@@ -105,20 +105,20 @@ class DDS_FLAGS(IntEnum):
105
105
CAPS = 0x1
106
106
HEIGHT = 0x2
107
107
WIDTH = 0x4
108
- PITCH = 0x8 # Use "w * h * bpp" for pitch_or_linear_size
108
+ PITCH = 0x8 # Use "w * bpp" for pitch_or_linear_size
109
109
PIXELFORMAT = 0x1000
110
110
MIPMAPCOUNT = 0x20000
111
- LINEARSIZE = 0x80000 # Use "w * bpp" for pitch_or_linear_size
111
+ LINEARSIZE = 0x80000 # Use "w * h * bpp" for pitch_or_linear_size
112
112
DEPTH = 0x800000 # For volume textures
113
113
DEFAULT = CAPS | HEIGHT | WIDTH | PIXELFORMAT | MIPMAPCOUNT
114
114
115
115
@staticmethod
116
116
def get_flags (is_compressed , is_3d ):
117
117
flags = DDS_FLAGS .DEFAULT
118
118
if is_compressed :
119
- flags |= DDS_FLAGS .PITCH
120
- else :
121
119
flags |= DDS_FLAGS .LINEARSIZE
120
+ else :
121
+ flags |= DDS_FLAGS .PITCH
122
122
if is_3d :
123
123
flags |= DDS_FLAGS .DEPTH
124
124
return flags
@@ -343,9 +343,9 @@ def update(self, depth, array_size):
343
343
344
344
self .flags = DDS_FLAGS .get_flags (self .is_compressed (), is_3d )
345
345
if DDS_FLAGS .has_pitch (self .flags ):
346
- self .pitch_or_linear_size = int (self .width * self .height * bpp )
347
- else :
348
346
self .pitch_or_linear_size = int (self .width * bpp )
347
+ else :
348
+ self .pitch_or_linear_size = int (self .width * self .height * bpp )
349
349
self .caps = DDS_CAPS .get_caps (has_mips , is_cube )
350
350
self .caps2 = DDS_CAPS2 .get_caps2 (is_cube , is_3d )
351
351
@@ -354,7 +354,7 @@ def update(self, depth, array_size):
354
354
355
355
def get_bpp (self ):
356
356
bpp = self .pitch_or_linear_size // self .width
357
- if DDS_FLAGS .has_pitch (self .flags ):
357
+ if not DDS_FLAGS .has_pitch (self .flags ):
358
358
bpp = bpp // self .height
359
359
return bpp
360
360
0 commit comments