From 27a2e8ebe54e6450629ff4e8ace671c1b8030a41 Mon Sep 17 00:00:00 2001 From: lecoanet Date: Fri, 31 May 2002 15:15:39 +0000 Subject: Filtrage lin�aire pour les images sans transparence. Ca ne marche pas bien pour les autres. Correction d'un bug potentiel dans From5r6g5b, bpixels pouvait �tre NULL et provoquer un core dump. --- generic/Image.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'generic/Image.c') diff --git a/generic/Image.c b/generic/Image.c index efb1333..a554a6a 100644 --- a/generic/Image.c +++ b/generic/Image.c @@ -144,7 +144,12 @@ From5r6g5b(unsigned char *data, /* * Configure the alpha value. */ - alpha = ZnGetBitmapPixel(bpixels, bstride, x, y) ? 255 : 0; + if (bpixels) { + alpha = ZnGetBitmapPixel(bpixels, bstride, x, y) ? 255 : 0; + } + else { + alpha = 255; + } /* * Dispatch the 3 color components. @@ -855,8 +860,14 @@ ZnImageTex(ZnImage image, glBindTexture(GL_TEXTURE_2D, this->i.gl.texobj); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + if (bits->bpixels) { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + } + else { + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + } if (ZnImageIsBitmap(image)) { glTexImage2D(GL_TEXTURE_2D, 0, GL_INTENSITY4, this->bits->t_width, this->bits->t_height, -- cgit v1.1