diff 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
line wrap: on
line diff
--- a/examples/menu/filebrowser.c	Mon May 24 21:09:32 2010 +0800
+++ b/examples/menu/filebrowser.c	Wed May 26 00:51:12 2010 +0800
@@ -69,21 +69,20 @@
 {
     redraw_man_t *rdman = MBAF_RDMAN(app);
     paint_t *paint, *old_paint;
-    paint_t *previewimg_paint;
     shape_t *obj = (shape_t *) MB_SPRITE_GET_OBJ(app->rootsprite, "previewimg");
     int w, h;
 
-    previewimg_paint =
-	(paint_t *)MB_SPRITE_GET_OBJ(app->rootsprite,
-					   "previewimg_paint_img");
     printf("Preview %s\n",path);
-    paint = rdman_img_ldr_load_paint(rdman, path);
+    paint = rdman_img_ldr_load_paint(rdman, path); /* return a cached
+						    * paint if the
+						    * path was loaded
+						    * before */
     if (paint) {
 	paint_image_get_size(paint, &w, &h);
 	printf("image %d %d\n",w, h);
 	old_paint = sh_get_fill(obj);
 	rdman_paint_fill(rdman, paint, obj);
-	if(old_paint != previewimg_paint)
+	if(old_paint != paint)
 	    rdman_paint_free(rdman, old_paint);
 	    
 	rdman_shape_changed(MBAF_RDMAN(app),obj);