summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCedric BAIL <cedric@osg.samsung.com>2016-09-19 16:07:03 -0700
committerCedric BAIL <cedric@osg.samsung.com>2016-09-19 16:07:03 -0700
commit0d0ca579c6697aef93e84c4b8e6993120e18614a (patch)
treef7c3425b4be1c4f83970d0de307a7f8028f87a01
parent25aef34aa044503024b6b608feb87d4d4e02ff3b (diff)
downloadefl-0d0ca579c6697aef93e84c4b8e6993120e18614a.tar.gz
elementary: be more conservative on the amount of data requested from disk.
-rw-r--r--src/lib/elementary/efl_ui_image.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/lib/elementary/efl_ui_image.c b/src/lib/elementary/efl_ui_image.c
index 3a28ee4fa9..d4370b6045 100644
--- a/src/lib/elementary/efl_ui_image.c
+++ b/src/lib/elementary/efl_ui_image.c
@@ -249,7 +249,6 @@ _efl_ui_image_async_open_do(void *data, Ecore_Thread *thread)
Async_Open_Data *todo = data;
Eina_File *f;
void *map = NULL;
- unsigned char *p, sum = 0;
size_t i, size;
if (ecore_thread_check(thread)) return;
@@ -273,17 +272,13 @@ _efl_ui_image_async_open_do(void *data, Ecore_Thread *thread)
}
// Read just enough data for map to actually do something.
- p = map = eina_file_map_all(f, EINA_FILE_SEQUENTIAL);
size = eina_file_size_get(f);
// Read and ensure all pages are in memory for sure first just
// 1 byte per page will do. also keep a limit on how much we will
- // blindly load in here to let's say 512M
- if (size > (512 * 1024 * 1024)) size = 512 * 1024 * 1024;
- for (i = 0; i < size; i += 4096)
- {
- if (ecore_thread_check(thread)) break;
- sum += p[i];
- }
+ // blindly load in here to let's say 32KB (Should be enough to get
+ // image headers without getting to much data from the hard drive).
+ size = size > 32 * 1024 ? 32 * 1024 : size;
+ map = eina_file_map_new(f, EINA_FILE_POPULATE, 0, size);
if (ecore_thread_check(thread))
{