Ok, I'm sooo close now...
On devices where GXIsDisplayDRAMBuffer() returns false, you want to do your own double-buffering. Fine, good.
My question is this: what is the PROPER way to calculate the size of the memory chunk to allocate for the buffer?
I'm currently doing the following:
(I left out all the conditional stuff, this is the relevant part I think)
I add 500 just for safety, and because it seemed like not doing it I was having some problems on my E-125, so I figured a little extra wasn't going to hurt very much.
However, this strikes me as being the wrong way to calculate it anyway. It occurs to me that some devices, iPaqs I think, return -1 as their yPitch, so it doesn't seem like it's going to work in that case.
Can anyone show me the right way to do it (or tell me I in fact got lucky and am ALREADY doing it right??)
Thanks very much!
On devices where GXIsDisplayDRAMBuffer() returns false, you want to do your own double-buffering. Fine, good.
My question is this: what is the PROPER way to calculate the size of the memory chunk to allocate for the buffer?
I'm currently doing the following:
- Code:
GXDisplayProperties GX_g_gxdp = GXGetDisplayProperties();
GX_xPitch = GX_g_gxdp.cbxPitch >> 1;
GX_yPitch = GX_g_gxdp.cbyPitch >> 1;
GX_bufferSize = (320 * (GX_yPitch * 2)) + 500;
GX_pScreenBuffer = (unsigned short int*)malloc(GX_bufferSize);
(I left out all the conditional stuff, this is the relevant part I think)
I add 500 just for safety, and because it seemed like not doing it I was having some problems on my E-125, so I figured a little extra wasn't going to hurt very much.
However, this strikes me as being the wrong way to calculate it anyway. It occurs to me that some devices, iPaqs I think, return -1 as their yPitch, so it doesn't seem like it's going to work in that case.
Can anyone show me the right way to do it (or tell me I in fact got lucky and am ALREADY doing it right??)
Thanks very much!