PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Drawing the screen

I just want to be sure of this before I redo my rendering routines.

If I am running fullscreen on Pocket PC, and I've drawn my screen to the back buffer, then subsequently I only need to draw the parts that changed?

Under what circumstances must I redraw the entire screen? After coming back from a minimize, I suppose? Any other times?

I want to know so I can remove some needless blitting, but I want to be sure I do blit them at the appropriate time so I don't look corrupt.
I think the short answer is that by using GAPI, you have complete control of the device, and therefore it is completely up to you. I'm not aware of any way to minimze a GAPI-based application that's running full-screen, so it's not an issue (assuming there's no way that I DON'T know about).

Where this can become an issue is if you want ot support PPC Phone Edition too. Someone can correct me if I'm wrong, but I believe on those devices, calls can interrupt any running application and minimize it. I'm 99% sure this is true on Smartphones anyway, I think it's also the case on Phone Edition devices.

I doubt there's any real convention otherwise, it comes down to what your doing. I personally find it far easier to redraw everything every frame and just make it as efficient as possible to keep the frame rate up. That's obviously not always going to be feasible, but whenever it is I prefer going that route.
BradK3 · 13 Jan 2004, 05:09 UTC — Redrawing
I believe (at least this is true on my Casio E-125) that when the PPC is turned off, your backbuffer is lost. I wrote a simple drawing program to keep my 15 month-old daughter entertained. It works by drawing a dot dot of color to the backbuffer at the pen coordinates when the stylus is pressed down or moved. It only draws a single dot at a time, assuming the previous dots remain on screen. This is true until I turn the PPC off and then on. Everything is lost at that point.

So, there's one situation that would require a refresh of the backbuffer.
On some devices that use DMA backbuffering (such as the E125) you have to redraw the entire backbuffer. You can check this by calling GetSurfaceFlags on the display surface. If the flag GDSURFACE_PRIMARY is set on the display (not backbuffer), GapiDraw is doing the backbuffering on the PDA and you can safely redraw only the areas that have changed.

The only devices that both has the flag GDSURFACE_PRIMARY set, AND where the entire backbuffer needs to be updated on each frame are stationary PCs running in full screen mode.

Generally I recommend that you always redraw the entire backbuffer, in cases where there some day might come devices with true page flipping running the WM2003 operating system.
I agree with Johan. Unless you want serious headaches just redraw the whole backbuffer. I've already gone the route of dirty rectangles and I found negligable speed increases on the small screen space of handheld devices.

As for minimizing apps on incoming phone calls, follow the gapidraw instructions on how to handle the events. All of our products work perfectly on phone edition devices.
I think I might be able to draw the entire screen each frame. I reimplemented my rendering last night and this morning, and it yields much better performance now. If it works well on all devices, I'll keep it that way. And if it needs a bit of a performance boost on lower devices, I'll consider adding it as an option to not blit clean rectangles (but keep it as an option for devices that need it).

Thanks for the tips!