aboutsummaryrefslogtreecommitdiff
path: root/core/image/tga
diff options
context:
space:
mode:
authorMichael Lee <leecommamichael@gmail.com>2025-09-08 09:09:42 -0500
committerMichael Lee <leecommamichael@gmail.com>2025-09-08 09:09:42 -0500
commitf2b367f421a420ae5b15a4e10c170b2346561ac1 (patch)
tree6e705adb6255e8547ca86717960ca21c3051040a /core/image/tga
parent42c2cb89b580acc228a5e54988b40cf56f99c95f (diff)
[core-image/tga] implement Option.do_not_expand_grayscale
Diffstat (limited to 'core/image/tga')
-rw-r--r--core/image/tga/tga.odin7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/image/tga/tga.odin b/core/image/tga/tga.odin
index 5fda803c5..c20201d6a 100644
--- a/core/image/tga/tga.odin
+++ b/core/image/tga/tga.odin
@@ -153,7 +153,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a
// Intentionally blank
case .Uncompressed_Black_White:
black_white = true
- dest_depth = 24
+ dest_depth = 8 if .do_not_expand_grayscale in options else 24
case .Uncompressed_Color_Mapped:
color_mapped = true
case .Compressed_Color_Mapped:
@@ -162,7 +162,7 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a
case .Compressed_Black_White:
black_white = true
rle_encoding = true
- dest_depth = 24
+ dest_depth = 8 if .do_not_expand_grayscale in options else 24
case:
return nil, .Unsupported_Format
@@ -181,6 +181,9 @@ load_from_context :: proc(ctx: ^$C, options := Options{}, allocator := context.a
}
switch dest_depth {
+ case 8: // R8
+ src_channels = 1
+ dest_channels = 1
case 15: // B5G5R5
src_channels = 2
dest_channels = 3