Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed May 25, 2018
1 parent 2f67615 commit e9869fb
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 22 deletions.
4 changes: 2 additions & 2 deletions src/renderer_d3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4392,7 +4392,7 @@ namespace bgfx { namespace d3d11
{
uint32_t srcpitch = mip.m_width*bpp/8;
uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, mip.m_width*mip.m_height*bpp/8);
bimg::imageDecodeToBgra8(temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format);
bimg::imageDecodeToBgra8(g_allocator, temp, mip.m_data, mip.m_width, mip.m_height, srcpitch, mip.m_format);

srd[kk].pSysMem = temp;
srd[kk].SysMemPitch = srcpitch;
Expand Down Expand Up @@ -4713,7 +4713,7 @@ namespace bgfx { namespace d3d11
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, slicepitch);
bimg::imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
data = temp;
}

Expand Down
16 changes: 9 additions & 7 deletions src/renderer_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4495,13 +4495,15 @@ namespace bgfx { namespace d3d12
const uint32_t size = slice*depth;

uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, size);
bimg::imageDecodeToBgra8(temp
, mip.m_data
, mip.m_width
, mip.m_height
, pitch
, mip.m_format
);
bimg::imageDecodeToBgra8(
g_allocator
, temp
, mip.m_data
, mip.m_width
, mip.m_height
, pitch
, mip.m_format
);

srd[kk].pData = temp;
srd[kk].RowPitch = pitch;
Expand Down
20 changes: 11 additions & 9 deletions src/renderer_d3d9.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2978,21 +2978,23 @@ namespace bgfx { namespace d3d9
uint32_t srcpitch = mipWidth*bpp/8;

uint8_t* temp = (uint8_t*)BX_ALLOC(g_allocator, srcpitch*mipHeight);
bimg::imageDecodeToBgra8(temp
, mip.m_data
, mip.m_width
, mip.m_height
, srcpitch
, mip.m_format
);
bimg::imageDecodeToBgra8(
g_allocator
, temp
, mip.m_data
, mip.m_width
, mip.m_height
, srcpitch
, mip.m_format
);

bx::memCopy(bits, temp, pitch, height, srcpitch, pitch);

BX_FREE(g_allocator, temp);
}
else
{
bimg::imageDecodeToBgra8(bits, mip.m_data, mip.m_width, mip.m_height, pitch, mip.m_format);
bimg::imageDecodeToBgra8(g_allocator, bits, mip.m_data, mip.m_width, mip.m_height, pitch, mip.m_format);
}
}
else
Expand Down Expand Up @@ -3051,7 +3053,7 @@ namespace bgfx { namespace d3d9
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
bimg::imageDecodeToBgra8(temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
bimg::imageDecodeToBgra8(g_allocator, temp, data, _rect.m_width, _rect.m_height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
data = temp;
}

Expand Down
6 changes: 4 additions & 2 deletions src/renderer_gl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5151,7 +5151,9 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );

if (convert)
{
imageDecodeToRgba8(temp
imageDecodeToRgba8(
g_allocator
, temp
, mip.m_data
, mip.m_width
, mip.m_height
Expand Down Expand Up @@ -5320,7 +5322,7 @@ BX_TRACE("%d, %d, %d, %s", _array, _srgb, _mipAutogen, getName(_format) );

if (convert)
{
bimg::imageDecodeToRgba8(temp, data, width, height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
bimg::imageDecodeToRgba8(g_allocator, temp, data, width, height, srcpitch, bimg::TextureFormat::Enum(m_requestedFormat) );
data = temp;
srcpitch = rectpitch;
}
Expand Down
8 changes: 6 additions & 2 deletions src/renderer_mtl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2707,7 +2707,9 @@ void writeString(bx::WriterI* _writer, const char* _str)

if (convert)
{
bimg::imageDecodeToBgra8(temp
bimg::imageDecodeToBgra8(
g_allocator
, temp
, mip.m_data
, mip.m_width
, mip.m_height
Expand Down Expand Up @@ -2780,7 +2782,9 @@ void writeString(bx::WriterI* _writer, const char* _str)
if (convert)
{
temp = (uint8_t*)BX_ALLOC(g_allocator, rectpitch*_rect.m_height);
bimg::imageDecodeToBgra8(temp
bimg::imageDecodeToBgra8(
g_allocator
, temp
, data
, _rect.m_width
, _rect.m_height
Expand Down

0 comments on commit e9869fb

Please sign in to comment.