aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2021-05-04 23:41:45 +0100
committergingerBill <bill@gingerbill.org>2021-05-04 23:41:45 +0100
commitf11f84964dfd02b1cb958f6e1d4d796e6fae51fe (patch)
tree3a789060772ec2c1e568653f6030c11970d85cc7
parentbb9c1d04db025f5497d8e2cc4f3c6346bfd298cc (diff)
parentf3c4d972507bd186ffc2acfc45df498be591ea9d (diff)
Merge branch 'master' of https://github.com/odin-lang/Odin
-rw-r--r--core/image/common.odin8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/image/common.odin b/core/image/common.odin
index e92060ed2..9024ec769 100644
--- a/core/image/common.odin
+++ b/core/image/common.odin
@@ -150,15 +150,15 @@ return_single_channel :: proc(img: ^Image, channel: Channel) -> (res: ^Image, ok
idx := int(channel);
- if idx > img.channels {
- return {}, false;
- }
-
if img.channels == 2 && idx == 4 {
// Alpha requested, which in a two channel image is index 2: G.
idx = 2;
}
+ if idx > img.channels {
+ return {}, false;
+ }
+
switch(img.depth) {
case 8:
buffer_size := compute_buffer_size(img.width, img.height, 1, 8);