X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fcore%2Ftexture1d.cpp;fp=source%2Fcore%2Ftexture1d.cpp;h=d472527c92322f4d05b0fe39640f7f91905133a9;hb=4ae2ffa3057af9524a84ba322c0db32d6fcae8f2;hp=1e90b6f7264d56d1f37c32afc9255157eca743b3;hpb=0d765be40336decc966932e0143fe9496f3eab4b;p=libs%2Fgl.git diff --git a/source/core/texture1d.cpp b/source/core/texture1d.cpp index 1e90b6f7..d472527c 100644 --- a/source/core/texture1d.cpp +++ b/source/core/texture1d.cpp @@ -22,7 +22,11 @@ Texture1D::Texture1D(): void Texture1D::storage(PixelFormat fmt, unsigned wd, unsigned lv) { if(width>0) - throw invalid_operation("Texture1D::storage"); + { + if(fmt!=format || wd!=width || (lv && lv!=levels)) + throw incompatible_data("Texture1D::storage"); + return; + } if(wd==0) throw invalid_argument("Texture1D::storage"); @@ -126,10 +130,7 @@ void Texture1D::image(const Graphics::Image &img, unsigned lv) unsigned w = img.get_width(); PixelFormat fmt = pixelformat_from_image(img); - if(width==0) - storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, lv); - else if(w!=width) - throw incompatible_data("Texture1D::image"); + storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, lv); image(0, img.get_pixels()); }