diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-11-17 08:30:11 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-11-17 08:30:11 +0100 |
commit | ff24e4c604479fdcedfacca35af3bb4810683c68 (patch) | |
tree | 1dde0815123ce570e7281a859976e35ff1b8096c /src | |
parent | ec3f4b294d0a1fe744d77c32ccd1aabb3c1a6b88 (diff) |
Image: fix bug where images are forced to be in RGBA format
Diffstat (limited to 'src')
-rw-r--r-- | src/graphics/image.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/graphics/image.c b/src/graphics/image.c index 0a6a88a..eeee2ad 100644 --- a/src/graphics/image.c +++ b/src/graphics/image.c @@ -44,14 +44,12 @@ int mgl_image_load_from_file(mgl_image *self, const char *filepath) { self->height = 0; int format; - /* TODO: format is forced to rgba right now because rgb images cause the image to be skewed (bug) */ - self->data = stbi_load(filepath, &self->width, &self->height, &format, 4); + self->data = stbi_load(filepath, &self->width, &self->height, &format, 0); if(!self->data) { fprintf(stderr, "Error: failed to load image %s, error: %s\n", filepath, stbi_failure_reason()); mgl_image_unload(self); return -1; } - format = 4; self->format = stbi_format_to_mgl_image_format(format); return 0; @@ -65,14 +63,12 @@ int mgl_image_load_from_memory(mgl_image *self, const unsigned char *data, size_ self->height = 0; int format; - /* TODO: format is forced to rgba right now because rgb images cause the image to be skewed (bug) */ - self->data = stbi_load_from_memory(data, size, &self->width, &self->height, &format, 4); + self->data = stbi_load_from_memory(data, size, &self->width, &self->height, &format, 0); if(!self->data) { fprintf(stderr, "Error: failed to load image from memory, error: %s\n", stbi_failure_reason()); mgl_image_unload(self); return -1; } - format = 4; self->format = stbi_format_to_mgl_image_format(format); return 0; |