# HG changeset patch # User Thinker K.F. Li # Date 1291450931 -28800 # Node ID c18ad321844dcb09ea97c59f1a05dc71379a2152 # Parent bced6fe39856ad10827f7152745b558250f2befa Create a pattern, for an image paint, from image directly. It skips a surface as an intermediate stage between image and pattern. We create the pattern directly from an image (mb_img_data_t). diff -r bced6fe39856 -r c18ad321844d src/paint.c --- a/src/paint.c Sat Dec 04 13:48:43 2010 +0800 +++ b/src/paint.c Sat Dec 04 16:22:11 2010 +0800 @@ -274,7 +274,6 @@ typedef struct _paint_image { paint_t paint; mb_img_data_t *img; - mbe_surface_t *surf; mbe_pattern_t *ptn; } paint_image_t; @@ -294,7 +293,6 @@ paint_image_t *paint_img = (paint_image_t *)paint; mb_img_data_t *img_data; - mbe_surface_destroy(paint_img->surf); img_data = paint_img->img; MB_IMG_DATA_FREE(img_data); paint_destroy(&paint_img->paint); @@ -319,21 +317,9 @@ paint_init(&paint->paint, MBP_IMAGE, paint_image_prepare, paint_image_free); paint->img = img; - paint->surf = mbe_image_surface_create_for_data(img->content, - img->fmt, - img->w, - img->h, - img->stride); - if(paint->surf == NULL) { - paint_destroy(&paint->paint); - elmpool_elm_free(rdman->paint_image_pool, paint); - return NULL; - } - - paint->ptn = mbe_pattern_create_for_surface(paint->surf); + paint->ptn = mbe_pattern_create_image(img); if(paint->ptn == NULL) { paint_destroy(&paint->paint); - mbe_surface_destroy(paint->surf); elmpool_elm_free(rdman->paint_image_pool, paint); return NULL; }