X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture2d.cpp;h=41f4ab11280259f1fd68f621c8f82ee289f9dbed;hb=4365124bd39bd6edbda6eaef64ec72a1a10565f8;hp=3c3579c1d131137f89ab49b57dd565f15a3ed544;hpb=0a359a7508a0117b055b72bcb7dc42ddcb2ed5f9;p=libs%2Fgl.git diff --git a/source/core/texture2d.cpp b/source/core/texture2d.cpp index 3c3579c1..41f4ab11 100644 --- a/source/core/texture2d.cpp +++ b/source/core/texture2d.cpp @@ -38,11 +38,11 @@ void Texture2D::image(unsigned level, const void *data) return sub_image(level, 0, 0, size.x, size.y, data); } -void Texture2D::sub_image(unsigned level, int x, int y, unsigned wd, unsigned ht, const void *data) +void Texture2D::sub_image(unsigned level, unsigned x, unsigned y, unsigned wd, unsigned ht, const void *data) { if(width==0 || height==0) throw invalid_operation("Texture2D::sub_image"); - if(level>=levels) + if(level>=levels || x>width || x+wd>width || y>height || y+ht>height) throw out_of_range("Texture2D::sub_image"); Texture2DBackend::sub_image(level, x, y, wd, ht, data);