|
@ -167,14 +167,12 @@ Image::~Image() { |
|
|
if (filename) free(filename); |
|
|
if (filename) free(filename); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#if 0 |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
/*
|
|
|
* Load callback. |
|
|
* Load callback. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
static int |
|
|
int |
|
|
EIO_Load(eio_req *req) { |
|
|
Image::EIO_load(eio_req *req) { |
|
|
Image *img = (Image *) req->data; |
|
|
Image *img = (Image *) req->data; |
|
|
req->result = img->loadSurface(); |
|
|
req->result = img->loadSurface(); |
|
|
return 0; |
|
|
return 0; |
|
@ -184,8 +182,8 @@ EIO_Load(eio_req *req) { |
|
|
* After load callback. |
|
|
* After load callback. |
|
|
*/ |
|
|
*/ |
|
|
|
|
|
|
|
|
static int |
|
|
int |
|
|
EIO_AfterLoad(eio_req *req) { |
|
|
Image::EIO_afterLoad(eio_req *req) { |
|
|
HandleScope scope; |
|
|
HandleScope scope; |
|
|
Image *img = (Image *) req->data; |
|
|
Image *img = (Image *) req->data; |
|
|
|
|
|
|
|
@ -195,12 +193,11 @@ EIO_AfterLoad(eio_req *req) { |
|
|
img->loaded(); |
|
|
img->loaded(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
img->Unref(); |
|
|
ev_unref(EV_DEFAULT_UC); |
|
|
ev_unref(EV_DEFAULT_UC); |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
/*
|
|
|
* Initiate image loading. |
|
|
* Initiate image loading. |
|
|
*/ |
|
|
*/ |
|
@ -208,12 +205,10 @@ EIO_AfterLoad(eio_req *req) { |
|
|
void |
|
|
void |
|
|
Image::load() { |
|
|
Image::load() { |
|
|
if (LOADING != state) { |
|
|
if (LOADING != state) { |
|
|
// TODO: use node IO
|
|
|
Ref(); |
|
|
// Ref();
|
|
|
|
|
|
state = LOADING; |
|
|
state = LOADING; |
|
|
loadSync(); |
|
|
eio_custom(EIO_load, EIO_PRI_DEFAULT, EIO_afterLoad, this); |
|
|
// eio_custom(EIO_Load, EIO_PRI_DEFAULT, EIO_AfterLoad, this);
|
|
|
ev_ref(EV_DEFAULT_UC); |
|
|
// ev_ref(EV_DEFAULT_UC);
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|