]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/texturecube.cpp
Fix the type of a location variable
[libs/gl.git] / source / core / texturecube.cpp
index ea29499732646897dd9e81c7080c8cc3bc9ff013..ff2b28755bb3e8e37c3dbadf57f6695b24e13d83 100644 (file)
@@ -29,10 +29,6 @@ const unsigned TextureCube::orientations[12] =
        1, 3
 };
 
-TextureCube::TextureCube():
-       size(0)
-{ }
-
 void TextureCube::storage(PixelFormat fmt, unsigned sz, unsigned lv)
 {
        if(size>0)
@@ -59,11 +55,11 @@ void TextureCube::image(TextureCubeFace face, unsigned level, const void *data)
        return sub_image(face, level, 0, 0, lsz, lsz, data);
 }
 
-void TextureCube::sub_image(TextureCubeFace face, unsigned level, int x, int y, unsigned wd, unsigned ht, const void *data)
+void TextureCube::sub_image(TextureCubeFace face, unsigned level, unsigned x, unsigned y, unsigned wd, unsigned ht, const void *data)
 {
        if(size==0)
                throw invalid_operation("TextureCube::sub_image");
-       if(level>=levels)
+       if(level>=levels || x>size || x+wd>size || y>size || y+ht>size)
                throw out_of_range("TextureCube::sub_image");
 
        TextureCubeBackend::sub_image(face, level, x, y, wd, ht, data);