Mercurial > MadButterfly
diff examples/menu/filebrowser.c @ 348:04d22dc38bc0
Change declaration of sh_image_set_img_data().
- x, y, w, h are not passed to sh_image_set_img_data() any more.
- Applications should manage life-cycle of mb_img_data_t, paint_image_t do
not manage it for applications any more.
author | Thinker K.F. Li <thinker@branda.to> |
---|---|
date | Sun, 08 Mar 2009 22:24:54 +0800 |
parents | b247beaac4f0 |
children | 3e84458968ec |
line wrap: on
line diff
--- a/examples/menu/filebrowser.c Sun Mar 08 21:57:15 2009 +0800 +++ b/examples/menu/filebrowser.c Sun Mar 08 22:24:54 2009 +0800 @@ -71,11 +71,19 @@ mb_img_ldr_t *ldr = rdman_img_ldr(rdman); mb_img_data_t *img = MB_IMG_LDR_LOAD(ldr, path); shape_t *obj = (shape_t *) MB_SPRITE_GET_OBJ(myApp->rootsprite, "previewimg"); + mb_img_data_t *previewimg_img_data; + mb_img_data_t *old_img; + previewimg_img_data = + (mb_img_data_t *)MB_SPRITE_GET_OBJ(myApp->rootsprite, + "previewimg_img_data"); printf("Preview %s\n",path); if (img) { printf("image %d %d\n",img->w,img->h); - sh_image_set_img_data(obj,img,0,0,img->w,img->h); + old_img = sh_image_get_img_data(obj); + sh_image_set_img_data(obj,img); + if(old_img != previewimg_img_data) + MB_IMG_DATA_FREE(old_img); rdman_shape_changed(MBAPP_RDMAN(myApp),obj); rdman_redraw_changed(MBAPP_RDMAN(myApp)); }