Mercurial > MadButterfly
changeset 1096:c18ad321844d
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).
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Sat, 04 Dec 2010 16:22:11 +0800 |
parents | bced6fe39856 |
children | cb4a2ffdf9e8 fb79175e6cc3 |
files | src/paint.c |
diffstat | 1 files changed, 1 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- 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; }