so, i'm having problems displaying bitmaps, in aplite, not basalt. yes, know it's amount of memory, when @ heap_bytes_free, , take memory fragmentation account, still don't see problem is.
below, show code , debug output logs, , seems in second case, there inordinate amount of memory being grabbed display bitmap.
i'm displaying 2 bitmaps, of similar sizes. first, compasswindow.png, uses 3k in aplite , 6k in basalt. second, decimalbackground.png uses 22k in basalt (yes 22,560 bytes!) , fails created in aplite.
when running in aplite, no error message. bitmap fails display. what's happening?
here's logs same code being run on 2 platforms pebble original (aplite), , pebble time (basalt)
sdk 4.0.1 ubuntu virtualbox under windoows 10. app 3.8.1-942-b60f188, watch v3.8.2 (og , time) here's code. have put app_log before , after gbitmap_create_with_resource command. a) compass bitmap
bitmap_layer = bitmap_layer_create(grect(0, 0, 144,168)); app_log(app_log_level_debug, "compass free: %d ", heap_bytes_free()); gbitmap = gbitmap_create_with_resource(resource_id_compass); app_log(app_log_level_debug, "compass %d free: %d ", (int) gbitmap, heap_bytes_free()); bitmap_layer_set_bitmap (bitmap_layer, gbitmap );
b) decimalbackground bitmap
bitmap_layer = bitmap_layer_create(grect(0, 0, 144,300)); app_log(app_log_level_debug, "decimalbackground free: %d ", heap_bytes_free()); gbitmap = gbitmap_create_with_resource(resource_id_decimalbackground); app_log(app_log_level_debug, "decimalbackground %d free: %d ", (int) gbitmap, heap_bytes_free()); bitmap_layer_set_bitmap (bitmap_layer, gbitmap);
here resource definitions in appinfo.json. you'll notice i'm using new unified "bitmap" type.
"media": [ { "type": "bitmap", "name": "compass", "file": "images/compasswindow.png" }, { "type": "bitmap", "name": "decimalbackground", "file": "images/decimalbackground.png" },
here's output: 1. basalt:
[10:54:44] wind_dir.c:101> compass free: 45928 [10:54:44] wind_dir.c:103> compass 537019168 free: 39664 [10:54:44] msg_handler.c:46> current window: startwind 13 seconds later [10:54:57] javascript> raceqs v0.81:294 current window: performance [10:54:57] position.c:171> decimalbackground free: 46132 [10:54:57] position.c:173> decimalbackground 537019212 free: 23572
note: @ 10:54:44, bytes free go 45928 39644 - difference of 6264
at 10:54:57, go 46132 23572 - difference of 22,560. 2. aplite:
[10:47:13] wind_dir.c:101> compass free: 4856 [10:47:14] wind_dir.c:103> compass 536994972 free: 1776 [10:47:20] position.c:171> decimalbackground free: 5060 [10:47:20] position.c:173> decimalbackground 0 free: 5060
at 10:47:14 bytes free go 4865 1776 - difference of 3080. @ 10:47:20 bytes_free don't change because gbitmap_create_with_resource(resource_id_decimalbackground);fails. , here images., file sizes :
-rwxrwx--- 1 alan alan 2772 oct 14 11:55 compasswindow.png
-rwxrwx--- 1 alan alan 1637 jan 18 16:02 decimalbackground.png
the problem trying set image big in bitmap layer. had similar problem aplite big horizontal image. noticed if bitmap_layer bigger screen doesn't appear. think can bit bigger definetely not double height or that.
what did chopping image in 2 , changing 1 other when needed.
Comments
Post a Comment