From d3f47e042aebd5fbf86477abf7058704657e8430 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Sat, 27 Oct 2018 12:41:58 +0100 Subject: Cleanup pass --- tex.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tex.c') diff --git a/tex.c b/tex.c index 11c09f7..a24a430 100644 --- a/tex.c +++ b/tex.c @@ -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); -- cgit v1.2.3-54-g00ecf