One bitmap per Window or one bitmap per LCD screen?

I’ve started to experiment with Glide on a Cobra 1 with a 7-inch display. My application has many windows. Following the examples provided, I created/loaded all the windows and saved them in static properties of the Program class. After a while I ended up with out-of-memory errors. I examined the Glide code and realized that when a window is created an LCD-sized bitmap object is also created and stored along with the window in memory.

Digging a little deeper, I also realized that when a window becomes the current window (by setting the Glide.MainWindow property) the window’s bitmap is completely re-drawn and is copied to the LCD.

It seems to me that as long as all windows occupy the full screen there only needs to be one bitmap for the LCD, and all windows should draw their contents onto this single bitmap.

Am I missing something?


Glide uses 1 bitmap per screen, just like you say.

Clix & Tinkr user 1 bitmap system wide (2 if you’re using a mouse so it can buffer the cursor overlay).

Course…Glide is free & open source.

@ Skewworks - Thanks, but I don’t understand your answer ???

Does your “Nope” mean that it doesn’t work that way, or that it can’t work that way? I know that currently each window creates its own bitmap. My question is whether this is really necessary since only one bitmap can be shown at a time anyway, and since each window completely redraws its bitmap when it becomes the current window, having multiple bitmaps doesn’t save any processing time.

Sorry, it was “nope” you’re not missing anything.

As for the reasoning behind a bitmap per screen; I think GHI did that from a performance standpoint. On switching from one screen to another (like with there screen animations) it definitely makes it faster for the CPU.

On my side of things I took the single screen approach to save resources. The trade of being when you switch screens, it has to render it a new. To do animations I allow for a background render to a separate bitmap.

Both approaches are valid. Working with micro-controllers you’re always performing a balancing act between speed and resources.

Glide was originally created as a GHI product and then released as open source. I am sure there are lots of opportunities for performance improvements in the code. I would not consider Glide as fully developed and optimized.

@ Mike, @ Skewworks - Thank you. For my application screen swaps are done when user’s press buttons, so speed is not important. It’s more important that I save memory.

I’ll make some mods to the Glide code for this project.