forked from enlightenment/efl
Fix image alpha_set() and fix compiler warning, minor fixes.
SVN revision: 32165
This commit is contained in:
parent
8ee9f51f5b
commit
3209b5f4e8
|
@ -14,9 +14,6 @@
|
|||
fprintf(stderr, "NOT_IMPLEMENTED: %s() at %s:%d\n", \
|
||||
__FUNCTION__, __FILE__, __LINE__)
|
||||
|
||||
|
||||
static int cpunum = 0;
|
||||
|
||||
static void *
|
||||
eng_context_new(void *data)
|
||||
{
|
||||
|
@ -333,8 +330,7 @@ eng_image_alpha_get(void *data, void *image)
|
|||
|
||||
if (!image) return 0;
|
||||
im = image;
|
||||
if (im->have_alpha) return 1;
|
||||
return 0;
|
||||
return im->have_alpha;
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -348,7 +344,7 @@ eng_image_alpha_set(void *data, void *image, int have_alpha)
|
|||
{
|
||||
if (!image) return NULL;
|
||||
have_alpha = !!have_alpha;
|
||||
soft16_image_alpha_set(image, have_alpha);
|
||||
image = soft16_image_alpha_set(image, have_alpha);
|
||||
return image;
|
||||
}
|
||||
|
||||
|
@ -372,6 +368,7 @@ eng_image_comment_get(void *data, void *image, char *key)
|
|||
static char *
|
||||
eng_image_format_get(void *data, void *image)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -384,11 +381,13 @@ eng_image_colorspace_set(void *data, void *image, int cspace)
|
|||
static void
|
||||
eng_image_native_set(void *data, void *image, void *native)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
}
|
||||
|
||||
static void *
|
||||
eng_image_native_get(void *data, void *image)
|
||||
{
|
||||
NOT_IMPLEMENTED();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -843,7 +842,6 @@ module_open(Evas_Module *em)
|
|||
{
|
||||
if (!em) return 0;
|
||||
em->functions = (void *)(&func);
|
||||
cpunum = evas_common_cpu_count();
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ void soft16_image_free(Soft16_Image *im);
|
|||
Soft16_Image *soft16_image_load(const char *file, const char *key, int *error, Evas_Image_Load_Opts *lo);
|
||||
void soft16_image_load_data(Soft16_Image *im);
|
||||
void soft16_image_draw(Soft16_Image *src, Soft16_Image *dst, RGBA_Draw_Context *dc, int src_region_x, int src_region_y, int src_region_w, int src_region_h, int dst_region_x, int dst_region_y, int dst_region_w, int dst_region_h, int smooth);
|
||||
void soft16_image_alpha_set(Soft16_Image *im, int have_alpha);
|
||||
Soft16_Image *soft16_image_alpha_set(Soft16_Image *im, int have_alpha);
|
||||
Soft16_Image *soft16_image_size_set(Soft16_Image *im, int w, int h);
|
||||
|
||||
|
||||
|
@ -123,6 +123,6 @@ soft16_line_draw(Soft16_Image *dst, RGBA_Draw_Context *dc, int x0, int y0, int x
|
|||
*/
|
||||
void *soft16_font_glyph_new(void *data, RGBA_Font_Glyph *fg);
|
||||
void soft16_font_glyph_free(void *ext_dat);
|
||||
void soft16_font_glyph_draw(Soft16_Image *dst, void *data, RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg, int x, int y);
|
||||
void soft16_font_glyph_draw(void *data, void *dest, void *context, RGBA_Font_Glyph *fg, int x, int y);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -246,16 +246,20 @@ _soft16_font_glyph_draw_mono(Soft16_Image *dst,
|
|||
}
|
||||
|
||||
void
|
||||
soft16_font_glyph_draw(Soft16_Image *dst, void *data,
|
||||
RGBA_Draw_Context *dc, RGBA_Font_Glyph *fg,
|
||||
int x, int y)
|
||||
soft16_font_glyph_draw(void *data, void *dest, void *context,
|
||||
RGBA_Font_Glyph *fg, int x, int y)
|
||||
{
|
||||
Soft16_Image *dst;
|
||||
RGBA_Draw_Context *dc;
|
||||
const DATA8 *bitmap;
|
||||
DATA8 alpha, r, g, b;
|
||||
DATA16 rgb565;
|
||||
Evas_Rectangle ext;
|
||||
int bpitch, bw, bh;
|
||||
|
||||
dst = data;
|
||||
dc = context;
|
||||
|
||||
alpha = A_VAL(&dc->col.col) >> 3;
|
||||
if (alpha == 0) return; /* precision is 5 bits, 3 bits lost */
|
||||
|
||||
|
|
|
@ -447,10 +447,10 @@ soft16_image_draw(Soft16_Image *src, Soft16_Image *dst,
|
|||
dc->clip = clip_bkp;
|
||||
}
|
||||
|
||||
void
|
||||
Soft16_Image *
|
||||
soft16_image_alpha_set(Soft16_Image *im, int have_alpha)
|
||||
{
|
||||
if (im->have_alpha == have_alpha) return;
|
||||
if (im->have_alpha == have_alpha) return im;
|
||||
im->have_alpha = have_alpha;
|
||||
|
||||
if ((im->pixels) && (im->free_pixels))
|
||||
|
@ -469,6 +469,16 @@ soft16_image_alpha_set(Soft16_Image *im, int have_alpha)
|
|||
im->alpha = (DATA8*)(im->pixels + size);
|
||||
memset(im->alpha, 0x1f, size);
|
||||
}
|
||||
return im;
|
||||
}
|
||||
else
|
||||
{
|
||||
Soft16_Image *im_new;
|
||||
|
||||
im_new = soft16_image_new(im->w, im->h, im->stride, have_alpha,
|
||||
im->pixels, 1);
|
||||
soft16_image_free(im);
|
||||
return im_new;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue