X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture2d.cpp;h=9b1c16ea120dbe6fe7d88c96f57dcfbfd386e79e;hb=6cee6c490ded0981c4da3f9f4ec74a41555e1a4e;hp=8dc15b1c38aaf3a6364c3eccf80249ef25d2f301;hpb=57ca8f2bd18525d80ed6ad5d3f72e57901162d55;p=libs%2Fgl.git diff --git a/source/core/texture2d.cpp b/source/core/texture2d.cpp index 8dc15b1c..9b1c16ea 100644 --- a/source/core/texture2d.cpp +++ b/source/core/texture2d.cpp @@ -6,12 +6,6 @@ using namespace std; namespace Msp { namespace GL { -Texture2D::Texture2D(ResourceManager *m): - Texture2DBackend(m), - width(0), - height(0) -{ } - Texture2D::~Texture2D() { set_manager(0); @@ -44,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); @@ -105,18 +99,10 @@ Texture2D::Loader::Loader(Texture2D &t, Collection &c): void Texture2D::Loader::init() { - add("raw_data", &Loader::raw_data); add("storage", &Loader::storage); add("storage", &Loader::storage_levels); } -void Texture2D::Loader::raw_data(const string &data) -{ - if(obj.manager) - obj.set_manager(0); - obj.image(0, data.data()); -} - void Texture2D::Loader::storage(PixelFormat fmt, unsigned w, unsigned h) { obj.storage(fmt, w, h);