Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
GetTextureBGRA()'s 'width' and 'height' parameters should be unsigned.
  • Loading branch information
lioncash committed Jan 14, 2013
1 parent 5005d52 commit 8cf3ea3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
16 changes: 10 additions & 6 deletions Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.cpp
Expand Up @@ -62,8 +62,8 @@ void SaveTexture(const char* filename, u32 texmap, s32 mip)

TexImage0& ti0 = texUnit.texImage0[subTexmap];

int width = ti0.width + 1;
int height = ti0.height + 1;
u32 width = ti0.width + 1;
u32 height = ti0.height + 1;

u8 *data = new u8[width * height * 4];

Expand All @@ -74,19 +74,23 @@ void SaveTexture(const char* filename, u32 texmap, s32 mip)
delete []data;
}

void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, int width, int height)
void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height)
{
u8 sample[4];

for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++) {
for (u32 y = 0; y < height; y++)
{
for (u32 x = 0; x < width; x++)
{
TextureSampler::SampleMip(x << 7, y << 7, mip, false, texmap, sample);
// rgba to bgra

// RGBA to BGRA
*(dst++) = sample[2];
*(dst++) = sample[1];
*(dst++) = sample[0];
*(dst++) = sample[3];
}
}
}

s32 GetMaxTextureLod(u32 texmap)
Expand Down
2 changes: 1 addition & 1 deletion Source/Plugins/Plugin_VideoSoftware/Src/DebugUtil.h
Expand Up @@ -22,7 +22,7 @@ namespace DebugUtil
{
void Init();

void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, int width, int height);
void GetTextureBGRA(u8 *dst, u32 texmap, s32 mip, u32 width, u32 height);

void DumpActiveTextures();

Expand Down

0 comments on commit 8cf3ea3

Please sign in to comment.