X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fgraphics%2Fbmploader.cpp;h=d88e2aa6435f36f3c908bf3c274a9799a5b2339e;hb=054fca09f0bbd64fdbd6406a0643de938a9cd4fb;hp=fa23182883996164a73611c17b1416893aef0a62;hpb=e1f6dad834fb043f22a57dbaa65016ee1f65a43a;p=libs%2Fgui.git diff --git a/source/graphics/bmploader.cpp b/source/graphics/bmploader.cpp index fa23182..d88e2aa 100644 --- a/source/graphics/bmploader.cpp +++ b/source/graphics/bmploader.cpp @@ -29,7 +29,8 @@ namespace Graphics { BmpLoader::BmpLoader(IO::Base &i, unsigned sb): io(i), - sig_bytes(sb) + sig_bytes(sb), + invert_row_order(false) { // Image data location is stored at offset 10 and can't be skipped if(sig_bytes>10) @@ -44,7 +45,7 @@ bool BmpLoader::detect(const std::string &sig) return !sig.compare(0, sizeof(bmp_sig), bmp_sig, sizeof(bmp_sig)); } -void BmpLoader::load(Image::Data &data) +void BmpLoader::load_headers_(Image::Data &data) { char bm_header[14]; read_full(io, bm_header+sig_bytes, sizeof(bm_header)-sig_bytes); @@ -92,16 +93,21 @@ void BmpLoader::load(Image::Data &data) skip -= size; } - data.data = new char[data.stride*data.height]; - if(height<0) + invert_row_order = (height<0); +} + +void BmpLoader::load_pixels_(Image::Data &data) +{ + data.pixels = new char[data.stride*data.height]; + if(invert_row_order) { for(unsigned y=0; y