X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fimage.cpp;h=46c2b3fab3c29f0ce952133b1d55966531252e94;hb=1ca709deba08e55d95066be564a8fd43a321af19;hp=5d2a21bb66e969d85da76f34811d4ff5e1f9836b;hpb=a50eef72fac4b253bd014a32ec43b90e990b5784;p=libs%2Fgui.git diff --git a/source/graphics/image.cpp b/source/graphics/image.cpp index 5d2a21b..46c2b3f 100644 --- a/source/graphics/image.cpp +++ b/source/graphics/image.cpp @@ -52,7 +52,7 @@ void Image::load_file(const string &fn) if(ext==".png") { IO::BufferedFile file(fn); - load_png(file, *priv); + load_png(file, *priv, 0, 0); } else #endif @@ -66,25 +66,22 @@ void Image::load_file(const string &fn) (void)fn; } -void Image::load_memory(const void *data, unsigned size) +void Image::load_io(IO::Base &io) { + char sig_buf[8]; + unsigned sig_len = io.read(sig_buf, sizeof(sig_buf)); #ifdef WITH_LIBPNG - if(size>=8 && is_png(data, 8)) - { - IO::Memory mem(reinterpret_cast(data), size); - load_png(mem, *priv); - } + if(sig_len==sizeof(sig_buf) && is_png(sig_buf, sig_len)) + load_png(io, *priv, sig_buf, sig_len); else #endif { #ifdef WITH_DEVIL - load_devil_mem(data, size, *priv); + load_devil_io(io, *priv, sig_buf, sig_len); #else throw unsupported_image_format("DevIL needed for non-PNG images"); #endif } - (void)data; - (void)size; } PixelFormat Image::get_format() const