X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Fgraphics%2Fdevil%2Fdevilloader.cpp;h=8fbf59ccbee6150a44259437ac3f2fc78be5f02d;hb=HEAD;hp=ab962d1d503352fbc5a44911c48817377241f872;hpb=0885a7e155653acbbc1b15eff590feabbb6f00d9;p=libs%2Fgui.git diff --git a/source/graphics/devil/devilloader.cpp b/source/graphics/devil/devilloader.cpp index ab962d1..8fbf59c 100644 --- a/source/graphics/devil/devilloader.cpp +++ b/source/graphics/devil/devilloader.cpp @@ -1,7 +1,7 @@ +#include "devilloader.h" #include #include #include -#include "devilloader.h" using namespace std; @@ -54,7 +54,7 @@ int tell(void *handle) return reinterpret_cast(handle)->tell(); } -std::string error_string(ILenum err) +string error_string(ILenum err) { switch(err) { @@ -101,7 +101,7 @@ bool DevilLoader::detect(const string &sig) return type!=IL_TYPE_UNKNOWN; } -void DevilLoader::load(Image::Data &data) +void DevilLoader::load_headers_(Image::Data &data) { ilSetRead(0, 0, eof, get, read, seek, tell); ilBindImage(id); @@ -125,13 +125,20 @@ void DevilLoader::load(Image::Data &data) data.width = ilGetInteger(IL_IMAGE_WIDTH); data.height = ilGetInteger(IL_IMAGE_HEIGHT); data.stride = data.width*ilGetInteger(IL_IMAGE_BYTES_PER_PIXEL); + + ilBindImage(0); + ilResetRead(); +} + +void DevilLoader::load_pixels_(Image::Data &data) +{ + ilBindImage(id); + unsigned data_size = data.stride*data.height; - data.data = new char[data_size]; ILubyte *il_data = ilGetData(); - copy(il_data, il_data+data_size, data.data); + copy(il_data, il_data+data_size, data.pixels); ilBindImage(0); - ilResetRead(); } } // namespace Graphics