#91864 - TheRain - Mon Jul 10, 2006 8:22 am
I'm looking for some tips for speeding up pixel manipulation on the DS including common math functions used for 2-d effects. I have been working the past few days on some simple pixel color grabbing and writing routines and trying to use these to draw effects such as blurring pixels, water effect and other simple effects... and I'm finding my functions are running quite slow. I am using mode 5 graphics and doing buffer flipping. if it helps, here are my 16 bit color pixel read and write routines:
additionally, I am using this code to write the backbuffer to the frontbuffer, and I'm not sure if it's the right thing to use...
Code: |
void set_Pixel(u16* buffer,u8 x, u8 y, u8 R,u8 G,u8 B) { buffer[y * 256 + x] = RGB15(R, G, B) | BIT(15); } u8 get_R(u16* buffer,u8 x,u8 y) {u8 r; r=buffer[y * 256 + x]; r=r & 0x1F; return r; } u8 get_G(u16* buffer, u8 x,u8 y) {u8 g; g=buffer[y * 256 + x] <<5; g=g & 0x1F; return g; } u8 get_B(u16* buffer,u8 x,u8 y) {u8 b; b=buffer[y * 256 + x] <<10; b=b & 0x1f; return b; } |
additionally, I am using this code to write the backbuffer to the frontbuffer, and I'm not sure if it's the right thing to use...
Code: |
dmaCopy(backBuffer,frontBuffer,256*256*2); |