summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-06-22 13:22:48 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-06-22 13:42:11 +0200
commitf4d07714884240ffa258e9c58cf214f4ff66e3e2 (patch)
tree468a9e4c47cbd1dc4b6eccaa347b8039cefa65e7
parentbdc0b4b959aed8a93e67f9a223a4e8de1930ac8f (diff)
downloadmupdf-f4d07714884240ffa258e9c58cf214f4ff66e3e2.tar.xz
gl: Fix annotation textures that have alpha, while page textures don't.
-rw-r--r--platform/gl/gl-main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c
index 07b8cc4e..ff080d1b 100644
--- a/platform/gl/gl-main.c
+++ b/platform/gl/gl-main.c
@@ -228,7 +228,7 @@ void texture_from_pixmap(struct texture *tex, fz_pixmap *pix)
if (tex->w > max_texture_size || tex->h > max_texture_size)
fz_warn(ctx, "texture size (%d x %d) exceeds implementation limit (%d)", tex->w, tex->h, max_texture_size);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex->w, tex->h, 0, GL_RGB, GL_UNSIGNED_BYTE, pix->samples);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex->w, tex->h, 0, pix->n == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, pix->samples);
tex->s = 1;
tex->t = 1;
}
@@ -240,7 +240,7 @@ void texture_from_pixmap(struct texture *tex, fz_pixmap *pix)
fz_warn(ctx, "texture size (%d x %d) exceeds implementation limit (%d)", w2, h2, max_texture_size);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w2, h2, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
- glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h, GL_RGB, GL_UNSIGNED_BYTE, pix->samples);
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, tex->w, tex->h, pix->n == 4 ? GL_RGBA : GL_RGB, GL_UNSIGNED_BYTE, pix->samples);
tex->s = (float)tex->w / w2;
tex->t = (float)tex->h / h2;
}