add buffer limit checks to texture construction
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
This commit is contained in:
parent
1db6059821
commit
831df3d6af
@ -202,12 +202,18 @@ public class Texture {
|
||||
//buffer data
|
||||
for(int y = height - 1; y > -1; y--){
|
||||
for(int x = 0; x < width; x++){
|
||||
Color temp = new Color(image_data.getRGB(x, y), true);
|
||||
Color temp = new Color(image_data.getRGB(x, y), hasTransparency);
|
||||
|
||||
if(data.position() + 3 > data.limit() + 1){
|
||||
throw new IllegalStateException("Hit buffer limit!");
|
||||
}
|
||||
data.put((byte)temp.getRed());
|
||||
data.put((byte)temp.getGreen());
|
||||
data.put((byte)temp.getBlue());
|
||||
if(hasTransparency){
|
||||
if(data.position() + 1 > data.limit() + 1){
|
||||
throw new IllegalStateException("Hit buffer limit!");
|
||||
}
|
||||
data.put((byte)temp.getAlpha());
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user