]> git.tdb.fi Git - libs/gl.git/blobdiff - source/texture2d.cpp
Depracate the srgb parameter of Texture::image functions
[libs/gl.git] / source / texture2d.cpp
index fa92f1c97e52b3c980485827280def8e1c0057c2..cee932f7231e9fb23adcfb4ce86ba28e736dd17a 100644 (file)
@@ -18,7 +18,6 @@ class Texture2D::AsyncLoader: public Resource::AsyncLoader
 private:
        Texture2D &texture;
        IO::Seekable &io;
-       bool srgb_conversion;
        Buffer pixel_buffer;
        char *mapped_address;
        Graphics::Image image;
@@ -28,7 +27,6 @@ private:
 public:
        AsyncLoader(Texture2D &, IO::Seekable &);
 
-       void set_srgb_conversion(bool);
        virtual bool needs_sync() const;
        virtual bool process();
 };
@@ -149,18 +147,18 @@ void Texture2D::sub_image(unsigned level, int x, int y, unsigned wd, unsigned ht
        sub_image(level, x, y, wd, ht, data);
 }
 
-void Texture2D::image(const Graphics::Image &img, unsigned lv, bool srgb)
+void Texture2D::image(const Graphics::Image &img, unsigned lv)
 {
-       image(img, lv, srgb, false);
+       image(img, lv, false);
 }
 
-void Texture2D::image(const Graphics::Image &img, unsigned lv, bool srgb, bool from_buffer)
+void Texture2D::image(const Graphics::Image &img, unsigned lv, bool from_buffer)
 {
        unsigned w = img.get_width();
        unsigned h = img.get_height();
        PixelFormat fmt = pixelformat_from_image(img);
        if(width==0)
-               storage(make_pixelformat(get_components(fmt), get_component_type(fmt), srgb), w, h, lv);
+               storage(make_pixelformat(get_components(fmt), get_component_type(fmt), use_srgb_format), w, h, lv);
        else if(w!=width || h!=height || (lv && lv!=levels))
                throw incompatible_data("Texture2D::image");
 
@@ -188,11 +186,9 @@ void Texture2D::get_level_size(unsigned level, unsigned &w, unsigned &h) const
                h = 1;
 }
 
-Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *res)
+Resource::AsyncLoader *Texture2D::load(IO::Seekable &io, const Resources *)
 {
        AsyncLoader *ldr = new AsyncLoader(*this, io);
-       if(res)
-               ldr->set_srgb_conversion(res->get_srgb_conversion());
        return ldr;
 }
 
@@ -248,17 +244,11 @@ void Texture2D::Loader::storage_levels(PixelFormat fmt, unsigned w, unsigned h,
 Texture2D::AsyncLoader::AsyncLoader(Texture2D &t, IO::Seekable &i):
        texture(t),
        io(i),
-       srgb_conversion(false),
        pixel_buffer(PIXEL_UNPACK_BUFFER),
        mapped_address(0),
        phase(0)
 { }
 
-void Texture2D::AsyncLoader::set_srgb_conversion(bool c)
-{
-       srgb_conversion = c;
-}
-
 bool Texture2D::AsyncLoader::needs_sync() const
 {
        return phase%2;
@@ -299,7 +289,7 @@ bool Texture2D::AsyncLoader::process()
                        else
                                glGenTextures(1, &texture.id);
                }
-               texture.image(image, 0, srgb_conversion, true);
+               texture.image(image, 0, true);
        }
 
        ++phase;