int cserve2_cache_file_open(Client *client, unsigned int client_file_id, const char *path, const char *key, unsigned int rid, Evas_Image_Load_Opts *lo);
void cserve2_cache_file_close(Client *client, unsigned int client_file_id);
int cserve2_cache_image_entry_create(Client *client, int rid, unsigned int client_file_id, unsigned int image_id, Evas_Image_Load_Opts *opts);
-void cserve2_rgba_image_scale_do(void *src_data, void *dst_data, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int alpha, int smooth);
+void cserve2_rgba_image_scale_do(void *src_data, int src_full_w, int src_full_h, void *dst_data, int src_x, int src_y, int src_w, int src_h, int dst_x, int dst_y, int dst_w, int dst_h, int alpha, int smooth);
void cserve2_cache_image_load(Client *client, unsigned int client_image_id, unsigned int rid);
void cserve2_cache_image_preload(Client *client, unsigned int client_image_id, unsigned int rid);
void cserve2_cache_image_unload(Client *client, unsigned int client_image_id);
msg->shm.mmap_size = cserve2_shm_map_size_get(ientry->shm);
msg->shm.image_size = cserve2_shm_size_get(ientry->shm);
msg->alpha_sparse = idata->alpha_sparse;
+ msg->image.w = idata->w;
+ msg->image.h = idata->h;
if (idata->shm_id)
{
char *scale_map, *orig_map;
void *src_data, *dst_data;
File_Data *fd;
+ Image_Data *orig_idata;
+#warning FIXME Remove this call, add alpha flag to Image_Data
fd = _file_data_find(idata->file_id);
if (!fd)
{
return -1;
}
+ orig_idata = _image_data_find(original->base.id);
+ if (!orig_idata)
+ {
+ ERR("Could not find image %u", original->base.id);
+ return -1;
+ }
+
scale_map = cserve2_shm_map(scale_shm);
if (scale_map == MAP_FAILED)
{
src_data = orig_map + cserve2_shm_map_offset_get(original->shm);
dst_data = scale_map + cserve2_shm_map_offset_get(scale_shm);
- DBG("Scaling image ([%d,%d:%dx%d] --> [%d,%d:%dx%d])",
+ DBG("Scaling image ([%dx%d]:[%d,%d:%dx%d] --> [%d,%d:%dx%d])",
+ orig_idata->w, orig_idata->h,
idata->opts.scale_load.src_x, idata->opts.scale_load.src_y,
idata->opts.scale_load.src_w, idata->opts.scale_load.src_h,
0, 0,
idata->opts.scale_load.dst_w, idata->opts.scale_load.dst_h);
cserve2_rgba_image_scale_do(
- src_data, dst_data,
+ src_data, orig_idata->w, orig_idata->h,
+ dst_data,
idata->opts.scale_load.src_x, idata->opts.scale_load.src_y,
idata->opts.scale_load.src_w, idata->opts.scale_load.src_h,
0, 0,
cserve2_shared_string_del(idata->shm_id);
ientry->shm = scale_shm;
idata->shm_id = 0;
+ idata->w = idata->opts.scale_load.dst_w;
+ idata->h = idata->opts.scale_load.dst_h;
return 0;
}
if (!idata->doload)
DBG("Entry %d loaded by speculative preload.", idata->id);
+ idata->w = resp->w;
+ idata->h = resp->h;
+
if (_scaling_needed(idata, resp))
{
DBG("About to scale image %u", idata->id);
CSERVE2_REQ_IMAGE_LOAD,
0, NULL, 0, &_load_funcs, orig_entry);
}
- if (orig_entry->base.request || !orig_entry->shm)
+ if (orig_entry->base.request || !orig_entry->shm || !orig_data->valid)
return -1; // Not loaded yet
if (ientry->shm)
}
void
-cserve2_rgba_image_scale_do(void *src_data, void *dst_data,
+cserve2_rgba_image_scale_do(void *src_data, int src_full_w, int src_full_h,
+ void *dst_data,
int src_x, int src_y, int src_w, int src_h,
int dst_x, int dst_y, int dst_w, int dst_h,
int alpha, int smooth)
RGBA_Image src, dst;
RGBA_Draw_Context ct;
- _cserve2_rgba_image_set(&src, src_data, src_w, src_h, alpha);
-
+ _cserve2_rgba_image_set(&src, src_data, src_full_w, src_full_h, alpha);
_cserve2_rgba_image_set(&dst, dst_data, dst_w, dst_h, alpha);
dst.flags = RGBA_IMAGE_NOTHING;
}
static Image_Entry *
-_scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w, int src_h, int dst_w, int dst_h, int smooth)
+_scaled_image_find(Image_Entry *im, int src_x, int src_y, int src_w,
+ int src_h, int dst_w, int dst_h, int smooth)
{
size_t pathlen, keylen, size;
char *hkey;
(o->cur->border.b == 0) &&
(o->cur->border.fill != 0))
{
-#ifdef EVAS_CSERVE2
- if (evas_cserve2_use_get())
- {
- Image_Entry *ie;
- void *data = pixels;
- int w = imagew, h = imageh;
- Eina_Bool mustclose = EINA_FALSE;
-
- ie = evas_cache2_image_scale_load
- ((Image_Entry *)pixels,
- 0, 0,
- imagew, imageh,
- iw, ih, o->cur->smooth_scale);
- if (ie != &((RGBA_Image *)pixels)->cache_entry)
- {
- data = ie;
- w = iw;
- h = ih;
- mustclose = EINA_TRUE;
- }
-
- _draw_image
- (obj, output, context, surface, data,
- 0, 0,
- w, h,
- obj->cur->geometry.x + ix + x,
- obj->cur->geometry.y + iy + y,
- iw, ih,
- o->cur->smooth_scale,
- do_async);
-
- if (mustclose)
- evas_cache2_image_close(ie);
- }
- else
-#endif
- {
- _draw_image
- (obj, output, context, surface, pixels,
- 0, 0,
- imagew, imageh,
- obj->cur->geometry.x + ix + x,
- obj->cur->geometry.y + iy + y,
- iw, ih,
- o->cur->smooth_scale,
- do_async);
- }
+ _draw_image
+ (obj, output, context, surface, pixels,
+ 0, 0,
+ imagew, imageh,
+ obj->cur->geometry.x + ix + x,
+ obj->cur->geometry.y + iy + y,
+ iw, ih,
+ o->cur->smooth_scale,
+ do_async);
}
else
{
}
}
}
+
+#ifdef EVAS_CSERVE2
+ if (sci->populate_me && (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
+ && evas_cserve2_use_get() && evas_cache2_image_cached(&im->cache_entry))
+ {
+ RGBA_Image *im2 = (RGBA_Image *) evas_cache2_image_scale_load
+ (&im->cache_entry, src_region_x, src_region_y,
+ src_region_w, src_region_h, dst_region_w, dst_region_h, smooth);
+ SLKL(cache_lock);
+ if (im2 != im)
+ {
+ sci->im = im2;
+ sci->populate_me = 0;
+ cache_list = eina_inlist_append(cache_list, (Eina_Inlist *)sci);
+ didpop = 1;
+ }
+ SLKU(cache_lock);
+ }
+#endif
+
if (sci->populate_me)
{
// INF("##! populate!");
int mmap_size;
int image_size;
} shm;
+ struct {
+ unsigned int w, h; // Real dimensions of this image. May differ from Msg_Opened::image::{w,h} after scaling.
+ } image;
Eina_Bool alpha_sparse : 1;
};
uint32_t file_id;
string_t shm_id;
Evas_Image_Load_Opts opts;
+ uint32_t w, h;
Eina_Bool alpha_sparse : 1;
Eina_Bool unused : 1;
Eina_Bool doload : 1;
#endif
else
{
-#if 0
-#ifdef EVAS_CSERVE2
- if (evas_cserve2_use_get())
- {
- evas_cache2_image_load_data(&im->cache_entry);
- goto image_loaded;
- }
-#endif
- if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
- evas_cache_image_load_data(&im->cache_entry);
- evas_common_image_colorspace_normalize(im);
-
-image_loaded:
-#endif
-#ifdef EVAS_CSERVE2
- if (evas_cserve2_use_get())
- {
- if (im->cache_entry.space == EVAS_COLORSPACE_ARGB8888)
- evas_cache2_image_load_data(&im->cache_entry);
-
- if (!im->cache_entry.flags.loaded) return EINA_FALSE;
- evas_common_image_colorspace_normalize(im);
-
- if (smooth)
- evas_common_scale_rgba_in_to_out_clip_smooth
- (im, surface, context,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h);
- else
- evas_common_scale_rgba_in_to_out_clip_sample
- (im, surface, context,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h);
- }
- else
-#endif
- {
- evas_common_rgba_image_scalecache_prepare
- (&im->cache_entry, surface, context, smooth,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h);
- evas_common_rgba_image_scalecache_do
- (&im->cache_entry, surface, context, smooth,
- src_x, src_y, src_w, src_h,
- dst_x, dst_y, dst_w, dst_h);
- }
+ evas_common_rgba_image_scalecache_prepare
+ (&im->cache_entry, surface, context, smooth,
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h);
+ evas_common_rgba_image_scalecache_do
+ (&im->cache_entry, surface, context, smooth,
+ src_x, src_y, src_w, src_h,
+ dst_x, dst_y, dst_w, dst_h);
evas_common_cpu_end_opt();
}