aboutsummaryrefslogtreecommitdiff
path: root/generic/Image.c
diff options
context:
space:
mode:
authorlecoanet2002-05-31 15:15:39 +0000
committerlecoanet2002-05-31 15:15:39 +0000
commit27a2e8ebe54e6450629ff4e8ace671c1b8030a41 (patch)
tree94cee2cdad0401e7f4829dfe17f81d5a8877eb42 /generic/Image.c
parent422cf718b8747edcb08ff5009aa85e1020da5958 (diff)
downloadtkzinc-27a2e8ebe54e6450629ff4e8ace671c1b8030a41.zip
tkzinc-27a2e8ebe54e6450629ff4e8ace671c1b8030a41.tar.gz
tkzinc-27a2e8ebe54e6450629ff4e8ace671c1b8030a41.tar.bz2
tkzinc-27a2e8ebe54e6450629ff4e8ace671c1b8030a41.tar.xz
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.
Diffstat (limited to 'generic/Image.c')
-rw-r--r--generic/Image.c17
1 files changed, 14 insertions, 3 deletions
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,