Fixed some styling issues

Author Mitja Felicijan <mitja.felicijan@gmail.com> 2025-02-04 22:52:15 +0100
Committer Mitja Felicijan <mitja.felicijan@gmail.com> 2025-02-04 22:52:15 +0100
Commit c53b1444c27e517454294b90e69912169caeaa32 (patch)
-rw-r--r-- main.c 10
1 files changed, 5 insertions, 5 deletions
diff --git a/main.c b/main.c
...
77
	free(path->extension);
77
	free(path->extension);
78
}
78
}
79
  
79
  
80
void dxt1_to_rgba(const uint8_t* dxt1_block, uint8_t* rgba_pixels) {
80
void dxt1_to_rgba(const uint8_t *dxt1_block, uint8_t *rgba_pixels) {
81
	uint16_t color0 = (dxt1_block[0] | (dxt1_block[1] << 8));
81
	uint16_t color0 = (dxt1_block[0] | (dxt1_block[1] << 8));
82
	uint16_t color1 = (dxt1_block[2] | (dxt1_block[3] << 8));
82
	uint16_t color1 = (dxt1_block[2] | (dxt1_block[3] << 8));
83
	uint32_t color_bits = (dxt1_block[4] | (dxt1_block[5] << 8) | (dxt1_block[6] << 16) | (dxt1_block[7] << 24));
83
	uint32_t color_bits = (dxt1_block[4] | (dxt1_block[5] << 8) | (dxt1_block[6] << 16) | (dxt1_block[7] << 24));
...
127
	}
127
	}
128
}
128
}
129
  
129
  
130
void dxt3_to_rgba(const uint8_t* dxt3_block, uint8_t* rgba_pixels) {
130
void dxt3_to_rgba(const uint8_t *dxt3_block, uint8_t *rgba_pixels) {
131
	// First 8 bytes contain the alpha values (4 bits per pixel).
131
	// First 8 bytes contain the alpha values (4 bits per pixel).
132
	uint64_t alpha_bits;
132
	uint64_t alpha_bits;
133
	memcpy(&alpha_bits, dxt3_block, 8);
133
	memcpy(&alpha_bits, dxt3_block, 8);
...
142
	}
142
	}
143
}
143
}
144
  
144
  
145
void dxt5_to_rgba(const uint8_t* dxt5_block, uint8_t* rgba_pixels) {
145
void dxt5_to_rgba(const uint8_t *dxt5_block, uint8_t *rgba_pixels) {
146
	// First 8 bytes contain the interpolated alpha values.
146
	// First 8 bytes contain the interpolated alpha values.
147
	uint8_t alpha0 = dxt5_block[0];
147
	uint8_t alpha0 = dxt5_block[0];
148
	uint8_t alpha1 = dxt5_block[1];
148
	uint8_t alpha1 = dxt5_block[1];
...
196
	}
196
	}
197
}
197
}
198
  
198
  
199
void decode_dxt_image(const uint8_t* image_data, uint32_t width, uint32_t height, int dxt_type, path_components *path, bool verbose) {
199
void decode_dxt_image(const uint8_t *image_data, uint32_t width, uint32_t height, int dxt_type, path_components *path, bool verbose) {
200
	uint32_t blocks_wide = (width + 3) / 4;
200
	uint32_t blocks_wide = (width + 3) / 4;
201
	uint32_t blocks_high = (height + 3) / 4;
201
	uint32_t blocks_high = (height + 3) / 4;
202
	uint32_t total_pixels = width * height;
202
	uint32_t total_pixels = width * height;
...
212
	for (uint32_t by = 0; by < blocks_high; by++) {
212
	for (uint32_t by = 0; by < blocks_high; by++) {
213
		for (uint32_t bx = 0; bx < blocks_wide; bx++) {
213
		for (uint32_t bx = 0; bx < blocks_wide; bx++) {
214
			uint8_t block_rgba[64];
214
			uint8_t block_rgba[64];
215
			const uint8_t* dxt_block = image_data + (by * blocks_wide + bx) * block_size;
215
			const uint8_t *dxt_block = image_data + (by * blocks_wide + bx) * block_size;
216
  
216
  
217
			switch (dxt_type) {
217
			switch (dxt_type) {
218
				case 1:
218
				case 1:
...