Skip to content

Instantly share code, notes, and snippets.

@Subv
Created February 22, 2015 22:19
Show Gist options
  • Save Subv/db427feeba8e766f5c1d to your computer and use it in GitHub Desktop.
Save Subv/db427feeba8e766f5c1d to your computer and use it in GitHub Desktop.
static bool RGBA8_To_RGB8_Different_Sizes(u32*, u32*) {
u32* input = (u32*)linearAlloc(0x200 * 0x190 * 4);
u32* output = (u32*)linearAlloc(0xF0 * 0x190 * 4);
SCOPE_EXIT({
linearFree(input);
linearFree(output);
});
memset(input, 0, 0x200 * 0x190 * 4);
memset(output, 0, 0xF0 * 0x190 * 4);
//Test Red Input
*input = 0xFF000000; //Input
*output = 0; //Output
DisplayTransferAndWait(input, output, Dimensions(0x200, 0x190), Dimensions(0xF0, 0x190), IN_RGBA8 | OUT_RGB8);
TestEquals(*output, (u32)0x00FF0000u);
//Test Green Input
*input = 0x00FF0000; //Input
*output = 0; //Output
DisplayTransferAndWait(input, output, Dimensions(0x200, 0x190), Dimensions(0xF0, 0x190), IN_RGBA8 | OUT_RGB8);
TestEquals(*output, (u32)0x0000FF00u);
//Test Blue Input
*input = 0x0000FF00; //Input
*output = 0; //Output
DisplayTransferAndWait(input, output, Dimensions(0x200, 0x190), Dimensions(0xF0, 0x190), IN_RGBA8 | OUT_RGB8);
TestEquals(*output, (u32)0x000000FFu);
//Test Alpha Input
*input = 0x000000FF; //Input
*output = 0; //Output
DisplayTransferAndWait(input, output, Dimensions(0x200, 0x190), Dimensions(0xF0, 0x190), IN_RGBA8 | OUT_RGB8);
TestEquals(*output, (u32)0x00000000u);
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment