Vincent Torri <vtorri at univ-evry dot fr>
Tim Horton <hortont424@gmail.com>
Tom Hacohen <tom@stosb.com>
+Mathieu Taillefumier <mathieu.taillefumier@free.fr>
#include "evas_cs.h"
#define D(...) EINA_LOG_DBG(__VA_ARGS__)
-
+#ifdef ERR
+#undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_evas_cserve_bin_log_dom, __VA_ARGS__)
+#ifdef DBG
+#undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_evas_cserve_bin_log_dom, __VA_ARGS__)
+#ifdef CSERVE_BIN_DEFAULT_COLOR
+#undef CSERVE_BIN_DEFAULT_COLOR
+#endif
+#define CSERVE_BIN_DEFAULT_COLOR "\033[36m"
// fixme:'s
//
// preload - make it work (both)
static int cache_item_timeout = -1;
static int cache_item_timeout_check = -1;
static Mem *stat_mem = NULL;
-
+static int _evas_cserve_bin_log_dom = -1;
static int stat_mem_num = 0;
static Eina_List *stat_mems = NULL;
int err = 0;
double t;
- D("... stat %s", file);
+ DBG("... stat %s", file);
ret = stat(file, &st);
if (ret < 0) return NULL;
- D("... load header");
+ DBG("... load header");
t = get_time();
ie = evas_cache_image_request(cache, file, key, load_opts, &err);
t = get_time() - t;
- D("... header done");
+ DBG("... header done");
if (!ie) return NULL;
- D("... ie->cache = %p", ie->cache);
+ DBG("... ie->cache = %p", ie->cache);
img = (Img *)ie;
img->stats.load1 = t;
img->key = eina_stringshare_add(bufkey);
{
if (img->incache > 0)
{
- printf("EEEEEEEEEEEEEEEEK!\n");
- printf("EEEEEEEEEEEEEEEEK! %p '%s' still in cache\n",
+ ERR("EEEEEEEEEEEEEEEEK!");
+ ERR("EEEEEEEEEEEEEEEEK! %p '%s' still in cache",
img, img->file.file);
- printf("EEEEEEEEEEEEEEEEK!\n");
+ ERR("EEEEEEEEEEEEEEEEK!");
return;
}
stats_lifetime_update(img);
static void
cache_clean(void)
{
- D("... cache clean!!! do");
+ DBG("... cache clean!!! do");
LKL(cache_lock);
while ((cache_usage > ((cache_max_usage + cache_max_adjust) * 1024)) &&
(cache_images))
Img *img;
Eina_List *l;
- D("... clean loop %i > %i", cache_usage, (cache_max_usage + cache_max_adjust) * 1024);
+ DBG("... clean loop %i > %i", cache_usage, (cache_max_usage + cache_max_adjust) * 1024);
l = eina_list_last(cache_images); // THREAD: called from thread. happens to be safe as it uses no unlocked shared resources
if (!l) break;
img = l->data;
if (!img) break;
LKL(img->lock);
- D("... REMOVE %p '%s'", img, img->file.file);
+ DBG("... REMOVE %p '%s'", img, img->file.file);
#ifdef BUILD_PTHREAD
img->killme = 1;
img->useless = 1;
cache_images = eina_list_remove_list(cache_images, l); // FIXME: called from thread
img->incache--;
cache_usage -= img->usage;
- D("... IMG FREE %p", img);
+ DBG("... IMG FREE %p", img);
img_free(img);
#endif
}
if (cache_max_adjust < -cache_max_usage)
cache_max_adjust = -cache_max_usage;
- D("... cache_max_adjust = %i", cache_max_adjust);
+ DBG("... cache_max_adjust = %i", cache_max_adjust);
if (pval != cache_max_adjust)
{
- D("... cache clean");
+ DBG("... cache clean");
// FIXME lock problem
cache_clean();
}
eina_hash_del(active_images, img->key, img);
if (img->dead)
{
- D("... img %p '%s' dead", img , img->file.file);
+ DBG("... img %p '%s' dead", img , img->file.file);
img_free(img);
return;
}
if ((cache_usage + img->usage) > ((cache_max_usage + cache_max_adjust) * 1024))
{
- D("... img %p '%s' too big for cache", img , img->file.file);
+ DBG("... img %p '%s' too big for cache", img , img->file.file);
img_free(img);
return;
}
- D("... img %p '%s' cached += %i", img , img->file.file, img->usage);
+ DBG("... img %p '%s' cached += %i", img , img->file.file, img->usage);
if (img->incache > 0)
{
- printf("EEEEEEEEEEEEEEEEK!\n");
- printf("EEEEEEEEEEEEEEEEK! %p '%s' already in cache\n",
+ ERR("EEEEEEEEEEEEEEEEK!");
+ ERR("EEEEEEEEEEEEEEEEK! %p '%s' already in cache",
img, img->file.file);
- printf("EEEEEEEEEEEEEEEEK!\n");
+ ERR("EEEEEEEEEEEEEEEEK!");
return;
}
LKL(cache_lock);
Eina_List *l, *l_next;
if (!file) return NULL;
- D("... img_load '%s'", file);
- if (key) D("... ... key '%s'", key);
+ DBG("... img_load '%s'", file);
+ if (key) DBG("... ... key '%s'", key);
if (key)
snprintf(buf, sizeof(buf), "%s///::/%s/\001/%i/%1.8f/%ix%i",
file, key,
load_opts->scale_down_by,
load_opts->dpi,
load_opts->w, load_opts->h);
- D("... find '%s'", buf);
+ DBG("... find '%s'", buf);
img = eina_hash_find(active_images, buf);
if ((img) && (img_ok(img)))
{
- D("... found!");
+ DBG("... found!");
img->stats.load1saved++;
img->ref++;
- D("... sats update");
+ DBG("... stats update");
stats_update();
- D("... return %p", img);
+ DBG("... return %p", img);
return img;
}
LKL(img->lock);
if (img_ok(img))
{
- D("... found cached");
+ DBG("... found cached");
cache_images = eina_list_remove_list(cache_images, l);
img->incache--;
cache_usage -= img->usage;
img->stats.load1saved++;
img->ref++;
eina_hash_direct_add(active_images, img->key, img);
- D("... sats update");
+ DBG("... sats update");
stats_update();
- D("... return %p", img);
+ DBG("... return %p", img);
LKU(img->lock);
LKU(cache_lock);
return img;
}
}
LKU(cache_lock);
- D("... ned new img");
+ DBG("... ned new img");
return img_new(file, key, load_opts, buf);
}
{
if (img->ref == 0)
{
- printf("EEEEEEEEEEEEEEEEK!\n");
- printf("EEEEEEEEEEEEEEEEK! %p '%s' already @ ref 0\n",
+ ERR("EEEEEEEEEEEEEEEEK!");
+ ERR("EEEEEEEEEEEEEEEEK! %p '%s' already @ ref 0",
img, img->file.file);
- printf("EEEEEEEEEEEEEEEEK!\n");
+ ERR("EEEEEEEEEEEEEEEEK!");
return;
}
img->ref--;
- D("... img ref-- = %i", img->ref);
+ DBG("... img ref-- = %i", img->ref);
if (img->ref == 0)
{
- D("... img cache %p '%s'", img, img->file.file);
+ DBG("... img cache %p '%s'", img, img->file.file);
img_cache(img);
}
}
static void
img_unloaddata(Img *img)
{
- D("img_unloaddata() %p '%s'", img, img->file.file);
+ DBG("img_unloaddata() %p '%s'", img, img->file.file);
if ((img->dref <= 0) && (img->useless) && (img->mem))
{
Image_Entry *ie = (Image_Entry *)img;
- D("... really do forced unload");
+ DBG("... really do forced unload");
if (!img->active) cache_usage -= img->usage;
img->usage -=
(4096 * (((img->image.w * img->image.h * sizeof(DATA32)) + 4095) / 4096)) +
img->mem = NULL;
img->image.data = NULL;
img->dref = 0;
- D("... done");
+ DBG("... done");
ie->flags.loaded = 0;
ie->allocated.w = 0;
static void
img_useless(Img *img)
{
- D("img_useless() %p", img);
+ DBG("img_useless() %p", img);
img->useless = 1;
if (img->dref <= 0) img_unloaddata(img);
}
static void
img_forcedunload(Img *img)
{
- D("img_forcedunload() %p", img);
+ DBG("img_forcedunload() %p", img);
img->dead = 1;
img_unload(img);
}
static void
img_preload(Img *img)
{
- D("img_preload() %p", img);
+ DBG("img_preload() %p", img);
}
static void
Img *img;
images = data;
- D("... CLIENT DEL %i", c->pid);
+ DBG("... CLIENT DEL %i", c->pid);
EINA_LIST_FREE(images, img)
{
- D("... unloaddata img %p", img);
+ DBG("... unloaddata img %p", img);
img_unloaddata(img);
- D("... unload img %p", img);
+ DBG("... unload img %p", img);
img_unload(img);
}
}
msg.mem.id = img->mem->id;
msg.mem.offset = img->mem->offset;
msg.mem.size = img->mem->size;
- D("... reply");
+ DBG("... reply");
evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
LKU(c->lock);
return NULL;
else
msg.mem.id = msg.mem.offset = msg.mem.size = 0;
LKU(img->lock);
- D("... reply");
+ DBG("... reply");
evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
LKU(c->lock);
return NULL;
message(void *fdata, Server *s, Client *c, int opcode, int size, unsigned char *data)
{
t_now = time(NULL);
- D("message @ %i...", (int)t_now);
+ DBG("message @ %i...", (int)t_now);
switch (opcode)
{
case OP_INIT:
}
c->func = client_del;
c->data = NULL;
- D("OP_INIT %i", c->pid);
- D("... reply");
+ DBG("OP_INIT %i", c->pid);
+ DBG("... reply");
evas_cserve_client_send(c, OP_INIT, sizeof(msg), (unsigned char *)(&msg));
}
break;
RGBA_Image_Loadopts lopt = {0, 0.0, 0, 0, 0, 0, 0, 0};
char *file = NULL, *key = NULL;
- D("OP_LOAD %i", c->pid);
+ DBG("OP_LOAD %i", c->pid);
rep = (Op_Load *)data;
file = data + sizeof(Op_Load);
key = file + strlen(file) + 1;
lopt.region.y = rep->lopt.region.y;
lopt.region.w = rep->lopt.region.w;
lopt.region.h = rep->lopt.region.h;
- D("... img_load '%s'", file);
- if (key) D("'%s'", key);
- else D(" '%s'", NULL);
- D(" lopt { %i %1.1f %i %i { %i %i %i %i}}",
+ DBG("... img_load '%s'", file);
+ if (key) DBG("'%s'", key);
+ else DBG(" '%s'", NULL);
+ DBG(" lopt { %i %1.1f %i %i { %i %i %i %i}}",
lopt.scale_down_by, lopt.dpi, lopt.w, lopt.h,
lopt.region.x, lopt.region.y, lopt.region.w, lopt.region.h);
img = img_load(file, key, &lopt);
- D("... img_load = %p", img);
+ DBG("... img_load = %p", img);
if (img)
{
- D("... add image to client list");
+ DBG("... add image to client list");
if (c->client_main)
c->client_main->data = eina_list_append(c->client_main->data, img);
else
msg.image.h = img->image.h;
msg.image.alpha = img->image.alpha;
}
- D("... reply");
+ DBG("... reply");
evas_cserve_client_send(c, OP_LOAD, sizeof(msg), (unsigned char *)(&msg));
}
break;
Op_Unload *rep;
Img *img;
- D("OP_UNLOAD %i", c->pid);
+ DBG("OP_UNLOAD %i", c->pid);
rep = (Op_Unload *)data;
img = rep->handle;
if ((img) && (rep->server_id == server_id))
{
Eina_Bool doflush = 0;
- D("... remove %p from list", img);
+ DBG("... remove %p from list", img);
if (c->client_main)
c->client_main->data = eina_list_remove(c->client_main->data, img);
else
c->data = eina_list_remove(c->data, img);
- D("... unload %p", img);
+ DBG("... unload %p", img);
LKL(img->lock);
img->ref++;
img_unload(img);
Op_Loaddata_Reply msg;
Img *img;
- D("OP_LOADDATA %i", c->pid);
+ DBG("OP_LOADDATA %i", c->pid);
rep = (Op_Loaddata *)data;
img = rep->handle;
if ((img) && (rep->server_id == server_id))
{
if (img->mem)
{
- D("... load saved - cached %p", img);
+ DBG("... load saved - cached %p", img);
img->stats.load2saved++;
stats_update();
memset(&msg, 0, sizeof(msg));
}
else
msg.mem.id = msg.mem.offset = msg.mem.size = 0;
- D("... reply");
+ DBG("... reply");
evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
}
else
pthread_attr_t attr;
Load_Inf *li;
- D("... load data %p", img);
+ DBG("... load data %p", img);
pthread_attr_init(&attr);
li = calloc(1, sizeof(Load_Inf));
if (li)
}
else
msg.mem.id = msg.mem.offset = msg.mem.size = 0;
- D("... reply");
+ DBG("... reply");
evas_cserve_client_send(c, OP_LOADDATA, sizeof(msg), (unsigned char *)(&msg));
#endif
}
Op_Unloaddata *rep;
Img *img;
- D("OP_UNLOADDATA %i", c->pid);
+ DBG("OP_UNLOADDATA %i", c->pid);
rep = (Op_Unloaddata *)data;
img = rep->handle;
if ((img) && (rep->server_id == server_id))
{
- D("... dref--");
+ DBG("... dref--");
LKL(img->lock);
img->dref--;
if (img->dref < 0) img->dref = 0;
- D("... unload data %p '%s'", img, img->file.file);
+ DBG("... unload data %p '%s'", img, img->file.file);
img_unloaddata(img);
LKU(img->lock);
}
Op_Unloaddata *rep;
Img *img;
- D("OP_USELESSDATA %i", c->pid);
+ DBG("OP_USELESSDATA %i", c->pid);
rep = (Op_Unloaddata *)data;
img = rep->handle;
if ((img) && (rep->server_id == server_id))
{
- D("... dref--");
+ DBG("... dref--");
LKL(img->lock);
img->dref--;
if (img->dref < 0) img->dref = 0;
- D("... useless %p", img);
+ DBG("... useless %p", img);
img_useless(img);
LKU(img->lock);
}
Op_Preload *rep;
Img *img;
- D("OP_PRELOAD %i", c->pid);
+ DBG("OP_PRELOAD %i", c->pid);
rep = (Op_Preload *)data;
img = rep->handle;
if ((img) && (rep->server_id == server_id))
Op_Forcedunload *rep;
Img *img;
- D("OP_FORCEDUNLOAD %i", c->pid);
+ DBG("OP_FORCEDUNLOAD %i", c->pid);
rep = (Op_Forcedunload *)data;
img = rep->handle;
if ((img) && (rep->server_id == server_id))
Eina_Bool doflush = 0;
LKL(img->lock);
- D("remove %p from list", img);
+ DBG("remove %p from list", img);
if (c->client_main)
c->client_main->data = eina_list_remove(c->client_main->data, img);
else
c->data = eina_list_remove(c->data, img);
- D("... forced unload now");
+ DBG("... forced unload now");
img->ref++;
img_forcedunload(img);
img->ref--;
{
Op_Getconfig_Reply msg;
- D("OP_GETCONFIG %i", c->pid);
+ DBG("OP_GETCONFIG %i", c->pid);
msg.cache_max_usage = cache_max_usage;
msg.cache_item_timeout = cache_item_timeout;
msg.cache_item_timeout_check = cache_item_timeout_check;
- D("... reply");
+ DBG("... reply");
evas_cserve_client_send(c, OP_GETCONFIG, sizeof(msg), (unsigned char *)(&msg));
}
break;
{
Op_Setconfig *rep;
- D("OP_SETCONFIG %i", c->pid);
+ DBG("OP_SETCONFIG %i", c->pid);
rep = (Op_Setconfig *)data;
cache_max_usage = rep->cache_max_usage;
cache_item_timeout = rep->cache_item_timeout;
cache_item_timeout_check = rep->cache_item_timeout_check;
- D("... cache timeout");
+ DBG("... cache timeout");
cache_timeout(t_now);
- D("... cache clean");
+ DBG("... cache clean");
cache_clean();
}
break;
{
Op_Getstats_Reply msg;
- D("OP_GETSTATS %i", c->pid);
+ DBG("OP_GETSTATS %i", c->pid);
stats_calc();
msg.saved_memory = saved_memory;
msg.wasted_memory = (real_memory - alloced_memory);
msg.wasted_memory_peak = (real_memory_peak - alloced_memory_peak);
msg.saved_time_image_header_load = saved_load_lifetime + saved_load_time;
msg.saved_time_image_data_load = saved_loaddata_lifetime + saved_loaddata_time;
- D("... reply");
+ DBG("... reply");
evas_cserve_client_send(c, OP_GETSTATS, sizeof(msg), (unsigned char *)(&msg));
}
break;
Eina_List *imgs = NULL, *l;
Img *img;
- D("OP_GETINFO %i", c->pid);
+ DBG("OP_GETINFO %i", c->pid);
len = sizeof(Op_Getinfo_Reply);
- D("... foreach");
+ DBG("... foreach");
if (active_images)
eina_hash_foreach(active_images, getinfo_hash_image_cb, &imgs);
- D("... walk foreach list output");
+ DBG("... walk foreach list output");
LKL(cache_lock);
EINA_LIST_FOREACH(cache_images, l, img)
{
imgs = eina_list_append(imgs, img);
}
LKU(cache_lock);
- D("... walk image cache");
+ DBG("... walk image cache");
EINA_LIST_FOREACH(imgs, l, img)
{
len += sizeof(Op_Getinfo_Item);
if (img->file.key) len += strlen(img->file.key);
len++;
}
- D("... malloc msg");
+ DBG("... malloc msg");
msg = malloc(len);
if (msg)
{
unsigned char *p;
- D("... init msg");
+ DBG("... init msg");
memset(msg, 0, len);
p = (unsigned char *)msg;
msg->active.mem_total = 0;
msg->cached.mem_total = 0;
msg->cached.count = 0;
p += sizeof(Op_Getinfo_Reply);
- D("... walk all imgs");
+ DBG("... walk all imgs");
EINA_LIST_FOREACH(imgs, l, img)
{
Op_Getinfo_Item *itt, it;
LKL(img->lock);
- D("... img %p", img);
+ DBG("... img %p", img);
memset(&it, 0, sizeof(Op_Getinfo_Item));
itt = (Op_Getinfo_Item *)p;
it.file_key_size = 0;
}
it.dead = img->dead;
it.useless = img->useless;
- D("... memcpy %p %p %i ",
+ DBG("... memcpy %p %p %i ",
itt, &it, sizeof(Op_Getinfo_Item));
memcpy(itt, &it, sizeof(Op_Getinfo_Item));
- D("... memcpy done n", img);
+ DBG("... memcpy done n", img);
p += sizeof(Op_Getinfo_Item) + it.file_key_size;
LKU(img->lock);
}
- D("... walk all imgs done");
+ DBG("... walk all imgs done");
msg->active.mem_total =
(msg->active.mem_total + 1023) / 1024;
msg->cached.mem_total =
(msg->cached.mem_total + 1023) / 1024;
- D("... reply");
+ DBG("... reply");
evas_cserve_client_send(c, OP_GETINFO, len, msg);
free(msg);
}
else
{
- D("... reply empty");
+ DBG("... reply empty");
evas_cserve_client_send(c, OP_GETINFO, 0, NULL);
}
- D("... free imgs list");
+ DBG("... free imgs list");
if (imgs) eina_list_free(imgs);
}
break;
default:
- D("OP_... UNKNOWN??? %i opcode: %i", c->pid, opcode);
+ DBG("OP_... UNKNOWN??? %i opcode: %i", c->pid, opcode);
break;
}
return 0;
unsetenv("EVAS_CSERVE");
- D("eina init...");
+ DBG("eina init...");
eina_init();
- D("evas init...");
+ _evas_cserve_bin_log_dom = eina_log_domain_register("Evas_cserve_bin", CSERVE_BIN_DEFAULT_COLOR);
+ if(_evas_cserve_bin_log_dom < 0) {
+ DBG("Problem with eina_log : impossible to create a log domain");
+ eina_shutdown();
+ exit(1);
+ }
+
+ DBG("evas init...");
evas_init();
-
- D("img init...");
+ DBG("img init...");
img_init();
- D("signal init...");
+ DBG("signal init...");
signal_init();
- D("cserve add...");
+ DBG("cserve add...");
s = evas_cserve_server_add();
if (!s)
{
- printf("ERROR: server socket init fail. abort.");
+ ERR("ERROR: server socket init fail. abort.");
goto error;
}
- D("mem open (status)...");
+ DBG("mem open (status)...");
stat_mem = evas_cserve_mem_open(0, 0, "status", sizeof(int), 0);
if (stat_mem)
{
- printf("WARNING: previous evas_cserve left garbage. cleaning up.");
+ WRN("WARNING: previous evas_cserve left garbage. cleaning up.");
stat_clean(stat_mem);
evas_cserve_mem_close(stat_mem);
stat_mem = NULL;
}
- D("mem new (status)...");
+ DBG("mem new (status)...");
stat_mem = evas_cserve_mem_new(sizeof(int), "status");
if (!stat_mem)
{
- printf("ERROR: cannot create status shmseg. abort.");
+ ERR("ERROR: cannot create status shmseg. abort.");
goto error;
}
- D("init status...");
+ DBG("init status...");
if (!stat_init(stat_mem))
{
- printf("ERROR: cannot init status shmseg. abort.");
+ ERR("cannot init status shmseg. abort.");
evas_cserve_mem_free(stat_mem);
stat_mem = NULL;
goto error;
}
- D("cset server message handler...");
+ DBG("cset server message handler...");
evas_cserve_server_message_handler_set(s, message, NULL);
last_check = time(NULL);
t_next = 0;
if (cache_item_timeout_check > 0) t_next = cache_item_timeout_check;
- D("LOOP!!! ...");
+ DBG("LOOP!!! ...");
for (;;)
{
/* fixme: timeout 0 only her - future use timeouts for timed
* housekeping */
if (exit_flag) break;
- D("wait for messages...");
+ DBG("wait for messages...");
evas_cserve_server_wait(s, t_next * 1000000);
if (exit_flag) break;
t = time(NULL);
if ((cache_item_timeout_check > 0) &&
((t_next) >= cache_item_timeout_check))
{
- D("check timeout of items...");
+ DBG("check timeout of items...");
t_next = cache_item_timeout_check;
last_check = t;
- D("cache timeout...");
+ DBG("cache timeout...");
cache_timeout(t);
- D("meminfo check...");
+ DBG("meminfo check...");
meminfo_check();
- D("mem cache adjust...");
+ DBG("mem cache adjust...");
mem_cache_adjust();
}
if ((t_next <= 0) && (cache_item_timeout_check > 0))
t_next = 1;
- D("sleep for %isec...", t_next);
+ DBG("sleep for %isec...", t_next);
LKL(strshr_freeme_lock);
if (strshr_freeme_count > 0)
cache_images = eina_list_remove(cache_images, img);
img->incache--;
cache_usage -= img->usage;
- D("... IMG FREE %p", img);
+ DBG("... IMG FREE %p", img);
img_free(img);
}
cache_cleanme = 0;
}
LKU(cache_lock);
}
- D("end loop...");
+ DBG("end loop...");
error:
- D("cleanup...");
+ DBG("cleanup...");
if (stat_mem)
{
- D("clean mem stat...");
+ DBG("clean mem stat...");
stat_clean(stat_mem);
}
- D("signal shutdown...");
+ DBG("signal shutdown...");
signal_shutdown();
- D("img shutdown...");
+ DBG("img shutdown...");
img_shutdown();
if (stat_mem)
{
- D("free stat mem...");
+ DBG("free stat mem...");
evas_cserve_mem_free(stat_mem);
stat_mem = NULL;
}
if (s)
{
- D("del server...");
+ DBG("del server...");
evas_cserve_server_del(s);
}
- D("evas shutdown...");
+ DBG("evas shutdown...");
evas_shutdown();
- D("eina shutdown...");
+ eina_log_domain_unregister(_evas_cserve_bin_log_dom);
+ DBG("eina shutdown...");
eina_shutdown();
- D("exit..");
+ DBG("exit..");
return 0;
}
#include "evas_cs.h"
+int _cserve_tool_log_dom = -1;
+
int
main(int argc, char **argv)
{
if (e->pointer.mouse_grabbed < 0)
{
- fprintf(stderr, "BUG? e->pointer.mouse_grabbed (=%d) < 0!\n",
- e->pointer.mouse_grabbed);
+ ERROR("BUG? e->pointer.mouse_grabbed (=%d) < 0!",
+ e->pointer.mouse_grabbed);
}
if ((e->pointer.button == 0) && (e->pointer.mouse_grabbed != 0))
{
- printf("restore to 0 grabs (from %i)\n", e->pointer.mouse_grabbed);
+ INFO("restore to 0 grabs (from %i)", e->pointer.mouse_grabbed);
e->pointer.mouse_grabbed = 0;
}
_evas_unwalk(e);
set = FcFontSort(NULL, p_nm, FcTrue, NULL, &res);
if (!set)
{
- fprintf(stderr, "ERROR: no fontconfig font matches '%s'. It was the last resource, no font found!\n", name);
+ ERROR("No fontconfig font matches '%s'. It was the last resource, no font found!", name);
goto fc_end;
}
#include "evas_cs.h"
static int initcount = 0;
-
+int _evas_log_dom_global = -1;
/**
* Initialize Evas
*
{
if (!eina_init())
return 0;
+ _evas_log_dom_global = eina_log_domain_register("evas_main",EVAS_DEFAULT_LOG_COLOR);
+ if(_evas_log_dom_global < 0)
+ {
+ fprintf(stderr,"Error: Evas could not create a default log domain\n");
+ eina_shutdown();
+ return 0;
+ }
evas_module_init();
#ifdef BUILD_ASYNC_EVENTS
if (!evas_async_events_init())
#ifdef BUILD_ASYNC_EVENTS
shutdown_module:
evas_module_shutdown();
+ eina_log_domain_unregister(_evas_log_dom_global);
eina_shutdown();
return 0;
evas_font_dir_cache_free();
evas_common_shutdown();
evas_module_shutdown();
+ eina_log_domain_unregister(_evas_log_dom_global);
eina_shutdown();
}
return initcount;
if (h <= 0) return;
if ((x != 0) || (y != 0))
{
- printf("EVAS: compat error. viewport x,y != 0,0 not supported\n");
+ ERROR("EVAS: compat error. viewport x,y != 0,0 not supported");
x = 0;
y = 0;
}
EVAS_OBJECT_BOX_DATA_GET(o, ptr); \
if (!ptr) \
{ \
- fprintf(stderr, "CRITICAL: no widget data for object %p (%s)\n", \
- o, evas_object_type_get(o)); \
+ CRITICAL("no widget data for object %p (%s)", \
+ o, evas_object_type_get(o)); \
fflush(stderr); \
abort(); \
return; \
EVAS_OBJECT_BOX_DATA_GET(o, ptr); \
if (!ptr) \
{ \
- fprintf(stderr, "CRITICAL: no widget data for object %p (%s)\n", \
+ CRITICAL("no widget data for object %p (%s)", \
o, evas_object_type_get(o)); \
fflush(stderr); \
abort(); \
node = eina_list_nth_list(priv->children, pos);
if (!node)
{
- fprintf(stderr, "ERROR: no item to be removed at position %d\n", pos);
+ ERROR("ERROR: no item to be removed at position %d\n", pos);
return NULL;
}
if (priv->layout.cb)
priv->layout.cb(o, priv, priv->layout.data);
else
- fprintf(stderr, "ERROR: no layout function set for %p box.\n", o);
+ ERROR("No layout function set for %p box.", o);
}
static Evas_Smart *
if ((o->cur.fill.w < 1) || (o->cur.fill.h < 1))
{
- fprintf(stderr,
- "ERROR: evas image: %p has invalid fill size: %dx%d. Ignored\n",
- obj, o->cur.fill.w, o->cur.fill.h);
+ ERROR("evas image: %p has invalid fill size: %dx%d. Ignored",
+ obj, o->cur.fill.w, o->cur.fill.h);
return;
}
if (obj->delete_me)
{
- printf("EVAS ERROR: Adding deleted object %p to smart obj %p\n", obj, smart_obj);
+ ERROR("Adding deleted object %p to smart obj %p", obj, smart_obj);
abort();
return;
}
if (smart_obj->delete_me)
{
- printf("EVAS ERROR: Adding object %p to deleted smart obj %p\n", obj, smart_obj);
+ ERROR("Adding object %p to deleted smart obj %p", obj, smart_obj);
abort();
return;
}
if (obj->layer && smart_obj->layer
&& obj->layer->evas != smart_obj->layer->evas)
{
- printf("EVAS ERROR: Adding object %p from Evas (%p) from another Evas (%p)\n", obj, obj->layer->evas, smart_obj->layer->evas);
+ ERROR("EVAS ERROR: Adding object %p from Evas (%p) from another Evas (%p)", obj, obj->layer->evas, smart_obj->layer->evas);
abort();
return;
}
EVAS_OBJECT_TABLE_DATA_GET(o, ptr); \
if (!ptr) \
{ \
- fprintf(stderr, "CRITICAL: no widget data for object %p (%s)\n", \
+ CRITICAL("CRITICAL: no widget data for object %p (%s)", \
o, evas_object_type_get(o)); \
- fflush(stderr); \
abort(); \
return; \
}
EVAS_OBJECT_TABLE_DATA_GET(o, ptr); \
if (!ptr) \
{ \
- fprintf(stderr, "CRITICAL: no widget data for object %p (%s)\n", \
+ CRITICAL("No widget data for object %p (%s)", \
o, evas_object_type_get(o)); \
- fflush(stderr); \
abort(); \
return val; \
}
cache = malloc(size);
if (!cache)
{
- fprintf(stderr,
- "ERROR: could not allocate table cache %dx%d (%d bytes): %s\n",
- cols, rows, size, strerror(errno));
+ ERROR("Could not allocate table cache %dx%d (%d bytes): %s",
+ cols, rows, size, strerror(errno));
return NULL;
}
/* } */
/* else if (min < 1) */
/* { */
-/* fprintf(stderr, */
-/* "WARNING: child %p [%s, %s] has no minimum width " */
+/* WARN("Child %p [%s, %s] has no minimum width " */
/* "and no %s expand (weight is not > 0.0). " */
/* "Assuming weight > 0.0\n", */
/* child, evas_object_type_get(child), evas_object_name_get(child), */
{
if (o_minw < 1)
{
- fputs("ERROR: homogeneous table based on item size but no "
- "horizontal mininum size specified! Using expand.\n",
- stderr);
+ ERROR("homogeneous table based on item size but no "
+ "horizontal mininum size specified! Using expand.");
expand_h = 1;
}
if (o_minh < 1)
{
- fputs("ERROR: homogeneous table based on item size but no "
- "vertical mininum size specified! Using expand.\n",
- stderr);
+ ERROR("homogeneous table based on item size but no "
+ "vertical mininum size specified! Using expand.");
expand_v = 1;
}
}
cols = malloc(size);
if (!cols)
{
- fprintf(stderr,
- "ERROR: could not allocate temp columns (%d bytes): %s\n",
- size, strerror(errno));
+ ERROR("Could not allocate temp columns (%d bytes): %s",
+ size, strerror(errno));
return;
}
memcpy(cols, c->sizes.h, size);
rows = malloc(size);
if (!rows)
{
- fprintf(stderr,
- "ERROR: could not allocate temp rows (%d bytes): %s\n",
+ ERROR("could not allocate temp rows (%d bytes): %s",
size, strerror(errno));
goto end;
}
priv = calloc(1, sizeof(*priv));
if (!priv)
{
- fputs("ERROR: could not allocate object private data.\n", stderr);
+ ERROR("could not allocate object private data.");
return;
}
evas_object_smart_data_set(o, priv);
if ((priv->size.cols < 1) || (priv->size.rows < 1))
{
- fprintf(stderr, "DBG: nothing to do: cols=%d, rows=%d\n",
- priv->size.cols, priv->size.rows);
+ DEBUG("Nothing to do: cols=%d, rows=%d",
+ priv->size.cols, priv->size.rows);
return;
}
if (rowspan < 1)
{
- fputs("ERROR: rowspan < 1\n", stderr);
+ ERROR("rowspan < 1");
return EINA_FALSE;
}
if (colspan < 1)
{
- fputs("ERROR: colspan < 1\n", stderr);
+ ERROR("colspan < 1");
return EINA_FALSE;
}
opt = _evas_object_table_option_get(child);
if (opt)
{
- fputs("ERROR: cannot add object that is already part of a table!\n",
- stderr);
+ ERROR("cannot add object that is already part of a table!");
return EINA_FALSE;
}
opt = malloc(sizeof(*opt));
if (!opt)
{
- fputs("ERROR: could not allocate table option data.\n", stderr);
+ ERROR("could not allocate table option data.");
return EINA_FALSE;
}
if (o != evas_object_smart_parent_get(child))
{
- fputs("ERROR: cannot unpack child from incorrect table!\n", stderr);
+ ERROR("cannot unpack child from incorrect table!");
return EINA_FALSE;
}
opt = _evas_object_table_option_del(child);
if (!opt)
{
- fputs("ERROR: cannot unpack child with no packing option!\n", stderr);
+ ERROR("cannot unpack child with no packing option!");
return EINA_FALSE;
}
}
if ((e->output.w != e->viewport.w) || (e->output.h != e->viewport.h))
{
- printf("EVAS: error: viewport size != output size!\n");
+ ERROR("viewport size != output size!");
}
/* phase 5. add obscures */
EINA_LIST_FOREACH(e->obscures, ll, r)
Evas_Smart *s;
Evas_Smart_Class *sc;
- printf("----- WARNING. evas_smart_new() will be deprecated and removed soon\n"
- "----- Please use evas_smart_class_new() instead\n");
+ WARN("----- WARNING. evas_smart_new() will be deprecated and removed soon"
+ "----- Please use evas_smart_class_new() instead");
if (!name) return NULL;
{
if (obj->smart.parent != above->smart.parent)
{
-// printf("BITCH! evas_object_stack_above(), %p not inside same smart as %p!\n", obj, above);
+// ERROR("BITCH! evas_object_stack_above(), %p not inside same smart as %p!", obj, above);
return;
}
evas_object_smart_member_stack_above(obj, above);
{
if (obj->smart.parent != below->smart.parent)
{
-// printf("BITCH! evas_object_stack_below(), %p not inside same smart as %p!\n", obj, below);
+// ERROR("BITCH! evas_object_stack_below(), %p not inside same smart as %p!", obj, below);
return;
}
evas_object_smart_member_stack_below(obj, below);
if ((*size < 0) || (*size > (1024 * 1024))) return NULL;
if (ints[2] != (s->ch[channel].req_from + 1))
{
- printf("EEK! sequence number mismatch from serer with pid: %i\n"
- "---- num %i is not 1 more than %i\n"
+ ERROR("EEK! sequence number mismatch from serer with pid: %i\n"
+ "---- num %i is not 1 more than %i"
,
s->pid, ints[2], s->ch[channel].req_from);
return NULL;
data = c->inbuf + (sizeof(int) * 3);
if (ints[2] != (c->req_from + 1))
{
- printf("EEK! sequence number mismatch from client with pid: %i\n"
- "---- num %i is not 1 more than %i\n"
+ ERROR("EEK! sequence number mismatch from client with pid: %i\n"
+ "---- num %i is not 1 more than %i"
,
c->pid, ints[2], c->req_from);
return 0;
}
#endif
}
- printf("depth = %i mode = %i\n", depth, pal_mode);
+ INFO("depth = %i mode = %i", depth, pal_mode);
if (depth == 8)
{
#ifdef BUILD_CONVERT_8_RGB_332
dst_ptr = (DATA16 *)dst;
- fprintf(stderr, "evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180\n");
+ ERROR("evas_common_convert_rgba_to_16bpp_bgr_565_dith_rot_180");
CONVERT_LOOP_START_ROT_180();
*/
#include "evas_common.h"
-
#if defined BUILD_MMX || defined BUILD_SSE
#include "evas_mmx.h"
#endif
if (cpu_feature_mask & CPU_FEATURE_MMX2) do_sse = 1;
if (cpu_feature_mask & CPU_FEATURE_SSE) do_sse = 1;
}
-// printf("%i %i %i\n", do_mmx, do_sse, do_sse2);
+// INFO("%i %i %i", do_mmx, do_sse, do_sse2);
*mmx = do_mmx;
*sse = do_sse;
*sse2 = do_sse2;
#include "evas_common.h"
+#include "evas_private.h"
#include "evas_blend_private.h"
#include "evas_intl_utils.h" /*defines INTERNATIONAL_SUPPORT if possible */
*/
#include "evas_common.h"
-
+#include "evas_private.h"
FT_Library evas_ft_lib = 0;
static int initialised = 0;
fg = evas_common_font_int_cache_glyph_get(fi, index);
if (!fg) return 0;
/*
- printf("fg->glyph_out->left = %i\n"
+ INFO("fg->glyph_out->left = %i\n"
"fi->src->ft.face->glyph->bitmap_left = %i\n"
"fi->src->ft.face->glyph->metrics.horiBearingX = %i\n"
"fi->src->ft.face->glyph->metrics.horiBearingY = %i\n"
- "fi->src->ft.face->glyph->metrics.horiAdvance = %i\n"
+ "fi->src->ft.face->glyph->metrics.horiAdvance = %i"
,
(int)fg->glyph_out->left,
(int)fi->src->ft.face->glyph->bitmap_left,
static void
_evas_common_rgba_image_debug(const char* context, Image_Entry *eim)
{
- fprintf(stderr, "%p = [%s] {%s,%s} %i [%i|%i]\n", eim, context, eim->file, eim->key, eim->references, eim->w, eim->h);
+ DEBUG("%p = [%s] {%s,%s} %i [%i|%i]", eim, context, eim->file, eim->key, eim->references, eim->w, eim->h);
}
static const Evas_Cache_Image_Func _evas_common_image_func =
if (!eci)
eci = evas_cache_image_init(&_evas_common_image_func);
reference++;
-//// printf("REF++=%i\n", reference);
+//// ERROR("REF++=%i", reference);
#ifdef BUILD_LOADER_EET
eet_init();
im->cache.list = eina_list_remove(im->cache.list, sci);
if (sci->im)
{
-// printf(" 0- %i\n", sci->dst_w * sci->dst_h * 4);
+// INFO(" 0- %i", sci->dst_w * sci->dst_h * 4);
LKL(cache_lock);
evas_common_rgba_image_free(&sci->im->cache_entry);
if (!sci->forced_unload)
if (sci->usage_count > im->cache.newest_usage_count)
im->cache.newest_usage_count = sci->usage_count;
}
-// printf("_sci_fix_newest! -> %i\n", im->cache.newest_usage);
+// INFO("_sci_fix_newest! -> %i", im->cache.newest_usage);
}
static Scaleitem *
cache_size -= sci->dst_w * sci->dst_h * 4;
else
cache_size -= sci->size_adjust;
-// printf(" 1- %i\n", sci->dst_w * sci->dst_h * 4);
+// INFO(" 1- %i", sci->dst_w * sci->dst_h * 4);
cache_list = eina_inlist_remove(cache_list, (Eina_Inlist *)sci);
}
if (max_scale_items < 1) return NULL;
cache_size -= sci->dst_w * sci->dst_h * 4;
else
cache_size -= sci->size_adjust;
-// printf(" 2- %i\n", sci->dst_w * sci->dst_h * 4);
+// INFO(" 2- %i", sci->dst_w * sci->dst_h * 4);
cache_list = eina_inlist_remove(cache_list, (Eina_Inlist *)sci);
memset(sci, 0, sizeof(Eina_Inlist));
}
-// printf("FLUSH %i > %i\n", cache_size, max_cache_size);
+// INFO("FLUSH %i > %i", cache_size, max_cache_size);
}
}
#endif
LKU(im->cache.lock);
return;
}
-// printf("%10i | %4i %4i %4ix%4i -> %4i %4i %4ix%4i | %i\n",
+// INFO("%10i | %4i %4i %4ix%4i -> %4i %4i %4ix%4i | %i",
// (int)use_counter,
// src_region_x, src_region_y, src_region_w, src_region_h,
// dst_region_x, dst_region_y, dst_region_w, dst_region_h,
LKU(cache_lock);
if (sci->usage > im->cache.newest_usage)
im->cache.newest_usage = sci->usage;
-// printf("newset? %p %i > %i\n", im,
+// INFO("newset? %p %i > %i", im,
// (int)sci->usage,
// (int)im->cache.newest_usage);
if (sci->usage_count > im->cache.newest_usage_count)
im->cache.newest_usage_count = sci->usage_count;
-// printf(" -------------- used %8i#, %8i@\n", (int)sci->usage, (int)sci->usage_count);
+// INFO(" -------------- used %8i#, %8i@", (int)sci->usage, (int)sci->usage_count);
LKU(im->cache.lock);
#endif
}
i++;
if (i > 2000)
{
- printf("p: %6i, h: %6i, m: %6i, n: %6i\n",
+ INFO("p: %6i, h: %6i, m: %6i, n: %6i",
pops, hits, misses, noscales);
i = 0;
}
}
if (sci->populate_me)
{
-// printf("##! populate!\n");
+// INFO("##! populate!");
sci->im = evas_common_image_new
(dst_region_w, dst_region_h, im->cache_entry.flags.alpha);
if (sci->im)
{
cache_size += sci->dst_w * sci->dst_h * 4;
}
-// printf(" + %i @ flop: %i (%ix%i)\n",
+// INFO(" + %i @ flop: %i (%ix%i)",
// sci->dst_w * sci->dst_h * 4, sci->flop,
// sci->dst_w, sci->dst_h);
cache_list = eina_inlist_append(cache_list, (Eina_Inlist *)sci);
{
if (sci->flop > 0) sci->flop -= FLOP_DEL;
}
-// printf("use cached!\n");
+// INFO("use cached!");
evas_common_scale_rgba_in_to_out_clip_sample
(sci->im, dst, dc,
0, 0,
dst_region_x, dst_region_y,
dst_region_w, dst_region_h);
// hits++;
-// printf("check %p %i < %i\n",
+// INFO("check %p %i < %i",
// im,
// (int)im->cache.orig_usage,
// (int)im->cache.newest_usage);
*/
#include "evas_common.h"
-
static RGBA_Gfx_Func op_add_span_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
static RGBA_Gfx_Pt_Func op_add_pt_funcs[SP_LAST][SM_LAST][SC_LAST][DP_LAST][CPU_LAST];
{
Thinfo *thinfo;
-// printf("TH [...........\n");
+// INFO("TH [...........");
thinfo = data;
for (;;)
{
RGBA_Pipe *p;
/* wait for start signal */
-// printf(" TH %i START...\n", thinfo->thread_num);
+// INFO(" TH %i START...", thinfo->thread_num);
pthread_barrier_wait(&(thinfo->barrier[0]));
info = thinfo->info;
// if (info)
// {
// thinfo->info = NULL;
-// printf(" TH %i GO\n", thinfo->thread_num);
+// INFO(" TH %i GO", thinfo->thread_num);
EINA_INLIST_FOREACH(EINA_INLIST_GET(info->im->pipe), p)
{
int i;
}
free(info);
// }
-// printf(" TH %i DONE\n", thinfo->thread_num);
+// INFO(" TH %i DONE", thinfo->thread_num);
/* send finished signal */
pthread_barrier_wait(&(thinfo->barrier[1]));
}
#include "evas_common.h"
-
#ifdef EVAS_RECT_SPLIT
static const list_node_t list_node_zeroed = { NULL };
void
rect_print(const rect_t r)
{
- printf("<rect(%d, %d, %d, %d)>", r.left, r.top, r.width, r.height);
+ INFO("<rect(%d, %d, %d, %d)>", r.left, r.top, r.width, r.height);
}
void
len = 0;
for (node = rects.head; node != NULL; node = node->next) len++;
- printf("[");
+ putchar('[');
for (node = rects.head; node != NULL; node = node->next)
{
rect_print(((rect_node_t *)node)->rect);
}
}
}
- printf("]\n");
+ putchar(']');
}
inline void
*/
/* prev_cur_node = cur_node; */
/* cur_node = cur_node->next; */
- printf("Should not get here!\n");
+ WARN("Should not get here!");
abort();
}
rn = (rect_node_t *)rect_list_node_pool_get();
rn->_lst = list_node_zeroed;
rect_init(&rn->rect, x, y, w, h);
- //fprintf(stderr, "ACCOUNTING: add_redraw: %4d,%4d %3dx%3d\n", x, y, w, h);
+ //INFO(stderr, "ACCOUNTING: add_redraw: %4d,%4d %3dx%3d", x, y, w, h);
//testing on my core2 duo desktop - fuzz of 32 or 48 is best.
#define FUZZ 32
rect_list_add_split_fuzzy_and_merge(rects, (list_node_t *)rn,
if ((w <= 0) || (h <= 0)) return 0;
rect_init(&r, x, y, w, h);
- //fprintf(stderr, "ACCOUNTING: del_redraw: %4d,%4d %3dx%3d\n", x, y, w, h);
+ //ERROR("ACCOUNTING: del_redraw: %4d,%4d %3dx%3d", x, y, w, h);
rect_list_del_split_strict(&tb->rects, r);
tb->need_merge = 1;
_soft16_image_draw_scaled_solid_solid
(src, dst, dc, dst_offset, w, h, offset_x, offset_y);
else
- fprintf(stderr,
- "Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
- "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL\n",
+ ERROR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
+ "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL",
src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha);
}
_soft16_image_draw_scaled_solid_solid_mul_alpha
(src, dst, dc, dst_offset, w, h, offset_x, offset_y, a);
else
- fprintf(stderr,
- "Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
- "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d\n",
- src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, A_VAL(&dc->mul.col));
+ ERROR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
+ "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d",
+ src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, A_VAL(&dc->mul.col));
}
static void
_soft16_image_draw_scaled_solid_solid_mul_color
(src, dst, dc, dst_offset, w, h, offset_x, offset_y, r, g, b, a);
else
- fprintf(stderr,
- "Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
- "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x\n",
+ ERROR("Unsupported draw of scaled images src->cache_entry.flags.alpha=%d, "
+ "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x",
src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, dc->mul.col);
}
src_offset, dst_offset,
width, height);
else
- fprintf(stderr,
- "Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
- "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL\n",
+ ERROR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
+ "dst->cache_entry.flags.alpha=%d, WITHOUT COLOR MUL",
src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha);
}
_soft16_image_draw_unscaled_solid_solid_mul_alpha
(src, dst, dc, src_offset, dst_offset, width, height, a);
else
- fprintf(stderr,
- "Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
- "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d\n",
+ ERROR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
+ "dst->cache_entry.flags.alpha=%d, WITH ALPHA MUL %d",
src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, A_VAL(&dc->mul.col));
}
_soft16_image_draw_unscaled_solid_solid_mul_color
(src, dst, dc, src_offset, dst_offset, width, height, r, g, b, a);
else
- fprintf(stderr,
- "Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
- "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x\n",
+ ERROR("Unsupported draw of unscaled images src->cache_entry.flags.alpha=%d, "
+ "dst->cache_entry.flags.alpha=%d, WITH COLOR MUL 0x%08x",
src->cache_entry.flags.alpha, dst->cache_entry.flags.alpha, dc->mul.col);
}
/* static void */
/* _evas_common_soft16_image_debug(const char* context, Image_Entry *eim) */
/* { */
-/* fprintf(stderr, "[16] %p = [%s] {%s,%s} %i [%i|%i]\n", eim, context, eim->file, eim->key, eim->references, eim->w, eim->h); */
+/* DEBUG("[16] %p = [%s] {%s,%s} %i [%i|%i]", eim, context, eim->file, eim->key, eim->references, eim->w, eim->h); */
/* } */
static const Evas_Cache_Image_Func _evas_common_soft16_image_func =
(dst, dst_offset, dr.w, dr.h, rgb565, alpha);
}
else
- fprintf(stderr,
- "Unsupported feature: drawing rectangle to non-opaque "
- "destination.\n");
+ ERROR("Unsupported feature: drawing rectangle to non-opaque destination.");
}
void
#include <Eina.h>
#include "Evas.h"
+/* macros needed to log message through eina_log */
+extern int _evas_log_dom_global;
+#ifdef _EVAS_DEFAULT_MODULE_LOG_DOM
+#undef _EVAS_DEFAULT_MODULE_LOG_DOM
+#endif
+#define _EVAS_DEFAULT_MODULE_LOG_DOM _evas_log_dom_global
+
+#ifdef EVAS_DEFAULT_LOG_COLOR
+#undef EVAS_DEFAULT_LOG_COLOR
+#endif
+#define EVAS_DEFAULT_LOG_COLOR "\033[36m"
+#ifdef ERROR
+#undef ERROR
+#endif
+#define ERROR(...) EINA_LOG_DOM_ERR(_evas_log_dom_global, __VA_ARGS__)
+#ifdef DEBUG
+#undef DEBUG
+#endif
+#define DEBUG(...) EINA_LOG_DOM_DBG(_evas_log_dom_global, __VA_ARGS__)
+#ifdef INFO
+#undef INFO
+#endif
+#define INFO(...) EINA_LOG_DOM_INFO(_evas_log_dom_global, __VA_ARGS__)
+#ifdef WARN
+#undef WARN
+#endif
+#define WARN(...) EINA_LOG_DOM_WARN(_evas_log_dom_global, __VA_ARGS__)
+#ifdef CRITICAL
+#undef CRITICAL
+#endif
+#define CRITICAL(...) EINA_LOG_DOM_CRIT(_evas_log_dom_global, __VA_ARGS__)
+/**
+ * macros that are used all around the code for message processing
+ * four macros are defined ERR, WRN, DGB, INF.
+ * EFREET_MODULE_LOG_DOM should be defined individually for each module
+ */
+
+#ifdef ERR
+#undef ERR
+#endif
+#define ERR(...) EINA_LOG_DOM_ERR(_EVAS_DEFAULT_MODULE_LOG_DOM, __VA_ARGS__)
+#ifdef DBG
+#undef DBG
+#endif
+#define DBG(...) EINA_LOG_DOM_DBG(_EVAS_DEFAULT_MODULE_LOG_DOM, __VA_ARGS__)
+#ifdef INF
+#undef INF
+#endif
+#define INF(...) EINA_LOG_DOM_INFO(_EVAS_DEFAULT__MODULE_LOG_DOM, __VA_ARGS__)
+#ifdef WRN
+#undef WRN
+#endif
+#define WRN(...) EINA_LOG_DOM_WARN(_EVAS_DEFAULT_MODULE_LOG_DOM, __VA_ARGS__)
+#ifdef CRIT
+#undef CRIT
+#endif
+#define CRIT(...) EINA_LOG_DOM_CRIT(_EVAS_DEFAULT_MODULE_LOG_DOM, __VA_ARGS__)
+
/*****************************************************************************/
#include "evas_options.h"
#ifdef __cplusplus
}
#endif
-
#endif
_evas_debug_init = 1;
}
if (_evas_debug_show)
- fprintf(stderr,
- "*** EVAS ERROR: Evas Magic Check Failed!!!\n");
+ DEBUG("*** EVAS ERROR: Evas Magic Check Failed!!!");
}
void
_evas_debug_init = 1;
}
if (_evas_debug_show)
- fprintf(stderr,
- " Input object pointer is NULL!\n");
+ DEBUG("Input object pointer is NULL!");
if (_evas_debug_abort) abort();
}
_evas_debug_init = 1;
}
if (_evas_debug_show)
- fprintf(stderr,
- " Input object is zero'ed out (maybe a freed object or zero-filled RAM)!\n");
+ DEBUG("Input object is zero'ed out (maybe a freed object or zero-filled RAM)!");
if (_evas_debug_abort) abort();
}
_evas_debug_init = 1;
}
if (_evas_debug_show)
- fprintf(stderr,
- " Input object is wrong type\n"
- " Expected: %08x - %s\n"
- " Supplied: %08x - %s\n",
- expected, evas_debug_magic_string_get(expected),
- supplied, evas_debug_magic_string_get(supplied));
+ DEBUG(" Input object is wrong type\n"
+ " Expected: %08x - %s\n"
+ " Supplied: %08x - %s",
+ expected, evas_debug_magic_string_get(expected),
+ supplied, evas_debug_magic_string_get(supplied));
if (_evas_debug_abort) abort();
}
_evas_debug_init = 1;
}
if (_evas_debug_show)
- fprintf(stderr,
- "*** EVAS ERROR:\n"
- "%s", (char *)str);
+ DEBUG("*** EVAS ERROR:\n"
+ "%s", (char *)str);
if (_evas_debug_abort) abort();
}
info = calloc(1, sizeof(Evas_Engine_Info_Cairo_X11));
if (!info) return NULL;
info->magic.magic = rand();
- printf("CAIRO: create info...\n");
+ INFO("CAIRO: create info...");
return info;
e = NULL;
}
Evas_Engine_Info_Cairo_X11 *info;
info = (Evas_Engine_Info_Cairo_X11 *)in;
- printf("CAIRO: setup info...\n");
+ INFO("CAIRO: setup info...");
if (!e->engine.data.output)
e->engine.data.output =
eng_output_setup(e->output.w,
free(re);
return NULL;
}
- printf("CAIRO: cairo window setup done.\n");
+ INFO("CAIRO: cairo window setup done.");
evas_common_cpu_init();
evas_common_blend_init();
//#define ENABLE_LOG_PRINTF
#ifdef ENABLE_LOG_PRINTF
-#define Log(str, ...) printf("D3D "str"\n", __VA_ARGS__)
+#define Log(str, ...) INFO("D3D "str, __VA_ARGS__)
#else
#define Log(str, ...)
#endif
return;
error:
- fprintf(stderr, "ERROR: could not clear surface: %s\n",
- DirectFBErrorString(r));
+ ERROR("DirectFB: could not clear surface: %s",
+ DirectFBErrorString(r));
}
static void
r = surface->GetPixelFormat(surface, &fmt);
if (r != DFB_OK)
{
- fprintf(stderr, "ERROR: could not get pixel format: %s\n",
+ ERROR("DirectFB: could not get pixel format: %s",
DirectFBErrorString(r));
return;
}
cr.y2 = y + h - 1;
r = surface->Flip(surface, &cr, DSFLIP_NONE);
if (r != DFB_OK)
- fprintf(stderr, "ERROR: could not update surface: %s\n",
- DirectFBErrorString(r));
+ WARN("DirectFB: could not update surface: %s",
+ DirectFBErrorString(r));
}
static IDirectFBSurface *
r = dfb->CreateSurface(dfb, &desc, &s);
if (r != DFB_OK)
{
- fprintf(stderr, "ERROR: cannot create DirectFB surface: %s\n",
+ ERROR("DirectFB: cannot create DirectFB surface: %s",
DirectFBErrorString(r));
return NULL;
}
r = dst->GetAccelerationMask(dst, src, &mask);
if (r != DFB_OK)
{
- fprintf(stderr, "ERROR: Could not retrieve acceleration mask: %s\n",
+ ERROR("DirectFB: Could not retrieve acceleration mask: %s",
DirectFBErrorString(r));
return;
}
- fputs("Acceleration: ", stderr);
+ DEBUG("Acceleration: ");
-#define O(m) if (mask & m) fputs(#m " ", stderr)
+#define O(m) if (mask & m) DEBUG(#m " ")
O(DFXL_FILLRECTANGLE);
O(DFXL_DRAWRECTANGLE);
O(DFXL_DRAWLINE);
O(DFXL_DRAWSTRING);
#undef O
- if (mask == DFXL_NONE) fputs("<NONE>", stderr);
- fputc('\n', stderr);
+ if (mask == DFXL_NONE) DEBUG("<NONE>");
#endif /* DFB_DEBUG_ACCELERATION */
}
goto error;
#ifdef DFB_DEBUG_FLAGS
- printf("DRAW: color=%d %d %d %d, flags=%s\n",
+ DEBUG("DirectFB DRAW: color=%d %d %d %d, flags=%s",
r, g, b, a, _dfb_draw_flags_str(flags));
#endif /* DFB_DEBUG_FLAGS */
return 1;
error:
- fprintf(stderr, "ERROR: could not set color from context: %s\n",
+ ERROR("DirectFB: could not set color from context: %s",
DirectFBErrorString(res));
return 0;
}
goto error;
#ifdef DFB_DEBUG_FLAGS
- printf("BLIT: sfunc=%s, dfunc=%s, color=%d %d %d %d\n\tblit=%s\n\tdraw=%s\n",
+ DEBUG("DirectFB BLIT: sfunc=%s, dfunc=%s, color=%d %d %d %d\n\tblit=%s\n\tdraw=%s",
_dfb_blend_func_str(src_func), _dfb_blend_func_str(dst_func),
r, g, b, a,
_dfb_blit_flags_str(blit_flags), _dfb_draw_flags_str(draw_flags));
return 1;
error:
- fprintf(stderr, "ERROR: Could not set blit params: %s\n",
- DirectFBErrorString(res));
+ ERROR("DirectFB: Could not set blit params: %s",
+ DirectFBErrorString(res));
return 0;
}
if (pitch != (sw * 4))
{
/* XXX TODO: support other pixel formats. */
- fprintf(stderr,
- "ERROR: IDirectFBSurface pitch(%d) is not supported: "
- "should be %d.\n",
+ ERROR("DirectFB: IDirectFBSurface pitch(%d) is not supported: "
+ "should be %d.",
pitch, sw * 4);
surface->Unlock(surface);
return 0;
r = deie->surface->GetSize(deie->surface, &w, &h);
if (r != DFB_OK)
{
- fprintf(stderr, "ERROR: Could not get surface size: %s\n",
+ ERROR("DirectFB: Could not get surface size: %s",
DirectFBErrorString(r));
return size;
}
{
DirectFB_Engine_Image_Entry *eim = (DirectFB_Engine_Image_Entry *)eie;
- fprintf(stderr, "*** %s image (%p) ***\n", context, eim);
+ DEBUG("*** %s image (%p) ***", context, eim);
if (eim)
{
- fprintf(stderr,
- "* W: %d\n"
+ DEBUG("* W: %d\n"
"* H: %d\n"
"* R: %d\n"
"* Key: %s\n"
- "* DFB Surface: %p\n",
+ "* DFB Surface: %p",
eie->w, eie->h, eie->references, eie->cache_key, eim->surface);
if (eie->src)
- fprintf(stderr,
- "* Pixels: %p\n", ((RGBA_Image*) eie->src)->image.data);
+ DEBUG("* Pixels: %p", ((RGBA_Image*) eie->src)->image.data);
}
- fputs("*** ***\n", stderr);
+ DEBUG("*** ***");
}
#endif
if (!idfb)
{
- fputs("ERROR: missing IDirectFB\n", stderr);
+ ERROR("missing IDirectFB");
return EINA_FALSE;
}
dfb = idfb;
if (!surface)
{
- fputs("ERROR: missing IDirectFBSurface\n", stderr);
+ ERROR("missing IDirectFBSurface");
return EINA_FALSE;
}
r = surface->GetSize(surface, &sw, &sh);
if (r != DFB_OK)
{
- fprintf(stderr, "ERROR: could not get surface %p size: %s\n",
- surface, DirectFBErrorString(r));
+ ERROR("DirectFB: could not get surface %p size: %s",
+ surface, DirectFBErrorString(r));
return EINA_FALSE;
}
if ((w > sw) || (h > sh))
{
- fprintf(stderr,
- "ERROR: requested size is larger than surface: %dx%d > %dx%d\n",
+ ERROR("DirectFB: requested size is larger than surface: %dx%d > %dx%d",
w, h, sw, sh);
return EINA_FALSE;
}
evas_common_line_init();
evas_common_font_init();
evas_common_draw_init();
- evas_common_tilebuf_init();
+ evas_common_tilebuf_init();
}
static int
re->tb = evas_common_tilebuf_new(w, h);
if (!re->tb)
{
- fputs("ERROR: could not allocate tile buffer.\n", stderr);
+ ERROR("DirectFB: could not allocate tile buffer.");
goto failed_tilebuf;
}
evas_common_tilebuf_set_tile_size(re->tb, TILESIZE, TILESIZE);
evas_cache_engine_image_engine(re->cache, re->spec->surface);
if (!re->screen_image)
{
- fputs("ERROR: RGBA_Image allocation from DFB failed\n", stderr);
+ ERROR("DirectFB: RGBA_Image allocation from DFB failed");
goto failed_image;
}
re->screen_image->flags.engine_surface = 1;
re->tb = NULL;
failed_tilebuf:
re->screen_image = NULL;
- fputs("ERROR: Evas DirectFB reconfigure failed\n", stderr);
+ ERROR("DirectFB: Evas DirectFB reconfigure failed");
return 0;
}
evas_common_image_cache_get());
if (!re->cache)
{
- fputs("ERROR: Evas_Cache_Engine_Image allocation failed!\n", stderr);
+ ERROR("DirectFB: Evas_Cache_Engine_Image allocation failed!");
goto fatal_after_engine;
}
if (!evas_engine_dfb_output_reconfigure(re, w, h))
{
- fputs("ERROR: Could not reconfigure evas engine.\n", stderr);
+ ERROR("DirectFB: Could not reconfigure evas engine.");
goto fatal_after_reconfigure;
}
fatal_after_engine:
free(re);
fatal:
- fputs("FATAL: unable to continue, abort()!\n", stderr);
+ CRITICAL("DirectFB: unable to continue, abort()!");
abort();
return NULL;
}
evas_engine_dfb_output_resize(void *data, int w, int h)
{
if (!evas_engine_dfb_output_reconfigure(data, w, h))
- fputs("ERROR: failed to resize DirectFB evas\n", stderr);
+ ERROR("DirectFB: failed to resize DirectFB evas");
}
static void
Render_Engine *re = data;
if (re->update_regions_count != 0)
- fputs("ERROR: update_regions_count not 0 as it should be!\n", stderr);
+ ERROR("DirectFB: update_regions_count not 0 as it should be!");
free(re->update_regions);
re->update_regions_count = 0;
break;
error:
- fprintf(stderr, "ERROR: could not lock surface %p: %s\n",
+ ERROR("DirectFB: could not lock surface %p: %s",
s, DirectFBErrorString(r));
*image_data = NULL;
break;
bpp = mode->fb_var.bits_per_pixel / 8;
break;
default:
- fprintf(stderr, "Cannot handle framebuffer of depth %i\n",
- mode->fb_var.bits_per_pixel);
+ ERROR("EvasFB: Cannot handle framebuffer of depth %i",
+ mode->fb_var.bits_per_pixel);
fb_cleanup();
free(mode);
return NULL;
chown(vtname, getuid(), getgid());
if (access(vtname,R_OK | W_OK) == -1)
{
- fprintf(stderr,"access %s: %s\n",vtname,strerror(errno));
+ CRITICAL("EvasFB: access %s: %s",vtname,strerror(errno));
exit(1);
}
open(vtname,O_RDWR);
}
if (fb == -1)
{
- fprintf(stderr,"open %s: %s\n", dev, strerror(errno));
+ CRITICAL("open %s: %s", dev, strerror(errno));
fb_cleanup();
exit(1);
}
tty = 0;
else if ((tty = open("/dev/tty",O_RDWR)) == -1)
{
- fprintf(stderr,"open %s: %s\n", "/dev/tty", strerror(errno));
+ CITICAL("open %s: %s", "/dev/tty", strerror(errno));
exit(1);
}
if (tty)
if (fb_fix.type != FB_TYPE_PACKED_PIXELS)
{
- fprintf(stderr,"can handle only packed pixel frame buffers\n");
+ CRITICAL("can handle only packed pixel frame buffers");
fb_cleanup();
exit(1);
}
evas_fb_outbuf_fb_free(Outbuf *buf)
{
/* FIXME: impliment */
- printf("destroying fb info.. not implemented!!!! WARNING. LEAK!\n");
+ WARN("destroying fb info.. not implemented!!!! WARNING. LEAK!");
if (buf->priv.back_buf)
evas_cache_image_drop(&buf->priv.back_buf->cache_entry);
free(buf);
if (GLEW_VERSION_2_0)
{
- printf ("2.0\n");
+ INFO("2.0");
}
return 1;
re = (Render_Engine *)data;
re->win->draw.redraw = 0;
-// printf("GL: finish update cycle!\n");
+// INFO("GL: finish update cycle!");
}
/* at least the nvidia drivers are so abysmal that copying from the backbuffer
RGBA_Draw_Context *dc = (RGBA_Draw_Context *)context;
Evas_Quartz_Gradient *gr = (Evas_Quartz_Gradient *)gradient;
- printf("#Gradient#\n");
- printf("Fill: %i %i %i %i\n", gr->grad->fill.x, gr->grad->fill.y, gr->grad->fill.w, gr->grad->fill.h);
- printf("Type: %s %s\n", gr->grad->type.name, gr->grad->type.params);
- printf("XYWH: %i %i %i %i\n", x, y, w, h);
- printf("Geom: %p %p\n", gr->grad->type.geometer, gr->grad->type.geometer->get_fill_func);
- printf("Map: len: %d angle: %f direction: %d offset: %f\n", gr->grad->map.len, gr->grad->map.angle, gr->grad->map.direction, gr->grad->map.offset);
- printf("Color: nstops: %d len: %d\n", gr->grad->color.nstops, gr->grad->color.len);
- printf("Alpha: nstops: %d len: %d\n", gr->grad->alpha.nstops, gr->grad->alpha.len);
- printf("\n");
+ INFO("#Gradient#");
+ INFO("Fill: %i %i %i %i", gr->grad->fill.x, gr->grad->fill.y, gr->grad->fill.w, gr->grad->fill.h);
+ INFO("Type: %s %s", gr->grad->type.name, gr->grad->type.params);
+ INFO("XYWH: %i %i %i %i", x, y, w, h);
+ INFO("Geom: %p %p", gr->grad->type.geometer, gr->grad->type.geometer->get_fill_func);
+ INFO("Map: len: %d angle: %f direction: %d offset: %f", gr->grad->map.len, gr->grad->map.angle, gr->grad->map.direction, gr->grad->map.offset);
+ INFO("Color: nstops: %d len: %d", gr->grad->color.nstops, gr->grad->color.len);
+ INFO("Alpha: nstops: %d len: %d", gr->grad->alpha.nstops, gr->grad->alpha.len);
+ INFO("");
if ((gr->sw != w) || (gr->sh != h))
gr->changed = 1;
*/
#define NOT_IMPLEMENTED() \
- fprintf(stderr, "NOT_IMPLEMENTED: %s() at %s:%d\n", \
+ WARN("NOT_IMPLEMENTED: %s() at %s:%d", \
__FUNCTION__, __FILE__, __LINE__)
static void *
{
if ((image_data) && (cspace != EVAS_COLORSPACE_RGB565_A5P))
{
- fprintf(stderr, "Unsupported colorspace %d in %s() (%s:%d)\n",
+ WARN("Unsupported colorspace %d in %s() (%s:%d)",
cspace, __FUNCTION__, __FILE__, __LINE__);
return NULL;
}
{
if ((image_data) && (cspace != EVAS_COLORSPACE_RGB565_A5P))
{
- fprintf(stderr, "Unsupported colorspace %d in %s() (%s:%d)\n",
+ WARN("Unsupported colorspace %d in %s() (%s:%d)",
cspace, __FUNCTION__, __FILE__, __LINE__);
return NULL;
}
#include <time.h>
#include <SDL/SDL.h>
+#include "evas_common.h"
#include "evas_engine.h"
/* function tables - filled in later (func and parent func) */
re->cache = evas_cache_engine_image_init(&_sdl16_cache_engine_image_cb, evas_common_soft16_image_cache_get());
if (!re->cache)
{
- fprintf(stderr, "Evas_Cache_Engine_Image allocation failed!\n");
+ ERROR("Evas_Cache_Engine_Image allocation failed!");
free(re);
return NULL;
}
| (noframe ? SDL_NOFRAME : 0));
if (!surface)
{
- fprintf(stderr, "SDL_SetVideoMode [ %i x %i x 16 ] failed\n", w, h);
+ ERROR("SDL_SetVideoMode [ %i x %i x 16 ] failed", w, h);
evas_cache_engine_image_shutdown(re->cache);
free(re);
return NULL;
re->soft16_engine_image = (SDL_Engine_Image_Entry *) evas_cache_engine_image_engine(re->cache, surface);
if (!re->soft16_engine_image)
{
- fprintf(stderr, "Soft16_Image allocation from SDL failed\n");
+ ERROR("Soft16_Image allocation from SDL failed");
evas_cache_engine_image_shutdown(re->cache);
free(re);
return NULL;
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
{
- fprintf(stderr, "SDL_Init failed with %s\n", SDL_GetError());
+ ERROR("SDL_Init failed with %s", SDL_GetError());
SDL_Quit();
return 0;
}
| (re->flags.noframe ? SDL_NOFRAME : 0));
if (!surface)
{
- fprintf(stderr, "Unable to change the resolution to : %ix%i\n", w, h);
+ ERROR("Unable to change the resolution to : %ix%i", w, h);
exit(-1);
}
re->soft16_engine_image = (SDL_Engine_Image_Entry *) evas_cache_engine_image_engine(re->cache, surface);
if (!re->soft16_engine_image)
{
- fprintf(stderr, "RGBA_Image allocation from SDL failed\n");
+ ERROR("RGBA_Image allocation from SDL failed");
exit(-1);
}
if (cspace != EVAS_COLORSPACE_RGB565_A5P)
{
- fprintf(stderr, "Unsupported colorspace %d in %s() (%s:%d)\n",
+ WARN("Unsupported colorspace %d in %s() (%s:%d)",
cspace, __FUNCTION__, __FILE__, __LINE__);
return NULL;
}
- fprintf(stderr, "s image_data: %p\n", image_data);
+ WARN("s image_data: %p", image_data);
return evas_cache_engine_image_copied_data(re->cache,
w, h,
if (cspace != EVAS_COLORSPACE_RGB565_A5P)
{
- fprintf(stderr, "Unsupported colorspace %d in %s() (%s:%d)\n",
+ WARN("Unsupported colorspace %d in %s() (%s:%d)",
cspace, __FUNCTION__, __FILE__, __LINE__);
return NULL;
}
priv = (Evas_Engine_WinCE_DDraw_Priv *)malloc(sizeof(Evas_Engine_WinCE_DDraw_Priv));
if (!priv)
return NULL;
-
+
priv->module = LoadLibrary(L"ddraw.dll");
if (!priv->module)
{
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Can not load ddraw.dll\n");
+ CRITICAL("[Engine] [WinCE DDraw] Can not load ddraw.dll");
goto free_priv;
}
lib_DirectDrawCreate = (fct_DirectDrawCreate)GetProcAddress(priv->module, L"DirectDrawCreate");
if (!lib_DirectDrawCreate)
{
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Can not initialize DirectDraw\n");
+ CRITICAL("[Engine] [WinCE DDraw] Can not initialize DirectDraw");
goto free_lib;
}
res = lib_DirectDrawCreate(NULL, (IUnknown**)&priv->object, NULL);
if (FAILED(res))
{
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Can not create DirectDraw object\n");
+ CRITICAL("[Engine] [WinCE DDraw] Can not create DirectDraw object");
goto free_lib;
}
res = priv->object->SetCooperativeLevel(window, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
if (FAILED(res))
{
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Can not set window to fullscreen\n");
+ CRITICAL("[Engine] [WinCE DDraw] Can not set window to fullscreen");
goto release_object;
}
res = priv->object->CreateSurface(&surface_desc, &priv->surface, NULL);
if (FAILED(res))
{
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Can not create surface\n");
+ CRITICAL("[Engine] [WinCE DDraw] Can not create surface");
goto release_object;
}
res = priv->surface->Lock(NULL, &surface_desc, DDLOCK_READONLY, NULL);
if (FAILED(res))
{
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Can not lock surface\n");
+ CRITICAL("[Evas] [Engine] [WinCE DDraw] Can not lock surface");
goto release_surface;
}
if ((priv->width != width) ||
(priv->height != height))
{
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Size mismatch\n");
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] asked : %dx%d\n", width, height);
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] got : %dx%d\n", priv->width, priv->height);
+ CRITICAL("[Engine] [WinCE DDraw] Size mismatch");
+ CRITICAL("[Engine] [WinCE DDraw] asked : %dx%d", width, height);
+ CRITICAL("[Engine] [WinCE DDraw] got : %dx%d", priv->width, priv->height);
goto release_surface;
}
res = priv->surface->Unlock(NULL);
if (FAILED(res))
{
- fprintf(stderr, "[Evas] [Engine] [WinCE DDraw] Can not unlock surface\n");
+ CRITICAL("[Engine] [WinCE DDraw] Can not unlock surface");
goto release_surface;
}
(char *) &gxInfo);
if (result <= 0)
{
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] ExtEscape() with GETGXINFO failed\n");
+ ERROR("[Engine] [WinCE FB] ExtEscape() with GETGXINFO failed");
return 0;
}
dc = GetDC (window);
if (!dc)
{
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] Can not get DC\n");
+ ERROR("[Engine] [WinCE FB] Can not get DC");
free(priv);
return NULL;
}
if ((priv->width != width) ||
(priv->height != height))
{
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] Size mismatch\n");
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] asked: %dx%d\n", width, height);
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] got : %dx%d\n", priv->width, priv->height);
+ ERROR("[Engine] [WinCE FB] Size mismatch");
+ ERROR("[Engine] [WinCE FB] asked: %dx%d", width, height);
+ ERROR("[Engine] [WinCE FB] got : %dx%d", priv->width, priv->height);
ReleaseDC(window, dc);
free(priv);
return NULL;
(rfbi.wBPP != 16) ||
(rfbi.wFormat != 1))
{
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] ExtEscape() with GETRAWFRAMEBUFFER failed\n");
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] trying ExtEscape() with GETGXINFO\n");
+ ERRPR("[Engine] [WinCE FB] ExtEscape() with GETRAWFRAMEBUFFER failed");
+ ERROR("[Engine] [WinCE FB] trying ExtEscape() with GETGXINFO");
if (!_evas_software_wince_gxinfo_init(dc, &priv->width, &priv->height, &priv->buffer))
{
ReleaseDC(window, dc);
if ((priv->width != width) ||
(priv->height != height))
{
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] Size mismatch\n");
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] asked: %dx%d\n", width, height);
- fprintf (stderr, "[Evas] [Engine] [WinCE FB] got : %dx%d\n", priv->width, priv->height);
+ ERROR("[Engine] [WinCE FB] Size mismatch");
+ ERROR("[Engine] [WinCE FB] asked: %dx%d", width, height);
+ ERROR("[Engine] [WinCE FB] got : %dx%d", priv->width, priv->height);
ReleaseDC(window, dc);
free(priv);
return NULL;
gapi_lib = LoadLibrary(L"gx.dll");
if (!gapi_lib)
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] Can not load gx.dll\n");
+ ERROR("[Engine] [WinCE GAPI] Can not load gx.dll");
goto free_priv;
}
}
!suspend ||
!resume)
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] Can not find valid symbols\n");
+ ERROR("[Engine] [WinCE GAPI] Can not find valid symbols");
goto free_lib;
}
if (!display_open(window, GX_FULLSCREEN))
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] Can not open display\n");
+ ERROR("[Engine] [WinCE GAPI] Can not open display");
goto free_lib;
}
// verify pixel format
if(!(prop.ffFormat & kfDirect565) || (prop.cBPP != 16))
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] display format mismatch\n");
+ ERROR("[Engine] [WinCE GAPI] display format mismatch");
goto close_display;
}
if ((GetSystemMetrics(SM_CXSCREEN) != (int)prop.cxWidth) ||
(GetSystemMetrics(SM_CYSCREEN) != (int)prop.cyHeight))
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] display size mismatch\n");
+ ERROR("[Engine] [WinCE GAPI] display size mismatch");
goto close_display;
}
dc = GetDC (window);
if (!dc)
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] Can not get device\n");
+ ERROR("[Engine] [WinCE GAPI] Can not get device");
goto close_display;
}
(char *) &gxInfo);
if (result <= 0)
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] ExtEscape failed\n");
+ ERROR("[Engine] [WinCE GAPI] ExtEscape failed");
ReleaseDC(window, dc);
goto close_display;
}
if ((priv->width != width) ||
(priv->height != height))
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] Size mismatch\n");
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] asked: %dx%d\n", width, height);
- fprintf (stderr, "[Evas] [Engine] [WinCE GAPI] got : %dx%d\n", priv->width, priv->height);
+ WARN("[Engine] [WinCE GAPI] Size mismatch");
+ WARN("[Engine] [WinCE GAPI] asked: %dx%d", width, height);
+ WARN("[Engine] [WinCE GAPI] got : %dx%d", priv->width, priv->height);
goto close_display;
}
priv->dc = GetDC(window);
if (!priv->dc)
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GDI] Can not get DC\n");
+ WARN("[Engine] [WinCE GDI] Can not get DC");
free(priv);
return NULL;
}
priv->bitmap_info = (BITMAPINFO_16bpp *)malloc(sizeof(BITMAPINFO_16bpp));
if (!priv->bitmap_info)
{
- fprintf (stderr, "[Evas] [Engine] [WinCE GDI] Can not allocate bitmap info\n");
+ WARN("[Engine] [WinCE GDI] Can not allocate bitmap info");
ReleaseDC(window, priv->dc);
free(priv);
return NULL;
if (!conv_func)
{
- fprintf(stderr, ".[ Evas Error ].\n"
- " {\n"
- " At depth %i:\n"
- " RGB format mask: %08x, %08x, %08x\n"
- " Not supported by and compiled in converters!\n"
- " }\n",
+ ERROR("DDraw engine Error"
+ " {"
+ " At depth %i:"
+ " RGB format mask: %08x, %08x, %08x"
+ " Not supported by and compiled in converters!"
+ " }",
buf->priv.dd.depth,
buf->priv.mask.r,
buf->priv.mask.g,
if (!window)
{
- fprintf (stderr, "[Evas] [Engine] [GDI] Window is NULL\n");
+ ERROR("[Engine] [GDI] Window is NULL");
return 0;
}
buf->priv.gdi.dc = GetDC(window);
if (!buf->priv.gdi.dc)
{
- fprintf (stderr, "[Evas] [Engine] [GDI] Can not get DC\n");
+ ERROR("[Engine] [GDI] Can not get DC");
return 0;
}
/* FIXME: check depth */
if (depth != GetDeviceCaps(buf->priv.gdi.dc, BITSPIXEL))
{
- fprintf (stderr, "[Evas] [Engine] [GDI] no compatible depth\n");
+ ERROR("[Engine] [GDI] no compatible depth");
ReleaseDC(window, buf->priv.gdi.dc);
return 0;
}
buf->priv.gdi.bitmap_info = (BITMAPINFO_GDI *)malloc(sizeof(BITMAPINFO_GDI));
if (!buf->priv.gdi.bitmap_info)
{
- fprintf (stderr, "[Evas] [Engine] [GDI] Can not allocate bitmap info\n");
+ ERROR("[Engine] [GDI] Can not allocate bitmap info");
ReleaseDC(window, buf->priv.gdi.dc);
return 0;
}
buf->priv.gdi.bitmap_info->masks[2] = 0x000000ff;
break;
default:
- fprintf (stderr, "[Evas] [Engine] [GDI] wrong depth\n");
+ ERROR("[Engine] [GDI] wrong depth");
free(buf->priv.gdi.bitmap_info);
ReleaseDC(window, buf->priv.gdi.dc);
return 0;
if (!conv_func)
{
- fprintf(stderr, ".[ Evas Error ].\n"
- " {\n"
- " At depth %i:\n"
- " RGB format mask: %08lx, %08lx, %08lx\n"
- " Not supported by and compiled in converters!\n"
- " }\n",
+ ERROR(".[ soft_gdi engine Error ]."
+ " {"
+ " At depth %i:"
+ " RGB format mask: %08lx, %08lx, %08lx"
+ " Not supported by and compiled in converters!"
+ " }",
buf->priv.gdi.depth,
buf->priv.gdi.bitmap_info->masks[0],
buf->priv.gdi.bitmap_info->masks[1],
#include <time.h>
#include <SDL/SDL.h>
+#include "evas_common.h"
#include "evas_engine.h"
/* #define DEBUG_SDL */
if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0)
{
- fprintf(stderr, "SDL_Init failed with %s\n", SDL_GetError());
+ ERROR("SDL_Init failed with %s", SDL_GetError());
SDL_Quit();
return 0;
}
if (!surface)
{
- fprintf(stderr, "Unable to change the resolution to : %ix%i\n", w, h);
+ ERROR("Unable to change the resolution to : %ix%i", w, h);
exit(-1);
}
re->rgba_engine_image = (SDL_Engine_Image_Entry *) evas_cache_engine_image_engine(re->cache, surface);
if (!re->rgba_engine_image)
{
- fprintf(stderr, "RGBA_Image allocation from SDL failed\n");
+ ERROR("RGBA_Image allocation from SDL failed");
exit(-1);
}
re->cache = evas_cache_engine_image_init(&_sdl_cache_engine_image_cb, evas_common_image_cache_get());
if (!re->cache)
{
- fprintf(stderr, "Evas_Cache_Engine_Image allocation failed!\n");
+ CRITICAL("Evas_Cache_Engine_Image allocation failed!");
exit(-1);
}
if (!surface)
{
- fprintf(stderr, "SDL_SetVideoMode [ %i x %i x 32 ] failed.\n", w, h);
+ CRITICAL("SDL_SetVideoMode [ %i x %i x 32 ] failed.", w, h);
exit(-1);
}
re->rgba_engine_image = (SDL_Engine_Image_Entry *) evas_cache_engine_image_engine(re->cache, surface);
if (!re->rgba_engine_image)
{
- fprintf(stderr, "RGBA_Image allocation from SDL failed\n");
+ CRITICAL("RGBA_Image allocation from SDL failed");
exit(-1);
}
{
SDL_Engine_Image_Entry *eim = (SDL_Engine_Image_Entry *) eie;
- printf ("*** %s image (%p) ***\n", context, eim);
+ DEBUG("*** %s image (%p) ***", context, eim);
if (eim)
{
- printf ("* W: %i\n* H: %i\n* R: %i\n", eim->cache_entry.w, eim->cache_entry.h, eim->cache_entry.references);
+ DEBUG ("* W: %i\n* H: %i\n* R: %i", eim->cache_entry.w, eim->cache_entry.h, eim->cache_entry.references);
if (eim->cache_entry.src)
- printf ("* Pixels: %p\n* SDL Surface: %p\n",((RGBA_Image*) eim->cache_entry.src)->image.data, eim->surface);
+ DEBUG ("* Pixels: %p\n* SDL Surface: %p",((RGBA_Image*) eim->cache_entry.src)->image.data, eim->surface);
if (eim->surface)
- printf ("* Surface->pixels: %p\n", eim->surface->pixels);
- printf ("* Key: %s\n", eim->cache_entry.cache_key);
- printf ("* Reference: %i\n", eim->cache_entry.references);
+ DEBUG ("* Surface->pixels: %p", eim->surface->pixels);
+ DEBUG ("* Key: %s", eim->cache_entry.cache_key);
+ DEBUG ("* Reference: %i", eim->cache_entry.references);
}
- printf ("*** ***\n");
+ DEBUG ("*** ***");
}
#endif
evas_software_xcb_x_output_buffer_free(xcbob, 1);
if (!conv_func)
{
- printf(".[ Evas Error ].\n"
- " {\n"
- " At depth %i:\n"
- " RGB format mask: %08x, %08x, %08x\n"
- " Palette mode: %i\n"
- " Not supported by and compiled in converters!\n"
- " }\n",
+ ERROR("XCB Engine"
+ " {"
+ " At depth %i:"
+ " RGB format mask: %08x, %08x, %08x"
+ " Palette mode: %i"
+ " Not supported by and compiled in converters!"
+ " }",
buf->priv.x11.xcb.depth,
buf->priv.mask.r,
buf->priv.mask.g,
if (!rast)
{
- fprintf(stderr, "Evas Tiff loader: out of memory\n");
-
- TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
- TIFFClose(tif);
-
+ ERROR("Evas Tiff loader: out of memory");
+
+ TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
+ TIFFClose(tif);
+
return 0;
}
if (rgba_image.rgba.put.any == NULL)
{
- fprintf(stderr, "Evas Tiff loader: no put function");
+ ERROR("Evas Tiff loader: no put function");
_TIFFfree(rast);
TIFFRGBAImageEnd((TIFFRGBAImage *) & rgba_image);
}
else
{
- printf("channel bits == %i\n", (int)rgba_image.rgba.samplesperpixel);
+ INFO("channel bits == %i", (int)rgba_image.rgba.samplesperpixel);
}
_TIFFfree(rast);
/* Header */
if (sscanf(line, "%i %i %i %i", &w, &h, &ncolors, &cpp) != 4)
{
- fprintf(stderr,
- "XPM ERROR: XPM file malformed header\n");
+ ERROR("XPM ERROR: XPM file malformed header");
free(line);
fclose(f);
xpm_parse_done();
}
if ((ncolors > 32766) || (ncolors < 1))
{
- fprintf(stderr,
- "XPM ERROR: XPM files with colors > 32766 or < 1 not supported\n");
+ ERROR("XPM ERROR: XPM files with colors > 32766 or < 1 not supported");
free(line);
fclose(f);
xpm_parse_done();
}
if ((cpp > 5) || (cpp < 1))
{
- fprintf(stderr,
- "XPM ERROR: XPM files with characters per pixel > 5 or < 1not supported\n");
+ ERROR("XPM ERROR: XPM files with characters per pixel > 5 or < 1not supported");
free(line);
fclose(f);
xpm_parse_done();
}
if ((w > IMG_MAX_SIZE) || (w < 1))
{
- fprintf(stderr,
- "XPM ERROR: Image width > IMG_MAX_SIZE or < 1 pixels for file\n");
+ ERROR("XPM ERROR: Image width > IMG_MAX_SIZE or < 1 pixels for file");
free(line);
fclose(f);
xpm_parse_done();
}
if ((h > IMG_MAX_SIZE) || (h < 1))
{
- fprintf(stderr,
- "XPM ERROR: Image height > IMG_MAX_SIZE or < 1 pixels for file\n");
+ ERROR("XPM ERROR: Image height > IMG_MAX_SIZE or < 1 pixels for file");
free(line);
fclose(f);
xpm_parse_done();
if (IMG_TOO_BIG(w, h))
{
fprintf(stderr,
- "XPM ERROR: Image just too big to ever allocate\n");
+ "XPM ERROR: Image just too big to ever allocate");
free(line);
fclose(f);
xpm_parse_done();