X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Ftexture.cpp;h=a65715e716a26c6fbc283655c37c0382fc795010;hp=0d7a81512e7f73f5c0a49659b4feddc16739c582;hb=3f2ce5d1ba85bc0c03e6718cc41c2dac5e959d75;hpb=225dbd7ba2dde73bb28e54e03ae960e88e708f57 diff --git a/source/core/texture.cpp b/source/core/texture.cpp index 0d7a8151..a65715e7 100644 --- a/source/core/texture.cpp +++ b/source/core/texture.cpp @@ -41,6 +41,41 @@ unsigned Texture::count_levels(unsigned size) return n; } +void Texture::stage_pixels(void *staging, const void *data, size_t count) +{ + if(swizzle==RGBA_TO_RGB) + { + const uint32_t *src = static_cast(data); + uint32_t *dst = static_cast(staging); + size_t i = 0; + for(; i+3>24)|(src[1]<<8)|0xFF000000; + dst[2] = (src[1]>>16)|(src[2]<<16)|0xFF000000; + dst[3] = (src[2]>>8)|0xFF000000; + src += 3; + dst += 4; + } + + if(i(src); + for(; i(data); + size_t data_size = count*get_pixel_size(storage_fmt); + copy(src, src+data_size, static_cast(staging)); + } +} + void Texture::load_image(const string &fn, unsigned lv) { Graphics::Image img;