diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2018-10-27 12:41:58 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2018-10-27 12:47:05 +0100 |
commit | d3f47e042aebd5fbf86477abf7058704657e8430 (patch) | |
tree | 4996f0c46f7ebf5037ee7fecceb161bbeb4e549e /tex.c | |
parent | adbc72e159d48e6b1ad091e6ac19fd1cd6d5f798 (diff) | |
download | faqe-d3f47e042aebd5fbf86477abf7058704657e8430.tar.gz faqe-d3f47e042aebd5fbf86477abf7058704657e8430.tar.xz faqe-d3f47e042aebd5fbf86477abf7058704657e8430.zip |
Cleanup pass
Diffstat (limited to 'tex.c')
-rw-r--r-- | tex.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -9,6 +9,7 @@ #include "eprintf.h" #include "tex.h" +// png2tex: read a PNG and produce an OpenGL texture out of it GLuint png2tex(FILE *f) { png_image pi = { .version = PNG_IMAGE_VERSION }; @@ -21,6 +22,7 @@ GLuint png2tex(FILE *f) png_image_begin_read_from_stdio(&pi, f); pi.format = PNG_FORMAT_RGB; stride = sizeof *data * PNG_IMAGE_SAMPLE_CHANNELS(pi.format) * pi.width; + // OpenGL alignment requirement stride = (stride + 3) & ~(size_t)3; size = stride * pi.height; data = emalloc(size); |