Bitmap vs. dc.drawXXX

Hi,

I'm experimenting with two versions of my watchface:

First is using background bitmap 218x218, 4 Bit color depth what makes it around 2K in Size
Second is using programmed Shapes using drawCircle, drawRectangle, etc.

With the first I sometimes get out of memory errors in simulator, sometimes it runs saying mem usage is 55 of 64 K
The second one is laggy, It takes more time to switch between Screens and messages are shown one or two seconds after vibration
Mem Usage is 40K.

And so are my questions:
- Why does a 2K Bitmap use 14K of memory? Bitmap ist loaded in onLayout and drawn in onUpdate ?
- I'm using caches for sin and cos calculations. My second watchface is making around 85 calls to draw... or fill...
with one call to setColor per call. Is that really so costly that I should experience lag ?

Thanks!

Peter
  • Here's a discussion on bitmaps and memory usage and how to make them use less memory.
  • Former Member
    Former Member over 10 years ago
    I think your bitmap size calculation is flawed. The 218x218 screen has 47,524 pixels. If the bitmap has 4bit color depth, then each pixel takes 1/2 of a byte. That bitmap would be 23,762 bytes = 23.2KB.

    I can't really say how many graphics calls I would expect to be possible without visible lag. Remember that the code is running through a virtual machine, and each operation has a cost before it even gets to the system call. Anything you can do to reduce the number of operations may improve performance.