This commit is contained in:
Branimir Karadžić 2015-06-20 14:27:59 -07:00
parent 0283c83c0a
commit 8109de5461
2 changed files with 13 additions and 5 deletions

View file

@ -382,19 +382,24 @@ namespace bgfx
} }
} }
void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst) void imageCopy(uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch, void* _dst)
{ {
const uint32_t pitch = _width*_bpp/8; const uint32_t pitch = bx::uint32_min(_srcPitch, _dstPitch);
const uint8_t* src = (uint8_t*) _src; const uint8_t* src = (uint8_t*)_src;
const uint8_t* next = src + _srcPitch;
uint8_t* dst = (uint8_t*)_dst; uint8_t* dst = (uint8_t*)_dst;
for (uint32_t yy = 0; yy < _height; ++yy, src = next, next += _srcPitch, dst += pitch) for (uint32_t yy = 0; yy < _height; ++yy, src += _srcPitch, dst += _dstPitch)
{ {
memcpy(dst, src, pitch); memcpy(dst, src, pitch);
} }
} }
void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst)
{
const uint32_t dstPitch = _width*_bpp/8;
imageCopy(_height, _srcPitch, _src, dstPitch, _dst);
}
void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip) void imageWriteTga(bx::WriterI* _writer, uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, bool _grayscale, bool _yflip)
{ {
uint8_t type = _grayscale ? 3 : 2; uint8_t type = _grayscale ? 3 : 2;

View file

@ -80,6 +80,9 @@ namespace bgfx
/// ///
void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst); void imageSwizzleBgra8(uint32_t _width, uint32_t _height, uint32_t _srcPitch, const void* _src, void* _dst);
///
void imageCopy(uint32_t _height, uint32_t _srcPitch, const void* _src, uint32_t _dstPitch, void* _dst);
/// ///
void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst); void imageCopy(uint32_t _width, uint32_t _height, uint32_t _bpp, uint32_t _srcPitch, const void* _src, void* _dst);