Skip to content

Commit 8ffc98b

Browse files
authored
Merge pull request #5661 from leecommamichael/core-image-tga
[core:image/tga] implement Option.do_not_expand_grayscale
2 parents 533079f + 550e57a commit 8ffc98b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

core/image/tga/tga.odin

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a
152152
// Intentionally blank
153153
case .Uncompressed_Black_White:
154154
black_white = true
155-
dest_depth = 24
155+
dest_depth = 8 if .do_not_expand_grayscale in options else 24
156156
case .Uncompressed_Color_Mapped:
157157
color_mapped = true
158158
case .Compressed_Color_Mapped:
@@ -161,7 +161,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a
161161
case .Compressed_Black_White:
162162
black_white = true
163163
rle_encoding = true
164-
dest_depth = 24
164+
dest_depth = 8 if .do_not_expand_grayscale in options else 24
165165

166166
case:
167167
return nil, .Unsupported_Format
@@ -180,6 +180,9 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a
180180
}
181181

182182
switch dest_depth {
183+
case 8: // R8
184+
src_channels = 1
185+
dest_channels = 1
183186
case 15: // B5G5R5
184187
src_channels = 2
185188
dest_channels = 3

0 commit comments

Comments
 (0)