PocketMatrix forums

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

Display Clearing

I was considering modifying my game to be user selectable on running full screen or a smaller window (similar to what quake can do). I want the menu's and all to be the same, just the main game display to be smaller if they want (for performance issues).

The question is if the display->Clear is quicker than clearing three or four rectangles around the border of the "window" I always update.

The main "window" I speak of is always overwritten each frame, so I really don't need to clear that part. One would think that clearing only what you need would be faster, but I also think that the display->Clear routine is just a memset, so it may be faster to clear the whole thing than several subsets.

Any options or prior experience?

Thanks,
Jason
BIGBEN · 16 Jan 2004, 14:53 UTC — benchmarking...
I had some simple tests, so I noticed that in my game clearing the whole screen is about 30% faster then drawing a whole screen rect. It is even faster than filling 50% screen square rect.

That is quite good but I don't understand why display->Update(&Rect(...)) always updates Rect(0, YourY1, 240, YourY2) not Rect(YourX1, YourY1, YourX2, YourY2)? For me it is interesting why it is so.
I hadn't tried using display->Update with a rect before now... I set it to several sizes and it doesn't appear to do anything but fullscreen update on my device...
BIGBEN wrote:I had some simple tests, so I noticed that in my game clearing the whole screen is about 30% faster then drawing a whole screen rect. It is even faster than filling 50% screen square rect.

That is quite good but I don't understand why display->Update(&Rect(...)) always updates Rect(0, YourY1, 240, YourY2) not Rect(YourX1, YourY1, YourX2, YourY2)? For me it is interesting why it is so.


maybe for pitch reasons
Update() with a RECT can indeed (and often) update more then the specified rect. There can be different reasons for this:

1) True double buffering --> The whole screen is flipped and this you see the whole screen being updated.
2) Rotation is needed --> The internal blitter uses 16x16 pixels tiles. The RECT you specify can thus be enlarged to form 16x16 tiles.
3) DMA transfers are often faster and easier to setup if memory is continuous (i.e. no gaps). The RECT is thus enlarged to the width of the display (but the height is kept).

Etc etc.

This is normal behavior. The update RECT should not be used as a "clipper".