comparison examples/menu/filebrowser.c @ 542:d7f224b97b7f Android_Skia

Fix the wrong way of getting the paint of an image. You can not get paint of an image with symbol looking up. I don't why we do it in this way, here.
author Thinker K.F. Li <thinker@branda.to>
date Wed, 26 May 2010 00:51:12 +0800
parents 26c302b47de1
children 8863d23cea4b
comparison
equal deleted inserted replaced
541:f42419c08a65 542:d7f224b97b7f
67 67
68 void mypreview(app_data_t *data, char *path) 68 void mypreview(app_data_t *data, char *path)
69 { 69 {
70 redraw_man_t *rdman = MBAF_RDMAN(app); 70 redraw_man_t *rdman = MBAF_RDMAN(app);
71 paint_t *paint, *old_paint; 71 paint_t *paint, *old_paint;
72 paint_t *previewimg_paint;
73 shape_t *obj = (shape_t *) MB_SPRITE_GET_OBJ(app->rootsprite, "previewimg"); 72 shape_t *obj = (shape_t *) MB_SPRITE_GET_OBJ(app->rootsprite, "previewimg");
74 int w, h; 73 int w, h;
75 74
76 previewimg_paint =
77 (paint_t *)MB_SPRITE_GET_OBJ(app->rootsprite,
78 "previewimg_paint_img");
79 printf("Preview %s\n",path); 75 printf("Preview %s\n",path);
80 paint = rdman_img_ldr_load_paint(rdman, path); 76 paint = rdman_img_ldr_load_paint(rdman, path); /* return a cached
77 * paint if the
78 * path was loaded
79 * before */
81 if (paint) { 80 if (paint) {
82 paint_image_get_size(paint, &w, &h); 81 paint_image_get_size(paint, &w, &h);
83 printf("image %d %d\n",w, h); 82 printf("image %d %d\n",w, h);
84 old_paint = sh_get_fill(obj); 83 old_paint = sh_get_fill(obj);
85 rdman_paint_fill(rdman, paint, obj); 84 rdman_paint_fill(rdman, paint, obj);
86 if(old_paint != previewimg_paint) 85 if(old_paint != paint)
87 rdman_paint_free(rdman, old_paint); 86 rdman_paint_free(rdman, old_paint);
88 87
89 rdman_shape_changed(MBAF_RDMAN(app),obj); 88 rdman_shape_changed(MBAF_RDMAN(app),obj);
90 rdman_redraw_changed(MBAF_RDMAN(app)); 89 rdman_redraw_changed(MBAF_RDMAN(app));
91 } 90 }