Mercurial > MadButterfly
comparison 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 |
comparison
equal
deleted
inserted
replaced
347:b247beaac4f0 | 348:04d22dc38bc0 |
---|---|
69 { | 69 { |
70 redraw_man_t *rdman = MBAPP_RDMAN(myApp); | 70 redraw_man_t *rdman = MBAPP_RDMAN(myApp); |
71 mb_img_ldr_t *ldr = rdman_img_ldr(rdman); | 71 mb_img_ldr_t *ldr = rdman_img_ldr(rdman); |
72 mb_img_data_t *img = MB_IMG_LDR_LOAD(ldr, path); | 72 mb_img_data_t *img = MB_IMG_LDR_LOAD(ldr, path); |
73 shape_t *obj = (shape_t *) MB_SPRITE_GET_OBJ(myApp->rootsprite, "previewimg"); | 73 shape_t *obj = (shape_t *) MB_SPRITE_GET_OBJ(myApp->rootsprite, "previewimg"); |
74 | 74 mb_img_data_t *previewimg_img_data; |
75 mb_img_data_t *old_img; | |
76 | |
77 previewimg_img_data = | |
78 (mb_img_data_t *)MB_SPRITE_GET_OBJ(myApp->rootsprite, | |
79 "previewimg_img_data"); | |
75 printf("Preview %s\n",path); | 80 printf("Preview %s\n",path); |
76 if (img) { | 81 if (img) { |
77 printf("image %d %d\n",img->w,img->h); | 82 printf("image %d %d\n",img->w,img->h); |
78 sh_image_set_img_data(obj,img,0,0,img->w,img->h); | 83 old_img = sh_image_get_img_data(obj); |
84 sh_image_set_img_data(obj,img); | |
85 if(old_img != previewimg_img_data) | |
86 MB_IMG_DATA_FREE(old_img); | |
79 rdman_shape_changed(MBAPP_RDMAN(myApp),obj); | 87 rdman_shape_changed(MBAPP_RDMAN(myApp),obj); |
80 rdman_redraw_changed(MBAPP_RDMAN(myApp)); | 88 rdman_redraw_changed(MBAPP_RDMAN(myApp)); |
81 } | 89 } |
82 } | 90 } |
83 | 91 |