summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-09-30 18:46:49 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:15 +0900
commit74080fba226410257084df7cde9cb02f96ed37b6 (patch)
tree941ca411d9a22cdcf5dbbb37fbc9c7e9b2dbf61c /src/bin
parent9bb52372bd1a8c72e8e47cc37b499769c959318a (diff)
evas/cserve2: Fix scaling error (server side)
This causes crashes in the client also...
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/evas/evas_cserve2_cache.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/bin/evas/evas_cserve2_cache.c b/src/bin/evas/evas_cserve2_cache.c
index 87ea2d237b..2a358f7ef9 100644
--- a/src/bin/evas/evas_cserve2_cache.c
+++ b/src/bin/evas/evas_cserve2_cache.c
@@ -2669,7 +2669,8 @@ cserve2_cache_file_close(Client *client, unsigned int client_file_id)
2669} 2669}
2670 2670
2671static int 2671static int
2672_cserve2_cache_fast_scaling_check(Client *client, Image_Entry *ientry) 2672_cserve2_cache_fast_scaling_check(Client *client, Image_Entry *ientry,
2673 int client_file_id)
2673{ 2674{
2674 Eina_Iterator *iter; 2675 Eina_Iterator *iter;
2675 Image_Entry *i; 2676 Image_Entry *i;
@@ -2694,13 +2695,13 @@ _cserve2_cache_fast_scaling_check(Client *client, Image_Entry *ientry)
2694 // Copy opts w/o scaling 2695 // Copy opts w/o scaling
2695 memset(&unscaled, 0, sizeof(unscaled)); 2696 memset(&unscaled, 0, sizeof(unscaled));
2696 unscaled.dpi = idata->opts.dpi; 2697 unscaled.dpi = idata->opts.dpi;
2697 //unscaled.w = idata->opts.w; 2698 unscaled.w = idata->opts.w;
2698 //unscaled.h = idata->opts.h; 2699 unscaled.h = idata->opts.h;
2699 //unscaled.scale_down_by = idata->opts.scale_down_by; 2700 unscaled.scale_down_by = idata->opts.scale_down_by;
2700 //unscaled.region.x = idata->opts.region.x; 2701 unscaled.region.x = idata->opts.region.x;
2701 //unscaled.region.y = idata->opts.region.y; 2702 unscaled.region.y = idata->opts.region.y;
2702 //unscaled.region.w = idata->opts.region.w; 2703 unscaled.region.w = idata->opts.region.w;
2703 //unscaled.region.h = idata->opts.region.h; 2704 unscaled.region.h = idata->opts.region.h;
2704 unscaled.scale_load.scale_hint = 0; 2705 unscaled.scale_load.scale_hint = 0;
2705 unscaled.degree = idata->opts.degree; 2706 unscaled.degree = idata->opts.degree;
2706 unscaled.orientation = idata->opts.orientation; 2707 unscaled.orientation = idata->opts.orientation;
@@ -2762,18 +2763,20 @@ try_again:
2762 scaled_count, ENTRYID(ientry)); 2763 scaled_count, ENTRYID(ientry));
2763 2764
2764 // FIXME: The value 4 is completely arbitrary. No benchmarks done yet. 2765 // FIXME: The value 4 is completely arbitrary. No benchmarks done yet.
2765 if (scaled_count >= 4) 2766 if (scaled_count >= 4 && (unused_mem_usage < max_unused_mem_usage))
2766 { 2767 {
2767 DBG("Forcing load of original image now!"); 2768 DBG("Forcing load of original image now!");
2768 2769
2769 orig_entry = _image_entry_new(client, 0, idata->file_id, 2770 orig_entry = _image_entry_new(client, 0, client_file_id,
2770 0, &unscaled, buf, sizeof(buf)); 2771 0, &unscaled, buf, sizeof(buf));
2771 if (!orig_entry) return -1; 2772 if (!orig_entry) return -1;
2772 _entry_unused_push(orig_entry);
2773 2773
2774 orig_data = _image_data_find(ENTRYID(orig_entry)); 2774 orig_data = _image_data_find(ENTRYID(orig_entry));
2775 orig_data->unused = EINA_TRUE;
2775 fentry = _file_entry_find(orig_data->file_id); 2776 fentry = _file_entry_find(orig_data->file_id);
2776 fentry->images = eina_list_append(fentry->images, orig_entry); 2777 fentry->images = eina_list_append(fentry->images, orig_entry);
2778 // TODO: Check validity of this call. Leak VS immediate delete?
2779 //_entry_unused_push(orig_entry);
2777 } 2780 }
2778 else 2781 else
2779 return -1; 2782 return -1;
@@ -2885,7 +2888,7 @@ cserve2_cache_image_entry_create(Client *client, int rid,
2885 2888
2886 if (opts && opts->scale_load.dst_w && opts->scale_load.dst_h) 2889 if (opts && opts->scale_load.dst_w && opts->scale_load.dst_h)
2887 { 2890 {
2888 if (!_cserve2_cache_fast_scaling_check(client, ientry)) 2891 if (!_cserve2_cache_fast_scaling_check(client, ientry, client_file_id))
2889 return 0; 2892 return 0;
2890 } 2893 }
2891 2894