forked from enlightenment/ephoto
Ephoto: Factor out common code, use "start" for Windows based devices instead of xdg-open, improve compiler flags.
This commit is contained in:
parent
d8e2df3092
commit
3480bb44b3
|
@ -50,6 +50,14 @@ ephoto_thumbnail_CPPFLAGS = \
|
|||
-Wall \
|
||||
-Wextra \
|
||||
-Wshadow \
|
||||
-Wdeclaration-after-statement \
|
||||
-Wmissing-prototypes \
|
||||
-Wstrict-prototypes \
|
||||
-Wpointer-arith \
|
||||
-Wno-missing-field-initializers \
|
||||
-fvisibility=hidden \
|
||||
-fdata-sections \
|
||||
-ffunction-sections \
|
||||
@EFL_CFLAGS@
|
||||
|
||||
ephoto_thumbnail_LDADD = @EFL_LIBS@
|
||||
|
|
|
@ -344,7 +344,7 @@ static inline Eina_Bool
|
|||
_ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
|
||||
{
|
||||
const char *type, *bname;
|
||||
int i = 0;
|
||||
int i = 0, count = 0;
|
||||
|
||||
const char *filters[] = {
|
||||
"png", "jpeg", "jpg", "eet", "xpm", "tiff", "gif", "svg", "webp",
|
||||
|
@ -365,7 +365,7 @@ _ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
|
|||
type = strrchr(bname, '.');
|
||||
if (!type)
|
||||
return EINA_FALSE;
|
||||
int count = sizeof(filters) / sizeof(filters[0]);
|
||||
count = sizeof(filters) / sizeof(filters[0]);
|
||||
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
|
@ -379,14 +379,13 @@ _ephoto_eina_file_direct_info_image_useful(const Eina_File_Direct_Info *info)
|
|||
static inline Eina_Bool
|
||||
_ephoto_file_image_can_save(const char *ext)
|
||||
{
|
||||
int i = 0;
|
||||
int i = 0, count = 0;
|
||||
|
||||
const char *filters[] = {
|
||||
"png", "jpeg", "jpg", "eet", "xpm", "tiff", "tif", "gif", "svg", "webp",
|
||||
"pmaps", "bmp", "wbmp", "ico", "generic"
|
||||
};
|
||||
|
||||
int count = sizeof(filters) / sizeof(filters[0]);
|
||||
count = sizeof(filters) / sizeof(filters[0]);
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
if (!strcasecmp(ext, filters[i]))
|
||||
|
@ -395,6 +394,25 @@ _ephoto_file_image_can_save(const char *ext)
|
|||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
/*RGBA Functions*/
|
||||
static inline int
|
||||
ephoto_normalize_color(int color)
|
||||
{
|
||||
return (color >= 0 && color <= 255) ? color : (color < 0) ? 0 : 255;
|
||||
}
|
||||
|
||||
static inline int
|
||||
ephoto_mul_color_alpha(int color, int alpha)
|
||||
{
|
||||
return (alpha > 0 && alpha <= 255) ? (color * (255 /alpha)) : color;
|
||||
}
|
||||
|
||||
static inline int
|
||||
ephoto_demul_color_alpha(int color, int alpha)
|
||||
{
|
||||
return (alpha > 0 && alpha <= 255) ? ((color * alpha) / 255) : color;
|
||||
}
|
||||
|
||||
/*event types*/
|
||||
extern int EPHOTO_EVENT_ENTRY_CREATE;
|
||||
extern int EPHOTO_EVENT_POPULATE_START;
|
||||
|
|
|
@ -18,35 +18,6 @@ struct _Ephoto_BCG
|
|||
unsigned int *original_im_data;
|
||||
};
|
||||
|
||||
static int
|
||||
_normalize_color(int color)
|
||||
{
|
||||
if (color < 0)
|
||||
return 0;
|
||||
else if (color > 255)
|
||||
return 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_mul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return color * (255 / alpha);
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_demul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return (color * alpha) / 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
unsigned int *
|
||||
_ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness,
|
||||
unsigned int *image_data)
|
||||
|
@ -75,18 +46,18 @@ _ephoto_bcg_adjust_brightness(Ephoto_BCG *ebcg, int brightness,
|
|||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
bb = (int) b + ebcg->brightness;
|
||||
gg = (int) g + ebcg->brightness;
|
||||
rr = (int) r + ebcg->brightness;
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
p2++;
|
||||
p1++;
|
||||
|
@ -130,18 +101,18 @@ _ephoto_bcg_adjust_contrast(Ephoto_BCG *ebcg, int contrast,
|
|||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
bb = (int) ((factor * (b - 128)) + 128);
|
||||
gg = (int) ((factor * (g - 128)) + 128);
|
||||
rr = (int) ((factor * (r - 128)) + 128);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
p2++;
|
||||
p1++;
|
||||
|
@ -181,18 +152,18 @@ _ephoto_bcg_adjust_gamma(Ephoto_BCG *ebcg, double gamma,
|
|||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
bb = (int) (pow(((double) b / 255), ebcg->gamma) * 255);
|
||||
gg = (int) (pow(((double) g / 255), ebcg->gamma) * 255);
|
||||
rr = (int) (pow(((double) r / 255), ebcg->gamma) * 255);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
p2++;
|
||||
p1++;
|
||||
|
|
|
@ -18,41 +18,20 @@ struct _Ephoto_Color
|
|||
unsigned int *original_im_data;
|
||||
};
|
||||
|
||||
static int
|
||||
_normalize_color(int color)
|
||||
typedef enum _Ephoto_Color_Adjust Ephoto_Color_Adjust;
|
||||
enum _Ephoto_Color_Adjust
|
||||
{
|
||||
if (color < 0)
|
||||
return 0;
|
||||
else if (color > 255)
|
||||
return 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_mul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return color * (255 / alpha);
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_demul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return (color * alpha) / 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
EPHOTO_COLOR_ADJUST_RED,
|
||||
EPHOTO_COLOR_ADJUST_GREEN,
|
||||
EPHOTO_COLOR_ADJUST_BLUE
|
||||
};
|
||||
|
||||
unsigned int *
|
||||
_ephoto_color_adjust_red(Ephoto_Color *eco, int red, unsigned int *image_data)
|
||||
_ephoto_apply_color_adjustment(Ephoto_Color *eco, unsigned int *image_data, int adjust, Ephoto_Color_Adjust color)
|
||||
{
|
||||
unsigned int *im_data, *im_data_new, *p1, *p2;
|
||||
Evas_Coord x, y;
|
||||
int a, r, g, b, rr;
|
||||
int a, r, g, b, cc;
|
||||
|
||||
im_data = malloc(sizeof(unsigned int) * eco->w * eco->h);
|
||||
if (image_data)
|
||||
|
@ -61,7 +40,6 @@ _ephoto_color_adjust_red(Ephoto_Color *eco, int red, unsigned int *image_data)
|
|||
memcpy(im_data, eco->original_im_data,
|
||||
sizeof(unsigned int) * eco->w * eco->h);
|
||||
|
||||
eco->red = red;
|
||||
im_data_new = malloc(sizeof(unsigned int) * eco->w * eco->h);
|
||||
|
||||
for (y = 0; y < eco->h; y++)
|
||||
|
@ -74,115 +52,36 @@ _ephoto_color_adjust_red(Ephoto_Color *eco, int red, unsigned int *image_data)
|
|||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
rr = (int) r + eco->red;
|
||||
b = _normalize_color(b);
|
||||
g = _normalize_color(g);
|
||||
rr = _normalize_color(rr);
|
||||
b = _demul_color_alpha(b, a);
|
||||
g = _demul_color_alpha(g, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
*p2 = (a << 24) | (rr << 16) | (g << 8) | b;
|
||||
p2++;
|
||||
p1++;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image,
|
||||
im_data_new, eco->w, eco->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
}
|
||||
|
||||
unsigned int *
|
||||
_ephoto_color_adjust_green(Ephoto_Color *eco, int green,
|
||||
unsigned int *image_data)
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
switch (color)
|
||||
{
|
||||
unsigned int *im_data, *im_data_new, *p1, *p2;
|
||||
Evas_Coord x, y;
|
||||
int a, r, g, b, gg;
|
||||
|
||||
im_data = malloc(sizeof(unsigned int) * eco->w * eco->h);
|
||||
if (image_data)
|
||||
memcpy(im_data, image_data, sizeof(unsigned int) * eco->w * eco->h);
|
||||
else
|
||||
memcpy(im_data, eco->original_im_data,
|
||||
sizeof(unsigned int) * eco->w * eco->h);
|
||||
|
||||
eco->green = green;
|
||||
im_data_new = malloc(sizeof(unsigned int) * eco->w * eco->h);
|
||||
|
||||
for (y = 0; y < eco->h; y++)
|
||||
{
|
||||
p1 = im_data + (y * eco->w);
|
||||
p2 = im_data_new + (y * eco->w);
|
||||
for (x = 0; x < eco->w; x++)
|
||||
{
|
||||
b = (int) ((*p1) & 0xff);
|
||||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
gg = (int) g + eco->green;
|
||||
b = _normalize_color(b);
|
||||
gg = _normalize_color(gg);
|
||||
r = _normalize_color(r);
|
||||
b = _demul_color_alpha(b, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
r = _demul_color_alpha(r, a);
|
||||
*p2 = (a << 24) | (r << 16) | (gg << 8) | b;
|
||||
p2++;
|
||||
p1++;
|
||||
case EPHOTO_COLOR_ADJUST_RED:
|
||||
eco->red = adjust;
|
||||
cc = (int) r + eco->red;
|
||||
r = cc;
|
||||
break;
|
||||
case EPHOTO_COLOR_ADJUST_BLUE:
|
||||
eco->blue = adjust;
|
||||
cc = (int) b + eco->blue;
|
||||
b = cc;
|
||||
break;
|
||||
case EPHOTO_COLOR_ADJUST_GREEN:
|
||||
eco->green = adjust;
|
||||
cc = (int) g + eco->green;
|
||||
g = cc;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
ephoto_single_browser_image_data_update(eco->main, eco->image,
|
||||
im_data_new, eco->w, eco->h);
|
||||
free(im_data);
|
||||
return im_data_new;
|
||||
}
|
||||
|
||||
unsigned int *
|
||||
_ephoto_color_adjust_blue(Ephoto_Color *eco, int blue,
|
||||
unsigned int *image_data)
|
||||
{
|
||||
unsigned int *im_data, *im_data_new, *p1, *p2;
|
||||
Evas_Coord x, y;
|
||||
int a, r, g, b, bb;
|
||||
|
||||
im_data = malloc(sizeof(unsigned int) * eco->w * eco->h);
|
||||
if (image_data)
|
||||
memcpy(im_data, image_data, sizeof(unsigned int) * eco->w * eco->h);
|
||||
else
|
||||
memcpy(im_data, eco->original_im_data,
|
||||
sizeof(unsigned int) * eco->w * eco->h);
|
||||
|
||||
eco->blue = blue;
|
||||
im_data_new = malloc(sizeof(unsigned int) * eco->w * eco->h);
|
||||
|
||||
for (y = 0; y < eco->h; y++)
|
||||
{
|
||||
p1 = im_data + (y * eco->w);
|
||||
p2 = im_data_new + (y * eco->w);
|
||||
for (x = 0; x < eco->w; x++)
|
||||
{
|
||||
b = (int) ((*p1) & 0xff);
|
||||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
bb = (int) b + eco->blue;
|
||||
bb = _normalize_color(bb);
|
||||
g = _normalize_color(g);
|
||||
r = _normalize_color(r);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
g = _demul_color_alpha(g, a);
|
||||
r = _demul_color_alpha(r, a);
|
||||
*p2 = (a << 24) | (r << 16) | (g << 8) | bb;
|
||||
b = ephoto_normalize_color(b);
|
||||
g = ephoto_normalize_color(g);
|
||||
r = ephoto_normalize_color(r);
|
||||
b = ephoto_demul_color_alpha(b, a);
|
||||
g = ephoto_demul_color_alpha(g, a);
|
||||
r = ephoto_demul_color_alpha(r, a);
|
||||
*p2 = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
p2++;
|
||||
p1++;
|
||||
}
|
||||
|
@ -201,9 +100,9 @@ _red_slider_changed(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
|
|||
unsigned int *image_data, *image_data_two;
|
||||
|
||||
red = elm_slider_value_get(obj);
|
||||
image_data = _ephoto_color_adjust_red(eco, red, NULL);
|
||||
image_data_two = _ephoto_color_adjust_green(eco, eco->green, image_data);
|
||||
_ephoto_color_adjust_blue(eco, eco->blue, image_data_two);
|
||||
image_data = _ephoto_apply_color_adjustment(eco, NULL, red, EPHOTO_COLOR_ADJUST_RED);
|
||||
image_data_two = _ephoto_apply_color_adjustment(eco, image_data, eco->green, EPHOTO_COLOR_ADJUST_GREEN);
|
||||
_ephoto_apply_color_adjustment(eco, image_data_two, eco->blue, EPHOTO_COLOR_ADJUST_BLUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -215,9 +114,9 @@ _green_slider_changed(void *data, Evas_Object *obj,
|
|||
unsigned int *image_data, *image_data_two;
|
||||
|
||||
green = elm_slider_value_get(obj);
|
||||
image_data = _ephoto_color_adjust_green(eco, green, NULL);
|
||||
image_data_two = _ephoto_color_adjust_red(eco, eco->red, image_data);
|
||||
_ephoto_color_adjust_blue(eco, eco->blue, image_data_two);
|
||||
image_data = _ephoto_apply_color_adjustment(eco, NULL, green, EPHOTO_COLOR_ADJUST_GREEN);
|
||||
image_data_two = _ephoto_apply_color_adjustment(eco, image_data, eco->red, EPHOTO_COLOR_ADJUST_RED);
|
||||
_ephoto_apply_color_adjustment(eco, image_data_two, eco->blue, EPHOTO_COLOR_ADJUST_BLUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -229,9 +128,9 @@ _blue_slider_changed(void *data, Evas_Object *obj,
|
|||
unsigned int *image_data, *image_data_two;
|
||||
|
||||
blue = elm_slider_value_get(obj);
|
||||
image_data = _ephoto_color_adjust_blue(eco, blue, NULL);
|
||||
image_data_two = _ephoto_color_adjust_red(eco, eco->red, image_data);
|
||||
_ephoto_color_adjust_green(eco, eco->green, image_data_two);
|
||||
image_data = _ephoto_apply_color_adjustment(eco, NULL, blue, EPHOTO_COLOR_ADJUST_BLUE);
|
||||
image_data_two = _ephoto_apply_color_adjustment(eco, image_data, eco->red, EPHOTO_COLOR_ADJUST_RED);
|
||||
_ephoto_apply_color_adjustment(eco, image_data_two, eco->green, EPHOTO_COLOR_ADJUST_GREEN);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
|
|
@ -30,13 +30,13 @@ _config_save_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
if (strcmp(path, ephoto->config->directory) && strcmp(path, "Last") &&
|
||||
ecore_file_exists(path))
|
||||
{
|
||||
char *realpath = ecore_file_realpath(path);
|
||||
char *rp = ecore_file_realpath(path);
|
||||
ephoto_directory_browser_clear(ephoto);
|
||||
ephoto_thumb_browser_clear(ephoto);
|
||||
eina_stringshare_replace(&ephoto->config->directory, realpath);
|
||||
eina_stringshare_replace(&ephoto->config->directory, rp);
|
||||
ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
|
||||
ephoto_directory_browser_initialize_structure(ephoto);
|
||||
free(realpath);
|
||||
free(rp);
|
||||
}
|
||||
ephoto->config->prompts = elm_check_state_get(ephoto->config->show_prompts);
|
||||
ephoto->config->drop = elm_check_state_get(ephoto->config->move_drop);
|
||||
|
@ -300,7 +300,11 @@ _link_anchor_bt(void *data, Evas_Object *obj,
|
|||
const char *link = evas_object_data_get(obj, "link");
|
||||
|
||||
elm_entry_anchor_hover_end(av);
|
||||
#ifdef _WIN32
|
||||
snprintf(buf, PATH_MAX, "start %s", link);
|
||||
#else
|
||||
snprintf(buf, PATH_MAX, "xdg-open %s", link);
|
||||
#endif
|
||||
ecore_exe_run(buf, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -387,19 +387,19 @@ _check_for_subdirs(Ephoto_Entry *entry)
|
|||
return EINA_FALSE;
|
||||
EINA_ITERATOR_FOREACH(ls, info)
|
||||
{
|
||||
char *realpath = ecore_file_realpath(info->path);
|
||||
char *rp = ecore_file_realpath(info->path);
|
||||
if (info->type != EINA_FILE_DIR && info->type != EINA_FILE_LNK)
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
continue;
|
||||
}
|
||||
if (info->type == EINA_FILE_LNK && !ecore_file_is_dir((const char *)realpath))
|
||||
if (info->type == EINA_FILE_LNK && !ecore_file_is_dir((const char *)rp))
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
continue;
|
||||
}
|
||||
eina_iterator_free(ls);
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
eina_iterator_free(ls);
|
||||
|
@ -496,14 +496,14 @@ _fsel_menu_go_root(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EI
|
|||
{
|
||||
Ephoto *ephoto = data;
|
||||
const char *path = "/";
|
||||
char *realpath = ecore_file_realpath(path);
|
||||
char *rp = ecore_file_realpath(path);
|
||||
|
||||
ephoto_directory_browser_clear(ephoto);
|
||||
ephoto_thumb_browser_clear(ephoto);
|
||||
eina_stringshare_replace(&ephoto->config->directory, realpath);
|
||||
eina_stringshare_replace(&ephoto->config->directory, rp);
|
||||
ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
|
||||
ephoto_directory_browser_initialize_structure(ephoto);
|
||||
free(realpath);
|
||||
free(rp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -511,14 +511,14 @@ _fsel_menu_go_home(void *data, Evas_Object *obj EINA_UNUSED, void *event_data EI
|
|||
{
|
||||
Ephoto *ephoto = data;
|
||||
const char *path = eina_environment_home_get();
|
||||
char *realpath = ecore_file_realpath(path);
|
||||
char *rp = ecore_file_realpath(path);
|
||||
|
||||
ephoto_directory_browser_clear(ephoto);
|
||||
ephoto_thumb_browser_clear(ephoto);
|
||||
eina_stringshare_replace(&ephoto->config->directory, realpath);
|
||||
eina_stringshare_replace(&ephoto->config->directory, rp);
|
||||
ephoto_directory_browser_top_dir_set(ephoto, ephoto->config->directory);
|
||||
ephoto_directory_browser_initialize_structure(ephoto);
|
||||
free(realpath);
|
||||
free(rp);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -717,9 +717,9 @@ _todo_items_free(Ephoto_Directory_Browser *db)
|
|||
static void
|
||||
_monitor_add(Ephoto_Entry *e)
|
||||
{
|
||||
char *realpath = ecore_file_realpath(e->path);
|
||||
char *rp = ecore_file_realpath(e->path);
|
||||
|
||||
e->monitor = eio_monitor_add(realpath);
|
||||
e->monitor = eio_monitor_add(rp);
|
||||
e->monitor_handlers =
|
||||
eina_list_append(e->monitor_handlers,
|
||||
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
|
||||
|
@ -745,7 +745,7 @@ _monitor_add(Ephoto_Entry *e)
|
|||
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
|
||||
_monitor_cb, e));
|
||||
|
||||
free(realpath);
|
||||
free(rp);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -774,15 +774,15 @@ _monitor_cb(void *data, int type,
|
|||
return ECORE_CALLBACK_PASS_ON;
|
||||
if (type == EIO_MONITOR_DIRECTORY_CREATED || type == EIO_MONITOR_FILE_CREATED)
|
||||
{
|
||||
char *realpath = ecore_file_realpath(ev->filename);
|
||||
if (!ecore_file_is_dir((const char *)realpath))
|
||||
char *rp = ecore_file_realpath(ev->filename);
|
||||
if (!ecore_file_is_dir((const char *)rp))
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
if (ephoto_entry_exists(entry->ephoto, ev->filename))
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
if (elm_genlist_item_type_get(entry->item) == ELM_GENLIST_ITEM_TREE &&
|
||||
|
@ -818,7 +818,7 @@ _monitor_cb(void *data, int type,
|
|||
entry->item = parent;
|
||||
entry->no_delete = EINA_FALSE;
|
||||
}
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
else if (type == EIO_MONITOR_DIRECTORY_DELETED || type == EIO_MONITOR_FILE_DELETED)
|
||||
|
@ -867,10 +867,10 @@ _monitor_cb(void *data, int type,
|
|||
}
|
||||
else if (type == EIO_MONITOR_DIRECTORY_MODIFIED || type == EIO_MONITOR_FILE_MODIFIED)
|
||||
{
|
||||
char *realpath = ecore_file_realpath(ev->filename);
|
||||
if (!ecore_file_is_dir((const char *)realpath))
|
||||
char *rp = ecore_file_realpath(ev->filename);
|
||||
if (!ecore_file_is_dir((const char *)rp))
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
if ((elm_genlist_item_expanded_get(entry->item) == EINA_TRUE))
|
||||
|
@ -887,7 +887,7 @@ _monitor_cb(void *data, int type,
|
|||
item = elm_genlist_item_next_get(item);
|
||||
}
|
||||
}
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -916,15 +916,15 @@ _top_monitor_cb(void *data, int type,
|
|||
return ECORE_CALLBACK_PASS_ON;
|
||||
if (type == EIO_MONITOR_DIRECTORY_CREATED || type == EIO_MONITOR_FILE_CREATED)
|
||||
{
|
||||
char *realpath = ecore_file_realpath(ev->filename);
|
||||
if (!ecore_file_is_dir((const char *)realpath))
|
||||
char *rp = ecore_file_realpath(ev->filename);
|
||||
if (!ecore_file_is_dir((const char *)rp))
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
if (ephoto_entry_exists(db->ephoto, ev->filename))
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
snprintf(buf, PATH_MAX, "%s", ev->filename);
|
||||
|
@ -937,7 +937,7 @@ _top_monitor_cb(void *data, int type,
|
|||
NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
|
||||
if (e->item)
|
||||
_monitor_add(e);
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
else if (type == EIO_MONITOR_DIRECTORY_DELETED || type == EIO_MONITOR_FILE_DELETED)
|
||||
|
@ -960,10 +960,10 @@ _top_monitor_cb(void *data, int type,
|
|||
}
|
||||
else if (type == EIO_MONITOR_DIRECTORY_MODIFIED || type == EIO_MONITOR_FILE_MODIFIED)
|
||||
{
|
||||
char *realpath = ecore_file_realpath(ev->filename);
|
||||
if (!ecore_file_is_dir((const char *)realpath))
|
||||
char *rp = ecore_file_realpath(ev->filename);
|
||||
if (!ecore_file_is_dir((const char *)rp))
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
item = elm_genlist_first_item_get(db->fsel);
|
||||
|
@ -977,7 +977,7 @@ _top_monitor_cb(void *data, int type,
|
|||
}
|
||||
item = elm_genlist_item_next_get(item);
|
||||
}
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
@ -1092,16 +1092,16 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
|
|||
Ephoto_Directory_Browser *db = data;
|
||||
Ephoto_Event_Entry_Create *ev = event;
|
||||
Ephoto_Entry *e;
|
||||
char *realpath;
|
||||
char *rp;
|
||||
|
||||
e = ev->entry;
|
||||
realpath = ecore_file_realpath(e->path);
|
||||
rp = ecore_file_realpath(e->path);
|
||||
if (e->is_dir)
|
||||
{
|
||||
db->todo_items = eina_list_append(db->todo_items, e);
|
||||
db->animator.count++;
|
||||
}
|
||||
else if (ecore_file_is_dir((const char *)realpath))
|
||||
else if (ecore_file_is_dir((const char *)rp))
|
||||
{
|
||||
db->todo_items = eina_list_append(db->todo_items, e);
|
||||
db->animator.count++;
|
||||
|
@ -1109,7 +1109,7 @@ _ephoto_dir_entry_create(void *data, int type EINA_UNUSED, void *event)
|
|||
if (!db->animator.todo_items)
|
||||
db->animator.todo_items = ecore_animator_add(_todo_items_process, db);
|
||||
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
|
@ -1159,7 +1159,7 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir)
|
|||
Ephoto_Directory_Browser *db =
|
||||
evas_object_data_get(ephoto->dir_browser, "directory_browser");
|
||||
Ecore_Event_Handler *handler;
|
||||
char *realpath = ecore_file_realpath(dir);
|
||||
char *rp = ecore_file_realpath(dir);
|
||||
|
||||
if (db->monitor)
|
||||
{
|
||||
|
@ -1171,7 +1171,7 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir)
|
|||
eina_stringshare_replace(&ephoto->top_directory, dir);
|
||||
else
|
||||
ephoto->top_directory = eina_stringshare_add(dir);
|
||||
db->monitor = eio_monitor_add(realpath);
|
||||
db->monitor = eio_monitor_add(rp);
|
||||
db->monitor_handlers =
|
||||
eina_list_append(db->monitor_handlers,
|
||||
ecore_event_handler_add(EIO_MONITOR_FILE_CREATED,
|
||||
|
@ -1196,7 +1196,7 @@ ephoto_directory_browser_top_dir_set(Ephoto *ephoto, const char *dir)
|
|||
eina_list_append(db->monitor_handlers,
|
||||
ecore_event_handler_add(EIO_MONITOR_DIRECTORY_DELETED,
|
||||
_top_monitor_cb, db));
|
||||
free(realpath);
|
||||
free(rp);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1240,15 +1240,15 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
|
|||
cur = next;
|
||||
EINA_ITERATOR_FOREACH(it, finfo)
|
||||
{
|
||||
char *realpath = ecore_file_realpath(finfo->path);
|
||||
char *rp = ecore_file_realpath(finfo->path);
|
||||
if (finfo->type != EINA_FILE_DIR && finfo->type != EINA_FILE_LNK)
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
continue;
|
||||
}
|
||||
if (finfo->type == EINA_FILE_LNK && !ecore_file_is_dir((const char *)realpath))
|
||||
if (finfo->type == EINA_FILE_LNK && !ecore_file_is_dir((const char *)rp))
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
continue;
|
||||
}
|
||||
if (strncmp(finfo->path + finfo->name_start, ".", 1))
|
||||
|
@ -1294,7 +1294,7 @@ ephoto_directory_browser_initialize_structure(Ephoto *ephoto)
|
|||
}
|
||||
}
|
||||
}
|
||||
free(realpath);
|
||||
free(rp);
|
||||
}
|
||||
count++;
|
||||
free(dir);
|
||||
|
|
|
@ -136,7 +136,11 @@ _upload_entry_anchor_bt(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
const char *link = evas_object_data_get(av, "link");
|
||||
|
||||
elm_entry_anchor_hover_end(av);
|
||||
#ifdef _WIN32
|
||||
snprintf(buf, PATH_MAX, "start %s", link);
|
||||
#else
|
||||
snprintf(buf, PATH_MAX, "xdg-open %s", link);
|
||||
#endif
|
||||
ecore_exe_run(buf, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,35 +88,6 @@ _initialize_filter(Ephoto_Image_Filter filter,
|
|||
return ef;
|
||||
}
|
||||
|
||||
static int
|
||||
_normalize_color(int color)
|
||||
{
|
||||
if (color < 0)
|
||||
return 0;
|
||||
else if (color > 255)
|
||||
return 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_mul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return color * (255 / alpha);
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_demul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return (color * alpha) / 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static void
|
||||
_create_hist(Ephoto_Filter *ef)
|
||||
{
|
||||
|
@ -308,10 +279,10 @@ _blur_vertical(Ephoto_Filter *ef, double rad)
|
|||
rt = (int) round(valr * iarr);
|
||||
at = (int) round(vala * iarr);
|
||||
|
||||
bt = _normalize_color(bt);
|
||||
gt = _normalize_color(gt);
|
||||
rt = _normalize_color(rt);
|
||||
at = _normalize_color(at);
|
||||
bt = ephoto_normalize_color(bt);
|
||||
gt = ephoto_normalize_color(gt);
|
||||
rt = ephoto_normalize_color(rt);
|
||||
at = ephoto_normalize_color(at);
|
||||
ef->im_data_new[t++] = (at << 24) | (rt << 16)
|
||||
| (gt << 8) | bt;
|
||||
}
|
||||
|
@ -329,10 +300,10 @@ _blur_vertical(Ephoto_Filter *ef, double rad)
|
|||
gt = (int) round(valg * iarr);
|
||||
rt = (int) round(valr * iarr);
|
||||
at = (int) round(vala * iarr);
|
||||
bt = _normalize_color(bt);
|
||||
gt = _normalize_color(gt);
|
||||
rt = _normalize_color(rt);
|
||||
at = _normalize_color(at);
|
||||
bt = ephoto_normalize_color(bt);
|
||||
gt = ephoto_normalize_color(gt);
|
||||
rt = ephoto_normalize_color(rt);
|
||||
at = ephoto_normalize_color(at);
|
||||
ef->im_data_new[t++] = (at << 24) | (rt << 16)
|
||||
| (gt << 8) | bt;
|
||||
}
|
||||
|
@ -349,10 +320,10 @@ _blur_vertical(Ephoto_Filter *ef, double rad)
|
|||
gt = (int) round(valg * iarr);
|
||||
rt = (int) round(valr * iarr);
|
||||
at = (int) round(vala * iarr);
|
||||
bt = _normalize_color(bt);
|
||||
gt = _normalize_color(gt);
|
||||
rt = _normalize_color(rt);
|
||||
at = _normalize_color(at);
|
||||
bt = ephoto_normalize_color(bt);
|
||||
gt = ephoto_normalize_color(gt);
|
||||
rt = ephoto_normalize_color(rt);
|
||||
at = ephoto_normalize_color(at);
|
||||
ef->im_data_new[t++] = (at << 24) | (rt << 16)
|
||||
| (gt << 8) | bt;
|
||||
}
|
||||
|
@ -432,10 +403,10 @@ _blur_horizontal(Ephoto_Filter *ef, double rad)
|
|||
gt = (int) round(valg * iarr);
|
||||
rt = (int) round(valr * iarr);
|
||||
at = (int) round(vala * iarr);
|
||||
bt = _normalize_color(bt);
|
||||
gt = _normalize_color(gt);
|
||||
rt = _normalize_color(rt);
|
||||
at = _normalize_color(at);
|
||||
bt = ephoto_normalize_color(bt);
|
||||
gt = ephoto_normalize_color(gt);
|
||||
rt = ephoto_normalize_color(rt);
|
||||
at = ephoto_normalize_color(at);
|
||||
ef->im_data[t] = (at << 24) | (rt << 16)
|
||||
| (gt << 8) | bt;
|
||||
|
||||
|
@ -453,10 +424,10 @@ _blur_horizontal(Ephoto_Filter *ef, double rad)
|
|||
gt = (int) round(valg * iarr);
|
||||
rt = (int) round(valr * iarr);
|
||||
at = (int) round(vala * iarr);
|
||||
bt = _normalize_color(bt);
|
||||
gt = _normalize_color(gt);
|
||||
rt = _normalize_color(rt);
|
||||
at = _normalize_color(at);
|
||||
bt = ephoto_normalize_color(bt);
|
||||
gt = ephoto_normalize_color(gt);
|
||||
rt = ephoto_normalize_color(rt);
|
||||
at = ephoto_normalize_color(at);
|
||||
ef->im_data[t] = (at << 24) | (rt << 16)
|
||||
| (gt << 8) | bt;
|
||||
|
||||
|
@ -475,10 +446,10 @@ _blur_horizontal(Ephoto_Filter *ef, double rad)
|
|||
gt = (int) round(valg * iarr);
|
||||
rt = (int) round(valr * iarr);
|
||||
at = (int) round(vala * iarr);
|
||||
bt = _normalize_color(bt);
|
||||
gt = _normalize_color(gt);
|
||||
rt = _normalize_color(rt);
|
||||
at = _normalize_color(at);
|
||||
bt = ephoto_normalize_color(bt);
|
||||
gt = ephoto_normalize_color(gt);
|
||||
rt = ephoto_normalize_color(rt);
|
||||
at = ephoto_normalize_color(at);
|
||||
ef->im_data[t] = (at << 24) | (rt << 16)
|
||||
| (gt << 8) | bt;
|
||||
|
||||
|
@ -564,10 +535,10 @@ _sharpen(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
rrr = (int) ((2 * rr) - r);
|
||||
aaa = (int) ((2 * aa) - a);
|
||||
|
||||
bbb = _normalize_color(bbb);
|
||||
ggg = _normalize_color(ggg);
|
||||
rrr = _normalize_color(rrr);
|
||||
aaa = _normalize_color(aaa);
|
||||
bbb = ephoto_normalize_color(bbb);
|
||||
ggg = ephoto_normalize_color(ggg);
|
||||
rrr = ephoto_normalize_color(rrr);
|
||||
aaa = ephoto_normalize_color(aaa);
|
||||
|
||||
*p3 = (aaa << 24) | (rrr << 16) | (ggg << 8) | bbb;
|
||||
p3++;
|
||||
|
@ -599,18 +570,18 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((ef->im_data_new[index] >> 8) & 0xff);
|
||||
r = ((ef->im_data_new[index] >> 16) & 0xff);
|
||||
a = ((ef->im_data_new[index] >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
bb = (b > 127) ? 255 : 0;
|
||||
gg = (g > 127) ? 255 : 0;
|
||||
rr = (r > 127) ? 255 : 0;
|
||||
rr = _normalize_color(rr);
|
||||
gg = _normalize_color(gg);
|
||||
bb = _normalize_color(bb);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
ef->im_data_new[index] = (a << 24) | (rr << 16) |
|
||||
(gg << 8) | bb;
|
||||
errb = b - bb;
|
||||
|
@ -624,18 +595,18 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((ef->im_data_new[index] >> 8) & 0xff);
|
||||
r = ((ef->im_data_new[index] >> 16) & 0xff);
|
||||
a = ((ef->im_data_new[index] >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
bb = b + ((7 * errb) >> 4);
|
||||
gg = g + ((7 * errg) >> 4);
|
||||
rr = r + ((7 * errr) >> 4);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
ef->im_data_new[index] = (a << 24) | (rr << 16) |
|
||||
(gg << 8) | bb;
|
||||
}
|
||||
|
@ -646,18 +617,18 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((ef->im_data_new[index] >> 8) & 0xff);
|
||||
r = ((ef->im_data_new[index] >> 16) & 0xff);
|
||||
a = ((ef->im_data_new[index] >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
bb = b + ((3 * errb) >> 4);
|
||||
gg = g + ((3 * errg) >> 4);
|
||||
rr = r + ((3 * errr) >> 4);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
ef->im_data_new[index] = (a << 24) | (rr << 16) |
|
||||
(gg << 8) | bb;
|
||||
}
|
||||
|
@ -668,18 +639,18 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((ef->im_data_new[index] >> 8) & 0xff);
|
||||
r = ((ef->im_data_new[index] >> 16) & 0xff);
|
||||
a = ((ef->im_data_new[index] >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
bb = b + ((5 * errb) >> 4);
|
||||
gg = g + ((5 * errg) >> 4);
|
||||
rr = r + ((5 * errr) >> 4);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
ef->im_data_new[index] = (a << 24) | (rr << 16) |
|
||||
(gg << 8) | bb;
|
||||
}
|
||||
|
@ -690,18 +661,18 @@ _dither(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((ef->im_data_new[index] >> 8) & 0xff);
|
||||
r = ((ef->im_data_new[index] >> 16) & 0xff);
|
||||
a = ((ef->im_data_new[index] >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
bb = b + ((1 * errb) >> 4);
|
||||
gg = g + ((1 * errg) >> 4);
|
||||
rr = r + ((1 * errr) >> 4);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
ef->im_data_new[index] = (a << 24) | (rr << 16) |
|
||||
(gg << 8) | bb;
|
||||
}
|
||||
|
@ -727,9 +698,9 @@ _grayscale(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = (int) ((ef->im_data[i] >> 8) & 0xff);
|
||||
r = (int) ((ef->im_data[i] >> 16) & 0xff);
|
||||
a = (int) ((ef->im_data[i] >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
gray = (int) ((0.3 * r) + (0.59 * g) + (0.11 * b));
|
||||
if (a >= 0 && a < 255)
|
||||
gray = (gray * a) / 255;
|
||||
|
@ -757,18 +728,18 @@ _sepia(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((ef->im_data[i] >> 8) & 0xff);
|
||||
r = ((ef->im_data[i] >> 16) & 0xff);
|
||||
a = ((ef->im_data[i] >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
rr = (int) ((r * .393) + (g * .769) + (b * .189));
|
||||
rr = _normalize_color(rr);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
gg = ((r * .349) + (g * .686) + (b * .168));
|
||||
gg = _normalize_color(gg);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
bb = (int) ((r * .272) + (g * .534) + (b * .131));
|
||||
bb = _normalize_color(bb);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
ef->im_data_new[i] = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
}
|
||||
}
|
||||
|
@ -794,21 +765,21 @@ _posterize(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
fg = ((ef->im_data[i] >> 8) & 0xff);
|
||||
fr = ((ef->im_data[i] >> 16) & 0xff);
|
||||
a = ((ef->im_data[i] >> 24) & 0xff);
|
||||
fb = _mul_color_alpha(fb, a);
|
||||
fg = _mul_color_alpha(fg, a);
|
||||
fr = _mul_color_alpha(fr, a);
|
||||
fb = ephoto_mul_color_alpha(fb, a);
|
||||
fg = ephoto_mul_color_alpha(fg, a);
|
||||
fr = ephoto_mul_color_alpha(fr, a);
|
||||
fr /= 255;
|
||||
fg /= 255;
|
||||
fb /= 255;
|
||||
rr = 255 * rint((fr * rad)) / rad;
|
||||
rr = _normalize_color(rr);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
gg = 255 * rint((fg * rad)) / rad;
|
||||
gg = _normalize_color(gg);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
bb = 255 * rint((fb * rad)) / rad;
|
||||
bb = _normalize_color(bb);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
ef->im_data_new[i] = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
}
|
||||
}
|
||||
|
@ -832,18 +803,18 @@ _negative(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((ef->im_data[i] >> 8) & 0xff);
|
||||
r = ((ef->im_data[i] >> 16) & 0xff);
|
||||
a = ((ef->im_data[i] >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
rr = 255 - r;
|
||||
gg = 255 - g;
|
||||
bb = 255 - b;
|
||||
rr = _normalize_color(rr);
|
||||
gg = _normalize_color(gg);
|
||||
bb = _normalize_color(bb);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
ef->im_data_new[i] = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
}
|
||||
}
|
||||
|
@ -886,10 +857,10 @@ _dodge(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
rrr = rint(r / (255 - rr));
|
||||
aaa = rint(a / (255 - aa));
|
||||
|
||||
rrr = _normalize_color(rrr);
|
||||
ggg = _normalize_color(ggg);
|
||||
bbb = _normalize_color(bbb);
|
||||
aaa = _normalize_color(aaa);
|
||||
rrr = ephoto_normalize_color(rrr);
|
||||
ggg = ephoto_normalize_color(ggg);
|
||||
bbb = ephoto_normalize_color(bbb);
|
||||
aaa = ephoto_normalize_color(aaa);
|
||||
|
||||
ef->im_data_new[i] = (aaa << 24) | (rrr << 16) | (ggg << 8) | bbb;
|
||||
}
|
||||
|
@ -940,10 +911,10 @@ _sobel(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((*p >> 8) & 0xff);
|
||||
r = ((*p >> 16) & 0xff);
|
||||
a = ((*p >> 24) & 0xff);
|
||||
b = _normalize_color(b);
|
||||
g = _normalize_color(g);
|
||||
r = _normalize_color(r);
|
||||
a = _normalize_color(a);
|
||||
b = ephoto_normalize_color(b);
|
||||
g = ephoto_normalize_color(g);
|
||||
r = ephoto_normalize_color(r);
|
||||
a = ephoto_normalize_color(a);
|
||||
*p = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
p++;
|
||||
}
|
||||
|
@ -989,10 +960,10 @@ _emboss(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
}
|
||||
}
|
||||
}
|
||||
aa = _normalize_color(aa);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
aa = ephoto_normalize_color(aa);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
*p = (aa << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
p++;
|
||||
}
|
||||
|
@ -1022,9 +993,9 @@ _histogram_eq(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((*p1 >> 8) & 0xff);
|
||||
r = ((*p1 >> 16) & 0xff);
|
||||
a = ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
|
||||
norm = (int) round((double) v * (double) 255);
|
||||
ef->hist[norm] += 1;
|
||||
|
@ -1048,19 +1019,19 @@ _histogram_eq(void *data, Ecore_Thread *th EINA_UNUSED)
|
|||
g = ((*p1 >> 8) & 0xff);
|
||||
r = ((*p1 >> 16) & 0xff);
|
||||
a = ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
|
||||
norm = (int) round((double) v * (double) 255);
|
||||
nv = (float) ef->cdf[norm] / (float) 255;
|
||||
evas_color_hsv_to_rgb(hh, s, nv, &rr, &gg, &bb);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
p2++;
|
||||
p1++;
|
||||
|
|
|
@ -18,35 +18,6 @@ struct _Ephoto_HSV
|
|||
unsigned int *original_im_data;
|
||||
};
|
||||
|
||||
static int
|
||||
_normalize_color(int color)
|
||||
{
|
||||
if (color < 0)
|
||||
return 0;
|
||||
else if (color > 255)
|
||||
return 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_mul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return color * (255 / alpha);
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_demul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return (color * alpha) / 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
unsigned int *
|
||||
_ephoto_hsv_adjust_hue(Ephoto_HSV *ehsv, double hue, unsigned int *image_data)
|
||||
{
|
||||
|
@ -74,9 +45,9 @@ _ephoto_hsv_adjust_hue(Ephoto_HSV *ehsv, double hue, unsigned int *image_data)
|
|||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
|
||||
hh += hue;
|
||||
if (hh < 0)
|
||||
|
@ -84,12 +55,12 @@ _ephoto_hsv_adjust_hue(Ephoto_HSV *ehsv, double hue, unsigned int *image_data)
|
|||
if (hh > 360)
|
||||
hh -= 360;
|
||||
evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
p2++;
|
||||
p1++;
|
||||
|
@ -130,9 +101,9 @@ _ephoto_hsv_adjust_saturation(Ephoto_HSV *ehsv, double saturation,
|
|||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
|
||||
s += s * ((float) saturation / 100);
|
||||
if (s < 0)
|
||||
|
@ -140,12 +111,12 @@ _ephoto_hsv_adjust_saturation(Ephoto_HSV *ehsv, double saturation,
|
|||
if (s > 1)
|
||||
s = 1;
|
||||
evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
p2++;
|
||||
p1++;
|
||||
|
@ -186,9 +157,9 @@ _ephoto_hsv_adjust_value(Ephoto_HSV *ehsv, double value,
|
|||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
evas_color_rgb_to_hsv(r, g, b, &hh, &s, &v);
|
||||
v += (v * ((float) value / 100));
|
||||
if (v < 0)
|
||||
|
@ -196,12 +167,12 @@ _ephoto_hsv_adjust_value(Ephoto_HSV *ehsv, double value,
|
|||
if (v > 1)
|
||||
v = 1;
|
||||
evas_color_hsv_to_rgb(hh, s, v, &rr, &gg, &bb);
|
||||
bb = _normalize_color(bb);
|
||||
gg = _normalize_color(gg);
|
||||
rr = _normalize_color(rr);
|
||||
bb = _demul_color_alpha(bb, a);
|
||||
gg = _demul_color_alpha(gg, a);
|
||||
rr = _demul_color_alpha(rr, a);
|
||||
bb = ephoto_normalize_color(bb);
|
||||
gg = ephoto_normalize_color(gg);
|
||||
rr = ephoto_normalize_color(rr);
|
||||
bb = ephoto_demul_color_alpha(bb, a);
|
||||
gg = ephoto_demul_color_alpha(gg, a);
|
||||
rr = ephoto_demul_color_alpha(rr, a);
|
||||
*p2 = (a << 24) | (rr << 16) | (gg << 8) | bb;
|
||||
p2++;
|
||||
p1++;
|
||||
|
|
|
@ -585,18 +585,18 @@ ephoto_window_add(const char *path)
|
|||
|
||||
if (ecore_file_is_dir(path))
|
||||
{
|
||||
char *realpath = ecore_file_realpath(path);
|
||||
eina_stringshare_replace(&ephoto->config->directory, realpath);
|
||||
free(realpath);
|
||||
char *rp = ecore_file_realpath(path);
|
||||
eina_stringshare_replace(&ephoto->config->directory, rp);
|
||||
free(rp);
|
||||
_ephoto_thumb_browser_show(ephoto, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *dir = ecore_file_dir_get(path);
|
||||
char *realpath = ecore_file_realpath(dir);
|
||||
char *rp = ecore_file_realpath(dir);
|
||||
|
||||
eina_stringshare_replace(&ephoto->config->directory, realpath);
|
||||
free(realpath);
|
||||
eina_stringshare_replace(&ephoto->config->directory, rp);
|
||||
free(rp);
|
||||
free(dir);
|
||||
ephoto_single_browser_path_pending_set(ephoto->single_browser, path);
|
||||
evas_object_hide(ephoto->thumb_browser);
|
||||
|
@ -748,33 +748,33 @@ _ephoto_populate_filter(void *data, Eio_File *handler EINA_UNUSED,
|
|||
{
|
||||
Ephoto_Dir_Data *ed = data;
|
||||
const char *bname = info->path + info->name_start;
|
||||
char *realpath;
|
||||
char *rp;
|
||||
|
||||
if (bname[0] == '.')
|
||||
return EINA_FALSE;
|
||||
realpath = ecore_file_realpath(info->path);
|
||||
rp = ecore_file_realpath(info->path);
|
||||
if (info->type == EINA_FILE_DIR && !ed->thumbs_only)
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return EINA_TRUE;
|
||||
}
|
||||
else if (info->type == EINA_FILE_LNK && ecore_file_is_dir((const char *)realpath))
|
||||
else if (info->type == EINA_FILE_LNK && ecore_file_is_dir((const char *)rp))
|
||||
{
|
||||
Eina_Bool _is_dir = ecore_file_is_dir(realpath);
|
||||
Eina_Bool _is_dir = ecore_file_is_dir(rp);
|
||||
if (ed->thumbs_only)
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return _is_dir;
|
||||
}
|
||||
else if (!ed->dirs_only)
|
||||
{
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return _ephoto_eina_file_direct_info_image_useful(info);
|
||||
}
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
|
@ -925,7 +925,7 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded,
|
|||
Ephoto_Dir_Data *ed;
|
||||
Ecore_Event_Handler *handler;
|
||||
Evas_Object *o;
|
||||
char *realpath;
|
||||
char *rp;
|
||||
|
||||
ed = malloc(sizeof(Ephoto_Dir_Data));
|
||||
ed->ephoto = ephoto;
|
||||
|
@ -943,8 +943,8 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded,
|
|||
evas_object_del(o);
|
||||
|
||||
ephoto_title_set(ephoto, NULL);
|
||||
realpath = ecore_file_realpath(path);
|
||||
eina_stringshare_replace(&ephoto->config->directory, realpath);
|
||||
rp = ecore_file_realpath(path);
|
||||
eina_stringshare_replace(&ephoto->config->directory, rp);
|
||||
|
||||
if (ed->ephoto->job.change_dir)
|
||||
ecore_job_del(ed->ephoto->job.change_dir);
|
||||
|
@ -968,7 +968,7 @@ ephoto_directory_set(Ephoto *ephoto, const char *path, Evas_Object *expanded,
|
|||
eina_list_append(ephoto->monitor_handlers,
|
||||
ecore_event_handler_add(EIO_MONITOR_FILE_DELETED,
|
||||
_monitor_cb, ephoto));
|
||||
free(realpath);
|
||||
free(rp);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
|
@ -1132,7 +1132,7 @@ ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label,
|
|||
Eina_File_Type type)
|
||||
{
|
||||
Ephoto_Entry *entry;
|
||||
char *realpath;
|
||||
char *rp;
|
||||
|
||||
entry = calloc(1, sizeof(Ephoto_Entry));
|
||||
entry->ephoto = ephoto;
|
||||
|
@ -1140,10 +1140,10 @@ ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label,
|
|||
entry->basename = ecore_file_file_get(entry->path);
|
||||
entry->label = eina_stringshare_add(label);
|
||||
entry->sort_id = NULL;
|
||||
realpath = ecore_file_realpath(entry->path);
|
||||
rp = ecore_file_realpath(entry->path);
|
||||
if (type == EINA_FILE_DIR)
|
||||
entry->is_dir = EINA_TRUE;
|
||||
else if (type == EINA_FILE_LNK && ecore_file_is_dir((const char *)realpath))
|
||||
else if (type == EINA_FILE_LNK && ecore_file_is_dir((const char *)rp))
|
||||
entry->is_dir = EINA_TRUE;
|
||||
else
|
||||
entry->is_dir = EINA_FALSE;
|
||||
|
@ -1152,7 +1152,7 @@ ephoto_entry_new(Ephoto *ephoto, const char *path, const char *label,
|
|||
else
|
||||
entry->is_link = EINA_FALSE;
|
||||
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,35 +15,6 @@ struct _Ephoto_Reye
|
|||
unsigned int *edited_im_data;
|
||||
};
|
||||
|
||||
static int
|
||||
_normalize_color(int color)
|
||||
{
|
||||
if (color < 0)
|
||||
return 0;
|
||||
else if (color > 255)
|
||||
return 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_mul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return color * (255 / alpha);
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static int
|
||||
_demul_color_alpha(int color, int alpha)
|
||||
{
|
||||
if (alpha > 0 && alpha < 255)
|
||||
return (color * alpha) / 255;
|
||||
else
|
||||
return color;
|
||||
}
|
||||
|
||||
static void
|
||||
_reye_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
||||
void *event_data EINA_UNUSED)
|
||||
|
@ -96,16 +67,16 @@ _reye_clicked(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED,
|
|||
g = (int) ((*p1 >> 8) & 0xff);
|
||||
r = (int) ((*p1 >> 16) & 0xff);
|
||||
a = (int) ((*p1 >> 24) & 0xff);
|
||||
b = _mul_color_alpha(b, a);
|
||||
g = _mul_color_alpha(g, a);
|
||||
r = _mul_color_alpha(r, a);
|
||||
b = ephoto_mul_color_alpha(b, a);
|
||||
g = ephoto_mul_color_alpha(g, a);
|
||||
r = ephoto_mul_color_alpha(r, a);
|
||||
r = (int) ((g+b)/2);
|
||||
b = _normalize_color(b);
|
||||
g = _normalize_color(g);
|
||||
r = _normalize_color(r);
|
||||
b = _demul_color_alpha(b, a);
|
||||
g = _demul_color_alpha(g, a);
|
||||
r = _demul_color_alpha(r, a);
|
||||
b = ephoto_normalize_color(b);
|
||||
g = ephoto_normalize_color(g);
|
||||
r = ephoto_normalize_color(r);
|
||||
b = ephoto_demul_color_alpha(b, a);
|
||||
g = ephoto_demul_color_alpha(g, a);
|
||||
r = ephoto_demul_color_alpha(r, a);
|
||||
*p1 = (a << 24) | (r << 16) | (g << 8) | b;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1573,14 +1573,14 @@ _ephoto_thumb_entry_create(void *data, int type EINA_UNUSED, void *event)
|
|||
Ephoto_Thumb_Browser *tb = data;
|
||||
Ephoto_Event_Entry_Create *ev = event;
|
||||
Ephoto_Entry *e;
|
||||
char *realpath;
|
||||
char *rp;
|
||||
|
||||
if (tb->dirs_only)
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
|
||||
e = ev->entry;
|
||||
realpath = ecore_file_realpath(e->path);
|
||||
if (!e->is_dir && !ecore_file_is_dir(realpath))
|
||||
rp = ecore_file_realpath(e->path);
|
||||
if (!e->is_dir && !ecore_file_is_dir(rp))
|
||||
{
|
||||
Eina_File *f;
|
||||
|
||||
|
@ -1595,7 +1595,7 @@ _ephoto_thumb_entry_create(void *data, int type EINA_UNUSED, void *event)
|
|||
if (!tb->animator.todo_items)
|
||||
tb->animator.todo_items = ecore_animator_add(_todo_items_process, tb);
|
||||
|
||||
free(realpath);
|
||||
free(rp);
|
||||
return ECORE_CALLBACK_PASS_ON;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue