diff options
author | Kenneth Russel <[email protected]> | 2005-02-23 09:40:12 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2005-02-23 09:40:12 +0000 |
commit | f4ae5496e788696508e6f7592b62761473ebc8d5 (patch) | |
tree | 2e8e5ea737b42ec95d60fdd4023b0eedc67286a4 /src/net | |
parent | cc03005c049d3dbdbda27975055dea5ae391085f (diff) |
Partial fix for Issue 140: glu.gluBuild2DMipmaps crash
This was a bug in the SGI GLU sample implementation and was reproduced
by converting the attached test program to C and compiling in the code
from the sample implementation. This bug was already fixed in the Mesa
sources as bug 2510 and the patch was found at
http://cvs.freedesktop.org/mesa/Mesa/src/glu/sgi/libutil/mipmap.c?rev=1.6&view=log
by Googling for the terms "mipmap.c last row". The fix is to add a
test-and-clamp for the highest row read from the texture.
There is still a problem with visual artifacts when scaling
non-power-of-two textures that this test case reproduces and that is
continuing to be investigated.
git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@234 232f8b59-042b-4e1e-8c03-345bb8c30851
Diffstat (limited to 'src/net')
-rw-r--r-- | src/net/java/games/jogl/impl/mipmap/ScaleInternal.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java b/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java index e94b09d4a..3a9306683 100644 --- a/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java +++ b/src/net/java/games/jogl/impl/mipmap/ScaleInternal.java @@ -176,6 +176,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -382,6 +385,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -588,6 +594,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -859,6 +868,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -1142,6 +1154,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -1420,6 +1435,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -1705,6 +1723,9 @@ public class ScaleInternal { highy_float = convy_float; for( i = 0; i < heightout; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightin) + highy_int = heightin - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; @@ -1993,6 +2014,9 @@ public class ScaleInternal { highy_float = convx_float; for( i = 0; i < heightOut; i++ ) { + /* Clamp here to be sure we don't read beyond input buffer. */ + if (highy_int >= heightIn) + highy_int = heightIn - 1; lowx_int = 0; lowx_float = 0.0f; highx_int = convx_int; |