From f4d07714884240ffa258e9c58cf214f4ff66e3e2 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Wed, 22 Jun 2016 13:22:48 +0200 Subject: gl: Fix annotation textures that have alpha, while page textures don't. --- platform/gl/gl-main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'platform/gl') 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; } -- cgit v1.2.3