Mercurial > MadButterfly
comparison examples/menu/filebrowser.c @ 354:92e8f9965f9a
merge
author | wycc |
---|---|
date | Mon, 09 Mar 2009 01:30:19 +0800 |
parents | 04d22dc38bc0 |
children | 3e84458968ec |
comparison
equal
deleted
inserted
replaced
353:3d03451be435 | 354:92e8f9965f9a |
---|---|
65 } | 65 } |
66 | 66 |
67 | 67 |
68 void mypreview(MyAppData *data, char *path) | 68 void mypreview(MyAppData *data, char *path) |
69 { | 69 { |
70 mb_img_data_t *img = MB_IMG_LDR_LOAD(rdman_img_ldr(MBAPP_RDMAN(myApp)), path); | 70 redraw_man_t *rdman = MBAPP_RDMAN(myApp); |
71 mb_img_ldr_t *ldr = rdman_img_ldr(rdman); | |
72 mb_img_data_t *img = MB_IMG_LDR_LOAD(ldr, path); | |
71 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"); |
72 | 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"); | |
73 printf("Preview %s\n",path); | 80 printf("Preview %s\n",path); |
74 if (img) { | 81 if (img) { |
75 printf("image %d %d\n",img->w,img->h); | 82 printf("image %d %d\n",img->w,img->h); |
76 sh_image_set_img_data(obj,img,0,0,img->w,img->h); | 83 old_img = sh_image_get_img_data(obj); |
77 sh_image_transform(obj); | 84 sh_image_set_img_data(obj,img); |
85 if(old_img != previewimg_img_data) | |
86 MB_IMG_DATA_FREE(old_img); | |
78 rdman_shape_changed(MBAPP_RDMAN(myApp),obj); | 87 rdman_shape_changed(MBAPP_RDMAN(myApp),obj); |
79 rdman_redraw_changed(MBAPP_RDMAN(myApp)); | 88 rdman_redraw_changed(MBAPP_RDMAN(myApp)); |
80 } | 89 } |
81 } | 90 } |
82 | 91 |