aboutsummaryrefslogtreecommitdiffstats
path: root/tex.c
diff options
context:
space:
mode:
authorTomasz Kramkowski <tk@the-tk.com>2018-10-27 12:41:58 +0100
committerTomasz Kramkowski <tk@the-tk.com>2018-10-27 12:47:05 +0100
commitd3f47e042aebd5fbf86477abf7058704657e8430 (patch)
tree4996f0c46f7ebf5037ee7fecceb161bbeb4e549e /tex.c
parentadbc72e159d48e6b1ad091e6ac19fd1cd6d5f798 (diff)
downloadfaqe-d3f47e042aebd5fbf86477abf7058704657e8430.tar.gz
faqe-d3f47e042aebd5fbf86477abf7058704657e8430.tar.xz
faqe-d3f47e042aebd5fbf86477abf7058704657e8430.zip
Cleanup pass
Diffstat (limited to 'tex.c')
-rw-r--r--tex.c2
1 files changed, 2 insertions, 0 deletions
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);