mirror of
https://github.com/switchbrew/switch-examples.git
synced 2025-06-21 13:22:40 +02:00
Perf adjustments for simplegfx.
This commit is contained in:
parent
7c8ca82f2a
commit
20abcd733e
@ -14,6 +14,7 @@ int main(int argc, char **argv)
|
|||||||
u32 image_width = 1280, image_height = 720;
|
u32 image_width = 1280, image_height = 720;
|
||||||
u32 tmp_width, tmp_height;
|
u32 tmp_width, tmp_height;
|
||||||
u32 x, y;
|
u32 x, y;
|
||||||
|
u32 j;
|
||||||
u32 pos;
|
u32 pos;
|
||||||
u32 pos2;
|
u32 pos2;
|
||||||
u8 *imageptr = (u8*)image_bin;
|
u8 *imageptr = (u8*)image_bin;
|
||||||
@ -52,14 +53,14 @@ int main(int argc, char **argv)
|
|||||||
if(tmp_height > height) tmp_height = height;
|
if(tmp_height > height) tmp_height = height;
|
||||||
|
|
||||||
memset(framebuf, 0xff, gfxGetFramebufferSize());
|
memset(framebuf, 0xff, gfxGetFramebufferSize());
|
||||||
for(x=0; x<image_width; x++)
|
for(x=0; x<image_width; x+=4)//Every 4 pixels with the below pixel-format is stored consecutively in memory.
|
||||||
{
|
{
|
||||||
for(y=0; y<image_height; y++)
|
for(y=0; y<image_height; y++)
|
||||||
{
|
{
|
||||||
//Each pixel is 4-bytes due to RGBA8888.
|
//Each pixel is 4-bytes due to RGBA8888.
|
||||||
pos = gfxGetFramebufferDisplayOffset(x, y);
|
pos = gfxGetFramebufferDisplayOffset(x, y);
|
||||||
pos2 = (x + (y*image_width)) * 3;
|
pos2 = (x + (y*image_width)) * 3;
|
||||||
framebuf32[pos] = RGBA8_MAXALPHA(imageptr[pos2+0]+(cnt*4), imageptr[pos2+1], imageptr[pos2+2]);
|
for(j=0; j<4; j++)framebuf32[pos+j] = RGBA8_MAXALPHA(imageptr[pos2+0+(j*3)]+(cnt*4), imageptr[pos2+1+(j*3)], imageptr[pos2+2+(j*3)]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user