diff options
-rw-r--r-- | src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java b/src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java index 7f6dac8a7..e000c2043 100644 --- a/src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java +++ b/src/classes/com/sun/opengl/impl/mipmap/ScaleInternal.java @@ -334,6 +334,13 @@ public class ScaleInternal { highx_float -= 1.0f; highx_int++; } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } } lowy_int = highy_int; lowy_float = highy_float; @@ -545,6 +552,13 @@ public class ScaleInternal { highx_float -= 1.0f; highx_int++; } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } } lowy_int = highy_int; lowy_float = highy_float; @@ -819,6 +833,13 @@ public class ScaleInternal { highx_float -= 1.0f; highx_int++; } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } } lowy_int = highy_int; lowy_float = highy_float; @@ -1109,6 +1130,13 @@ public class ScaleInternal { highx_float -= 1.0f; highx_int++; } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } } lowy_int = highy_int; lowy_float = highy_float; @@ -1390,6 +1418,13 @@ public class ScaleInternal { highx_float -= 1.0f; highx_int++; } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } } lowy_int = highy_int; lowy_float = highy_float; @@ -1680,6 +1715,13 @@ public class ScaleInternal { highx_float -= 1.0f; highx_int++; } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } } lowy_int = highy_int; lowy_float = highy_float; @@ -1970,6 +2012,13 @@ public class ScaleInternal { highx_float -= 1.0f; highx_int++; } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthin - 1) { + int delta = (highx_int - widthin + 1); + lowx_int -= delta; + highx_int -= delta; + } } lowy_int = highy_int; lowy_float = highy_float; @@ -2196,6 +2245,13 @@ public class ScaleInternal { highx_float -= 1.0f; highx_int++; } + + // Clamp to make sure we don't run off the right edge + if (highx_int > widthIn - 1) { + int delta = (highx_int - widthIn + 1); + lowx_int -= delta; + highx_int -= delta; + } } lowy_int = highy_int; lowy_float = highy_float; |