summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <quaker66@gmail.com>2014-01-29 11:48:50 +0000
committerDaniel Kolesa <quaker66@gmail.com>2014-01-29 11:48:50 +0000
commit384380a6f10f1a7fafef3e0b3c43de57a365da5a (patch)
tree19f088bf572a3f6bc65b90188befe3fe2989c450
parent1e417a58cb018bb7ce471ad04156242d29d631ef (diff)
luaxpedite cleanups, fixes and optimizations
-rw-r--r--tests/image_blend_many_smooth_same_scaled.lua24
-rw-r--r--tests/image_blend_occlude.lua41
-rw-r--r--tests/image_blend_scaled.lua48
-rw-r--r--tests/image_blend_unscaled.lua26
-rw-r--r--tests/image_crossfade.lua11
-rw-r--r--tests/image_data_argb.lua4
-rw-r--r--tests/image_data_ycbcr601pl.lua4
-rw-r--r--tests/image_data_ycbcr601pl_map_solid_rotate.lua4
-rw-r--r--tests/image_data_ycbcr601pl_wide_stride.lua4
-rw-r--r--tests/image_map_3d_1.lua10
-rw-r--r--tests/image_map_3d_2.lua4
-rw-r--r--tests/image_map_3d_flow.lua21
-rw-r--r--tests/image_map_rotate.lua53
-rw-r--r--tests/image_quality_scale.lua12
-rw-r--r--tests/line_blend.lua17
-rw-r--r--tests/poly_blend.lua21
-rw-r--r--tests/proxy_image.lua23
-rw-r--r--tests/proxy_text_fixed.lua21
-rw-r--r--tests/proxy_text_random.lua24
-rw-r--r--tests/rect.lua38
-rw-r--r--tests/text.lua21
-rw-r--r--tests/text_change.lua21
-rw-r--r--tests/textblock_auto_align.lua8
-rw-r--r--tests/textblock_basic.lua14
-rw-r--r--tests/textblock_intl.lua10
-rw-r--r--tests/textblock_text_append.lua6
-rw-r--r--tests/widgets_file_icons.lua41
-rw-r--r--tests/widgets_list.lua60
-rw-r--r--ui.lua12
-rw-r--r--util.lua21
30 files changed, 264 insertions, 360 deletions
diff --git a/tests/image_blend_many_smooth_same_scaled.lua b/tests/image_blend_many_smooth_same_scaled.lua
index 56bfa38..0b06d59 100644
--- a/tests/image_blend_many_smooth_same_scaled.lua
+++ b/tests/image_blend_many_smooth_same_scaled.lua
@@ -6,32 +6,26 @@ local evaslib = util.get_lib("evas")
6local sin, cos = math.sin, math.cos 6local sin, cos = math.sin, math.cos
7 7
8return function(queue, ui, variant) 8return function(queue, ui, variant)
9 local OBNUM = 8192 9 local itern = 8192
10 local SLOW = 5.0 10 local slow = 5.0
11 local o_images = {} 11 local o_images = {}
12 local name = "Image Blend Many Smooth Down Scaled" 12 local name = "Image Blend Many Smooth Down Scaled"
13 -- populate the arrays to initialize the memory
14 for i = 1, OBNUM do o_images[i] = false end
15 local fps_std = ui.fps_std
16 queue[#queue + 1] = { "blend.png", name, function() 13 queue[#queue + 1] = { "blend.png", name, function()
17 local win_w, win_h = ui.win_w, ui.win_h 14 local win_w, win_h = ui.win_w, ui.win_h
18 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 15 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
19 ui.func_set(function() 16 ui.func_set(util.del_objs(o_images), function(t, f)
20 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 17 for i = 1, itern do
21 end, function(t, f)
22 for i = 1, OBNUM do
23 local o = o_images[i] 18 local o = o_images[i]
24 evaslib.evas_object_geometry_get(o, nil, nil, w, h) 19 evaslib.evas_object_geometry_get(o, nil, nil, w, h)
25 local x = (win_w / 2) - (w[0] / 2) 20 local x = (win_w / 2) - (w[0] / 2)
26 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (win_w / 2) 21 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (win_w / 2)
27 local y = (win_h / 2) - (h[0] / 2) 22 local y = (win_h / 2) - (h[0] / 2)
28 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (win_h / 2) 23 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (win_h / 2)
29 evaslib.evas_object_move(o, x, y) 24 evaslib.evas_object_move(o, x, y)
30 end 25 end
31 fps_std(name, t, f) 26 end, name)
32 end)
33 local evas = ui.evas 27 local evas = ui.evas
34 for i = 1, OBNUM do 28 for i = 1, itern do
35 local o = evaslib.evas_object_image_add(evas) 29 local o = evaslib.evas_object_image_add(evas)
36 o_images[i] = o 30 o_images[i] = o
37 local n = util.random() % 100 31 local n = util.random() % 100
diff --git a/tests/image_blend_occlude.lua b/tests/image_blend_occlude.lua
index 04ed5d6..b13d613 100644
--- a/tests/image_blend_occlude.lua
+++ b/tests/image_blend_occlude.lua
@@ -34,41 +34,40 @@ local getcond = function(n)
34 return conds[n] 34 return conds[n]
35end 35end
36 36
37local getitern = function(n)
38 if n > 9 then return 1600 end
39 if n > 6 then return 320 end
40 if n > 3 then return 128 end
41 return 32
42end
43
37return function(queue, ui, variant) 44return function(queue, ui, variant)
38 local OBNUM = (variant > 9) and 1600 or ((variant > 6) and 320 45 local itern = getitern(variant)
39 or ((variant > 3) and 128 or 32)) 46 local slow = 5.0
40 local SLOW = 5.0
41 local o_images = {} 47 local o_images = {}
42 local name = variants[variant] 48 local name = variants[variant]
43 local cond = getcond(variant) 49 local cond = getcond(variant)
44 -- populate the arrays to initialize the memory
45 for i = 1, OBNUM do o_images[i] = false end
46 local fps_std = ui.fps_std
47 queue[#queue + 1] = { "blend.png", name, function() 50 queue[#queue + 1] = { "blend.png", name, function()
48 local win_w, win_h = ui.win_w, ui.win_h 51 local win_w, win_h = ui.win_w, ui.win_h
49 ui.func_set(function() 52 ui.func_set(util.del_objs(o_images), function(t, f)
50 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 53 for i = 1, itern do
51 end, function(t, f) 54 if cond(i, itern) then
52 for i = 1, OBNUM do
53 if cond(i, OBNUM) then
54 local w = 120 55 local w = 120
55 local h = 160 56 local h = 160
56 local x = (win_w / 2) - (w / 2) 57 local x = (win_w / 2) - (w / 2)
57 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (w / 2) 58 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (w / 2)
58 local y = (win_h / 2) - (h / 2) 59 local y = (win_h / 2) - (h / 2)
59 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (h / 2) 60 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (h / 2)
60 local o = o_images[i] 61 evaslib.evas_object_move(o_images[i], x, y)
61 evaslib.evas_object_move(o, x, y)
62 end 62 end
63 end 63 end
64 fps_std(name, t, f) 64 end, name)
65 end)
66 local evas = ui.evas 65 local evas = ui.evas
67 util.randomseed() 66 util.randomseed()
68 for i = 1, OBNUM do 67 for i = 1, itern do
69 local o = evaslib.evas_object_image_add(evas) 68 local o = evaslib.evas_object_image_add(evas)
70 o_images[i] = o 69 o_images[i] = o
71 if cond(i, OBNUM) then 70 if cond(i, itern) then
72 evaslib.evas_object_image_file_set(o, 71 evaslib.evas_object_image_file_set(o,
73 util.build_path("logo.png"), nil) 72 util.build_path("logo.png"), nil)
74 else 73 else
diff --git a/tests/image_blend_scaled.lua b/tests/image_blend_scaled.lua
index 0519682..7e01d2f 100644
--- a/tests/image_blend_scaled.lua
+++ b/tests/image_blend_scaled.lua
@@ -29,44 +29,40 @@ local smooth_scale = {
29} 29}
30 30
31return function(queue, ui, variant) 31return function(queue, ui, variant)
32 local OBNUM = 128 32 local itern = 128
33 local SLOW = 5.0 33 local slow = 5.0
34 local o_images = {} 34 local o_images = {}
35 local name = variants[variant] 35 local name = variants[variant]
36 -- populate the arrays to initialize the memory
37 for i = 1, OBNUM do o_images[i] = false end
38 local fps_std = ui.fps_std
39 queue[#queue + 1] = { "blend.png", name, function() 36 queue[#queue + 1] = { "blend.png", name, function()
40 local win_w, win_h = ui.win_w, ui.win_h 37 local win_w, win_h = ui.win_w, ui.win_h
41 ui.func_set(function() 38 local get_wh = (variant > 4 and variant <= 8)
42 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 39 and function(w0, h0, i, f)
43 end, function(t, f) 40 return 40 + (((i - 1) % 3) * (w0 / 2)),
44 for i = 1, OBNUM do 41 40 + (((i - 1) % 3) * (h0 / 2))
45 local w0, h0 = 80, 80 42 end
46 local w, h 43 or function(w0, h0, i, f)
47 if variant > 4 and variant <= 8 then 44 return 5 + ((1 + cos((f + ((i - 1) * 10)) /
48 w = 40 + (((i - 1) % 3) * (w0 / 2)) 45 (7.4 * slow))) * w0 * 2),
49 h = 40 + (((i - 1) % 3) * (h0 / 2)) 46 5 + ((1 + sin((f + ((i - 1) * 19)) /
50 else 47 (12.6 * slow))) * h0 * 2)
51 w = 5 + ((1 + cos((f + ((i - 1) * 10)) / 48 end
52 (7.4 * SLOW))) * w0 * 2) 49 ui.func_set(util.del_objs(o_images), function(t, f)
53 h = 5 + ((1 + sin((f + ((i - 1) * 19)) / 50 local w0, h0 = 80, 80
54 (12.6 * SLOW))) * h0 * 2) 51 for i = 1, itern do
55 end 52 local w, h = get_wh(w0, h0, i, f)
56 local x = (win_w / 2) - (w / 2) 53 local x = (win_w / 2) - (w / 2)
57 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (w0 / 2) 54 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (w0 / 2)
58 local y = (win_h / 2) - (h / 2) 55 local y = (win_h / 2) - (h / 2)
59 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (h0 / 2) 56 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (h0 / 2)
60 local o = o_images[i] 57 local o = o_images[i]
61 evaslib.evas_object_move(o, x, y) 58 evaslib.evas_object_move(o, x, y)
62 evaslib.evas_object_resize(o, w, h) 59 evaslib.evas_object_resize(o, w, h)
63 evaslib.evas_object_image_fill_set(o, 0, 0, w, h) 60 evaslib.evas_object_image_fill_set(o, 0, 0, w, h)
64 end 61 end
65 fps_std(name, t, f) 62 end, name)
66 end)
67 local evas = ui.evas 63 local evas = ui.evas
68 local imgpath = util.build_path(images[variant]) 64 local imgpath = util.build_path(images[variant])
69 for i = 1, OBNUM do 65 for i = 1, itern do
70 local o = evaslib.evas_object_image_add(evas) 66 local o = evaslib.evas_object_image_add(evas)
71 o_images[i] = o 67 o_images[i] = o
72 evaslib.evas_object_image_file_set(o, imgpath, nil) 68 evaslib.evas_object_image_file_set(o, imgpath, nil)
diff --git a/tests/image_blend_unscaled.lua b/tests/image_blend_unscaled.lua
index 79c117d..9c7bc1d 100644
--- a/tests/image_blend_unscaled.lua
+++ b/tests/image_blend_unscaled.lua
@@ -19,32 +19,26 @@ local sin, cos = math.sin, math.cos
19local lsh = bit.lshift 19local lsh = bit.lshift
20 20
21return function(queue, ui, variant) 21return function(queue, ui, variant)
22 local OBNUM = 128 22 local itern = 128
23 local SLOW = 5.0 23 local slow = 5.0
24 local o_images = {} 24 local o_images = {}
25 local name = variants[variant] 25 local name = variants[variant]
26 -- populate the arrays to initialize the memory
27 for i = 1, OBNUM do o_images[i] = false end
28 local fps_std = ui.fps_std
29 queue[#queue + 1] = { "blend.png", name, function() 26 queue[#queue + 1] = { "blend.png", name, function()
30 local win_w, win_h = ui.win_w, ui.win_h 27 local win_w, win_h = ui.win_w, ui.win_h
31 ui.func_set(function() 28 ui.func_set(util.del_objs(o_images), function(t, f)
32 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 29 local w, h = 120, 160
33 end, function(t, f) 30 for i = 1, itern do
34 for i = 1, OBNUM do
35 local w, h = 120, 160
36 local x = (win_w / 2) - (w / 2) 31 local x = (win_w / 2) - (w / 2)
37 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (w / 2) 32 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (w / 2)
38 local y = (win_h / 2) - (h / 2) 33 local y = (win_h / 2) - (h / 2)
39 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (h / 2) 34 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (h / 2)
40 evaslib.evas_object_move(o_images[i], x, y) 35 evaslib.evas_object_move(o_images[i], x, y)
41 end 36 end
42 fps_std(name, t, f) 37 end, name)
43 end)
44 local evas = ui.evas 38 local evas = ui.evas
45 local imgpath = util.build_path((variant >= 5) and "image.png" 39 local imgpath = util.build_path((variant >= 5) and "image.png"
46 or "logo.png") 40 or "logo.png")
47 for i = 1, OBNUM do 41 for i = 1, itern do
48 local o = evaslib.evas_object_image_add(evas) 42 local o = evaslib.evas_object_image_add(evas)
49 o_images[i] = o 43 o_images[i] = o
50 evaslib.evas_object_image_file_set(o, imgpath, nil) 44 evaslib.evas_object_image_file_set(o, imgpath, nil)
diff --git a/tests/image_crossfade.lua b/tests/image_crossfade.lua
index 9f716f6..5e75a29 100644
--- a/tests/image_crossfade.lua
+++ b/tests/image_crossfade.lua
@@ -5,19 +5,14 @@ local evaslib = util.get_lib("evas")
5local band, bor, lsh, rsh = bit.band, bit.bor, bit.lshift, bit.rshift 5local band, bor, lsh, rsh = bit.band, bit.bor, bit.lshift, bit.rshift
6 6
7return function(queue, ui) 7return function(queue, ui)
8 local images = { false, false } 8 local images = {}
9 local fps_std = ui.fps_std
10 queue[#queue + 1] = { "blend.png", "Image Crossfade", function() 9 queue[#queue + 1] = { "blend.png", "Image Crossfade", function()
11 local win_w, win_h = ui.win_w, ui.win_h 10 local win_w, win_h = ui.win_w, ui.win_h
12 ui.func_set(function() 11 ui.func_set(util.del_objs(images), function(t, f)
13 evaslib.evas_object_del(images[1])
14 evaslib.evas_object_del(images[2])
15 end, function(t, f)
16 local a = band(f, 0x1F) 12 local a = band(f, 0x1F)
17 a = band(bor(lsh(a, 3), rsh(a, 2)), 0xFF) 13 a = band(bor(lsh(a, 3), rsh(a, 2)), 0xFF)
18 evaslib.evas_object_color_set(images[2], a, a, a, a) 14 evaslib.evas_object_color_set(images[2], a, a, a, a)
19 fps_std("Image Crossfade", t, f) 15 end, "Image Crossfade")
20 end)
21 local evas = ui.evas 16 local evas = ui.evas
22 local o = evaslib.evas_object_image_add(evas) 17 local o = evaslib.evas_object_image_add(evas)
23 images[1] = o 18 images[1] = o
diff --git a/tests/image_data_argb.lua b/tests/image_data_argb.lua
index bd17c61..a554911 100644
--- a/tests/image_data_argb.lua
+++ b/tests/image_data_argb.lua
@@ -12,7 +12,6 @@ local names = {
12 12
13return function(queue, ui, variant) 13return function(queue, ui, variant)
14 local image 14 local image
15 local fps_std = ui.fps_std
16 queue[#queue + 1] = { "data.png", names[variant], function() 15 queue[#queue + 1] = { "data.png", names[variant], function()
17 local win_w, win_h = ui.win_w, ui.win_h 16 local win_w, win_h = ui.win_w, ui.win_h
18 ui.func_set(function() 17 ui.func_set(function()
@@ -58,8 +57,7 @@ return function(queue, ui, variant)
58 end 57 end
59 evaslib.evas_object_image_data_set(image, data) 58 evaslib.evas_object_image_data_set(image, data)
60 evaslib.evas_object_image_data_update_add(image, 0, 0, w, h) 59 evaslib.evas_object_image_data_update_add(image, 0, 0, w, h)
61 fps_std(names[variant], t, f) 60 end, names[variant])
62 end)
63 local evas = ui.evas 61 local evas = ui.evas
64 image = evaslib.evas_object_image_add(evas) 62 image = evaslib.evas_object_image_add(evas)
65 evaslib.evas_object_image_content_hint_set(image, 63 evaslib.evas_object_image_content_hint_set(image,
diff --git a/tests/image_data_ycbcr601pl.lua b/tests/image_data_ycbcr601pl.lua
index eaf5868..9a10cf2 100644
--- a/tests/image_data_ycbcr601pl.lua
+++ b/tests/image_data_ycbcr601pl.lua
@@ -18,7 +18,6 @@ return function(queue, ui)
18 local image 18 local image
19 local name = "Image Data YCbCr 601 Pointer List" 19 local name = "Image Data YCbCr 601 Pointer List"
20 local yp, up, vp 20 local yp, up, vp
21 local fps_std = ui.fps_std
22 queue[#queue + 1] = { "data.png", name, function() 21 queue[#queue + 1] = { "data.png", name, function()
23 local win_w, win_h = ui.win_w, ui.win_h 22 local win_w, win_h = ui.win_w, ui.win_h
24 ui.func_set(function() 23 ui.func_set(function()
@@ -35,8 +34,7 @@ return function(queue, ui)
35 evaslib.evas_object_resize(image, w, h) 34 evaslib.evas_object_resize(image, w, h)
36 evaslib.evas_object_image_fill_set(image, 0, 0, w, h) 35 evaslib.evas_object_image_fill_set(image, 0, 0, w, h)
37 evaslib.evas_object_image_data_update_add(image, 0, 0, 640, 480) 36 evaslib.evas_object_image_data_update_add(image, 0, 0, 640, 480)
38 fps_std(name, t, f) 37 end, name)
39 end)
40 local evas = ui.evas 38 local evas = ui.evas
41 image = evaslib.evas_object_image_add(evas) 39 image = evaslib.evas_object_image_add(evas)
42 evaslib.evas_object_image_content_hint_set(image, 40 evaslib.evas_object_image_content_hint_set(image,
diff --git a/tests/image_data_ycbcr601pl_map_solid_rotate.lua b/tests/image_data_ycbcr601pl_map_solid_rotate.lua
index 5c009e2..00ea894 100644
--- a/tests/image_data_ycbcr601pl_map_solid_rotate.lua
+++ b/tests/image_data_ycbcr601pl_map_solid_rotate.lua
@@ -22,7 +22,6 @@ local names = {
22return function(queue, ui, variant) 22return function(queue, ui, variant)
23 local image 23 local image
24 local yp, up, vp 24 local yp, up, vp
25 local fps_std = ui.fps_std
26 queue[#queue + 1] = { "data.png", names[variant], function() 25 queue[#queue + 1] = { "data.png", names[variant], function()
27 local win_w, win_h = ui.win_w, ui.win_h 26 local win_w, win_h = ui.win_w, ui.win_h
28 local m 27 local m
@@ -43,8 +42,7 @@ return function(queue, ui, variant)
43 evaslib.evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2)) 42 evaslib.evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2))
44 evaslib.evas_object_map_enable_set(image, 1) 43 evaslib.evas_object_map_enable_set(image, 1)
45 evaslib.evas_object_map_set(image, m) 44 evaslib.evas_object_map_set(image, m)
46 fps_std(names[variant], t, f) 45 end, names[variant])
47 end)
48 local evas = ui.evas 46 local evas = ui.evas
49 image = evaslib.evas_object_image_add(evas) 47 image = evaslib.evas_object_image_add(evas)
50 evaslib.evas_object_image_content_hint_set(image, 48 evaslib.evas_object_image_content_hint_set(image,
diff --git a/tests/image_data_ycbcr601pl_wide_stride.lua b/tests/image_data_ycbcr601pl_wide_stride.lua
index 9c359bb..ac2a760 100644
--- a/tests/image_data_ycbcr601pl_wide_stride.lua
+++ b/tests/image_data_ycbcr601pl_wide_stride.lua
@@ -20,7 +20,6 @@ return function(queue, ui)
20 local image 20 local image
21 local name = "Image Data YCbCr 601 Pointer List Wide Stride" 21 local name = "Image Data YCbCr 601 Pointer List Wide Stride"
22 local yp, up, vp 22 local yp, up, vp
23 local fps_std = ui.fps_std
24 queue[#queue + 1] = { "data.png", name, function() 23 queue[#queue + 1] = { "data.png", name, function()
25 local win_w, win_h = ui.win_w, ui.win_h 24 local win_w, win_h = ui.win_w, ui.win_h
26 ui.func_set(function() 25 ui.func_set(function()
@@ -62,8 +61,7 @@ return function(queue, ui)
62 evaslib.evas_object_image_data_set(image, data) 61 evaslib.evas_object_image_data_set(image, data)
63 evaslib.evas_object_image_data_update_add(image, 0, 0, w, 480) 62 evaslib.evas_object_image_data_update_add(image, 0, 0, w, 480)
64 end 63 end
65 fps_std(name, t, f) 64 end, name)
66 end)
67 local evas = ui.evas 65 local evas = ui.evas
68 image = evaslib.evas_object_image_add(evas) 66 image = evaslib.evas_object_image_add(evas)
69 evaslib.evas_object_image_content_hint_set(image, 67 evaslib.evas_object_image_content_hint_set(image,
diff --git a/tests/image_map_3d_1.lua b/tests/image_map_3d_1.lua
index f7694ac..a6dae9f 100644
--- a/tests/image_map_3d_1.lua
+++ b/tests/image_map_3d_1.lua
@@ -126,10 +126,9 @@ local smooth = {
126} 126}
127 127
128return function(queue, ui, variant) 128return function(queue, ui, variant)
129 local cubes = { false, false, false, false, false } 129 local cubes = {}
130 local sm = smooth[variant] 130 local sm = smooth[variant]
131 local nocw = (variant >= 3) 131 local nocw = (variant >= 3)
132 local fps_std = ui.fps_std
133 queue[#queue + 1] = { "3d.png", variants[variant], function() 132 queue[#queue + 1] = { "3d.png", variants[variant], function()
134 win_w, win_h = ui.win_w, ui.win_h 133 win_w, win_h = ui.win_w, ui.win_h
135 local m 134 local m
@@ -150,8 +149,7 @@ return function(queue, ui, variant)
150 f, f / 5, f / 2, sm, nocw) 149 f, f / 5, f / 2, sm, nocw)
151 cube_pos(cubes[5], (win_w / 2), (win_h / 2), 0, 150 cube_pos(cubes[5], (win_w / 2), (win_h / 2), 0,
152 f / 4, f / 3, f / 5, sm, nocw) 151 f / 4, f / 3, f / 5, sm, nocw)
153 fps_std(variants[variant], t, f) 152 end, variants[variant])
154 end)
155 local evas = ui.evas 153 local evas = ui.evas
156 cubes[1] = cube_new(evas, 128, 128, 256, sm) 154 cubes[1] = cube_new(evas, 128, 128, 256, sm)
157 cubes[2] = cube_new(evas, 256, 128, 128, sm) 155 cubes[2] = cube_new(evas, 256, 128, 128, sm)
diff --git a/tests/image_map_3d_2.lua b/tests/image_map_3d_2.lua
index 579f902..d9a7aa8 100644
--- a/tests/image_map_3d_2.lua
+++ b/tests/image_map_3d_2.lua
@@ -123,7 +123,6 @@ local variants = {
123 123
124return function(queue, ui, variant) 124return function(queue, ui, variant)
125 local cube 125 local cube
126 local fps_std = ui.fps_std
127 queue[#queue + 1] = { "3d.png", variants[variant], function() 126 queue[#queue + 1] = { "3d.png", variants[variant], function()
128 win_w, win_h = ui.win_w, ui.win_h 127 win_w, win_h = ui.win_w, ui.win_h
129 local m 128 local m
@@ -131,8 +130,7 @@ return function(queue, ui, variant)
131 cube_free(cube) 130 cube_free(cube)
132 end, function(t, f) 131 end, function(t, f)
133 cube_pos(cube, (win_w / 2), (win_h / 2), 0, 0, f, 0, variant == 1) 132 cube_pos(cube, (win_w / 2), (win_h / 2), 0, 0, f, 0, variant == 1)
134 fps_std(variants[variant], t, f) 133 end, variants[variant])
135 end)
136 cube = cube_new(ui.evas, 720, 420, 720) 134 cube = cube_new(ui.evas, 720, 420, 720)
137 end } 135 end }
138end 136end
diff --git a/tests/image_map_3d_flow.lua b/tests/image_map_3d_flow.lua
index b0a51e2..f0c5bb7 100644
--- a/tests/image_map_3d_flow.lua
+++ b/tests/image_map_3d_flow.lua
@@ -3,27 +3,19 @@ local util = require("util")
3local evaslib = util.get_lib("evas") 3local evaslib = util.get_lib("evas")
4 4
5return function(queue, ui, variant) 5return function(queue, ui, variant)
6 local CNUM = 48 6 local itern = 48
7 local o_images, o_reflec = {}, {} 7 local o_images, o_reflec = {}, {}
8 local m
9 for i = 1, CNUM do o_images[i], o_reflec[i] = false, false end
10 local fps_std = ui.fps_std
11 queue[#queue + 1] = { "3d.png", "Image Map 3D Flow", function() 8 queue[#queue + 1] = { "3d.png", "Image Map 3D Flow", function()
12 local win_w, win_h = ui.win_w, ui.win_h 9 local win_w, win_h = ui.win_w, ui.win_h
13 local m 10 local m
14 ui.func_set(function() 11 ui.func_set(util.del_objs(o_images, o_reflec), function(t, f)
15 for i = 1, CNUM do
16 evaslib.evas_object_del(o_images[i])
17 evaslib.evas_object_del(o_reflec[i])
18 end
19 end, function(t, f)
20 if not m then m = evaslib.evas_map_new(4) end 12 if not m then m = evaslib.evas_map_new(4) end
21 evaslib.evas_map_smooth_set(m, 0) 13 evaslib.evas_map_smooth_set(m, 0)
22 local center = 150 14 local center = 150
23 for i = 1, CNUM do 15 for i = 1, itern do
24 local x, y = win_w / 2, win_h / 2 16 local x, y = win_w / 2, win_h / 2
25 local w, h = 256, 256 17 local w, h = 256, 256
26 local c = (i - 1 - (CNUM / 2)) * (w / 4) 18 local c = (i - 1 - (itern / 2)) * (w / 4)
27 c = c + (f % (6 * (w / 4))) 19 c = c + (f % (6 * (w / 4)))
28 local ang = c / center 20 local ang = c / center
29 if ang > 0 then ang = ang * ang 21 if ang > 0 then ang = ang * ang
@@ -114,10 +106,9 @@ return function(queue, ui, variant)
114 evaslib.evas_object_map_enable_set(o_ref, 1) 106 evaslib.evas_object_map_enable_set(o_ref, 1)
115 evaslib.evas_object_map_set(o_ref, m) 107 evaslib.evas_object_map_set(o_ref, m)
116 end 108 end
117 fps_std("Image Map 3D Flow", t, f) 109 end, "Image Map 3D Flow")
118 end)
119 local evas = ui.evas 110 local evas = ui.evas
120 for i = 1, CNUM do 111 for i = 1, itern do
121 local o = evaslib.evas_object_image_add(evas) 112 local o = evaslib.evas_object_image_add(evas)
122 o_images[i] = o 113 o_images[i] = o
123 local path = util.build_path("cube" .. (((i - 1) % 6) + 1) 114 local path = util.build_path("cube" .. (((i - 1) % 6) + 1)
diff --git a/tests/image_map_rotate.lua b/tests/image_map_rotate.lua
index 2f099b8..41a6cb2 100644
--- a/tests/image_map_rotate.lua
+++ b/tests/image_map_rotate.lua
@@ -29,51 +29,50 @@ local smooth_scale = {
29} 29}
30 30
31return function(queue, ui, variant) 31return function(queue, ui, variant)
32 local OBNUM = 64 32 local itern = 64
33 local SLOW = 5.0 33 local slow = 5.0
34 local o_images = {} 34 local o_images = {}
35 local name = variants[variant] 35 local name = variants[variant]
36 -- populate the arrays to initialize the memory
37 for i = 1, OBNUM do o_images[i] = false end
38 local fps_std = ui.fps_std
39 queue[#queue + 1] = { "map.png", name, function() 36 queue[#queue + 1] = { "map.png", name, function()
40 local win_w, win_h = ui.win_w, ui.win_h 37 local win_w, win_h = ui.win_w, ui.win_h
41 local m 38 local m
42 ui.func_set(function() 39 local mapcolorf
43 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 40 if variant >= 9 then
44 end, function(t, f) 41 mapcolorf = function()
42 evaslib.evas_map_point_color_set(m, 0, 255, 255, 255, 255)
43 evaslib.evas_map_point_color_set(m, 1, 255, 0, 0, 255)
44 evaslib.evas_map_point_color_set(m, 2, 0, 0, 255, 255)
45 evaslib.evas_map_point_color_set(m, 3, 0, 0, 0, 0)
46 end
47 elseif variant >= 5 then
48 mapcolorf = function()
49 evaslib.evas_map_point_color_set(m, 0, 255, 255, 255, 255)
50 evaslib.evas_map_point_color_set(m, 1, 255, 0, 0, 255)
51 evaslib.evas_map_point_color_set(m, 2, 0, 0, 255, 255)
52 evaslib.evas_map_point_color_set(m, 3, 0, 255, 0, 255)
53 end
54 else mapcolorf = function() end end
55 ui.func_set(util.del_objs(o_images), function(t, f)
45 if not m then m = evaslib.evas_map_new(4) end 56 if not m then m = evaslib.evas_map_new(4) end
46 evaslib.evas_map_smooth_set(m, smooth_scale[variant]) 57 evaslib.evas_map_smooth_set(m, smooth_scale[variant])
47 for i = 1, OBNUM do 58 for i = 1, itern do
48 local w, h = 120, 160 59 local w, h = 120, 160
49 local x = (win_w / 2) - (w / 2) 60 local x = (win_w / 2) - (w / 2)
50 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (w / 2) 61 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (w / 2)
51 local y = (win_h / 2) - (h / 2) 62 local y = (win_h / 2) - (h / 2)
52 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (h / 2) 63 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (h / 2)
53 evaslib.evas_map_util_points_populate_from_geometry(m, x, y, 64 evaslib.evas_map_util_points_populate_from_geometry(m, x, y,
54 w, h, 0) 65 w, h, 0)
55 66 mapcolorf()
56 if variant >= 5 then
57 evaslib.evas_map_point_color_set(m, 0, 255, 255, 255, 255)
58 evaslib.evas_map_point_color_set(m, 1, 255, 0, 0, 255)
59 evaslib.evas_map_point_color_set(m, 2, 0, 0, 255, 255)
60 if variant >= 9 then
61 evaslib.evas_map_point_color_set(m, 3, 0, 0, 0, 0)
62 else
63 evaslib.evas_map_point_color_set(m, 3, 0, 255, 0, 255)
64 end
65 end
66
67 evaslib.evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2)) 67 evaslib.evas_map_util_rotate(m, f, x + (w / 2), y + (h / 2))
68 local o = o_images[i] 68 local o = o_images[i]
69 evaslib.evas_object_map_enable_set(o, 1) 69 evaslib.evas_object_map_enable_set(o, 1)
70 evaslib.evas_object_map_set(o, m) 70 evaslib.evas_object_map_set(o, m)
71 end 71 end
72 fps_std(name, t, f) 72 end, name)
73 end)
74 local evas = ui.evas 73 local evas = ui.evas
75 local imgpath = util.build_path(images[variant]) 74 local imgpath = util.build_path(images[variant])
76 for i = 1, OBNUM do 75 for i = 1, itern do
77 local o = evaslib.evas_object_image_add(evas) 76 local o = evaslib.evas_object_image_add(evas)
78 o_images[i] = o 77 o_images[i] = o
79 evaslib.evas_object_image_file_set(o, imgpath, nil) 78 evaslib.evas_object_image_file_set(o, imgpath, nil)
diff --git a/tests/image_quality_scale.lua b/tests/image_quality_scale.lua
index a6ef786..a68354e 100644
--- a/tests/image_quality_scale.lua
+++ b/tests/image_quality_scale.lua
@@ -4,7 +4,6 @@ local evaslib = util.get_lib("evas")
4 4
5return function(queue, ui) 5return function(queue, ui)
6 local image 6 local image
7 local fps_std = ui.fps_std
8 queue[#queue + 1] = { "data.png", "Image Quality Scale", function() 7 queue[#queue + 1] = { "data.png", "Image Quality Scale", function()
9 local win_w, win_h = ui.win_w, ui.win_h 8 local win_w, win_h = ui.win_w, ui.win_h
10 ui.func_set(function() 9 ui.func_set(function()
@@ -16,13 +15,10 @@ return function(queue, ui)
16 h = h * ((f / 100) * 4) 15 h = h * ((f / 100) * 4)
17 local x = (win_w / 2) - (w / 2) 16 local x = (win_w / 2) - (w / 2)
18 local y = (win_h / 2) - (h / 2) 17 local y = (win_h / 2) - (h / 2)
19 if image then 18 evaslib.evas_object_move(image, x, y)
20 evaslib.evas_object_move(image, x, y) 19 evaslib.evas_object_resize(image, w, h)
21 evaslib.evas_object_resize(image, w, h) 20 evaslib.evas_object_image_fill_set(image, 0, 0, w, h)
22 evaslib.evas_object_image_fill_set(image, 0, 0, w, h) 21 end, "Image Quality Scale")
23 end
24 fps_std("Image Quality Scale", t, f)
25 end)
26 local evas = ui.evas 22 local evas = ui.evas
27 image = evaslib.evas_object_image_add(evas) 23 image = evaslib.evas_object_image_add(evas)
28 evaslib.evas_object_image_file_set(image, util.build_path("tp.png"), 24 evaslib.evas_object_image_file_set(image, util.build_path("tp.png"),
diff --git a/tests/line_blend.lua b/tests/line_blend.lua
index 0fa62ec..b884742 100644
--- a/tests/line_blend.lua
+++ b/tests/line_blend.lua
@@ -29,19 +29,15 @@ local rotate_point = function(ox, oy, r, win_w, win_h)
29end 29end
30 30
31return function(queue, ui) 31return function(queue, ui)
32 local OBNUM = 128 32 local itern = 128
33 local SLOW = 5 33 local slow = 5
34 local o_images = {} 34 local o_images = {}
35 for i = 1, OBNUM do o_images[i] = false end
36 local fps_std = ui.fps_std
37 queue[#queue + 1] = { "rect.png", "Line Blend", function() 35 queue[#queue + 1] = { "rect.png", "Line Blend", function()
38 local win_w, win_h = ui.win_w, ui.win_h 36 local win_w, win_h = ui.win_w, ui.win_h
39 local ox1, oy1 = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 37 local ox1, oy1 = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
40 local ox2, oy2 = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 38 local ox2, oy2 = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
41 ui.func_set(function() 39 ui.func_set(util.del_objs(o_images), function(t, f)
42 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 40 for i = 1, itern do
43 end, function(t, f)
44 for i = 1, OBNUM do
45 local o = o_images[i] 41 local o = o_images[i]
46 evaslib.evas_object_line_xy_get(o, ox1, oy1, ox2, oy2) 42 evaslib.evas_object_line_xy_get(o, ox1, oy1, ox2, oy2)
47 rotate_point(ox1, oy1, i - 1, win_w, win_h) 43 rotate_point(ox1, oy1, i - 1, win_w, win_h)
@@ -49,11 +45,10 @@ return function(queue, ui)
49 evaslib.evas_object_line_xy_set(o, ox1[0], oy1[0], ox2[0], 45 evaslib.evas_object_line_xy_set(o, ox1[0], oy1[0], ox2[0],
50 oy2[0]) 46 oy2[0])
51 end 47 end
52 fps_std("Line Blend", t, f) 48 end, "Line Blend")
53 end)
54 local evas = ui.evas 49 local evas = ui.evas
55 util.randomseed() 50 util.randomseed()
56 for i = 1, OBNUM do 51 for i = 1, itern do
57 local o = evaslib.evas_object_line_add(evas) 52 local o = evaslib.evas_object_line_add(evas)
58 o_images[i] = o 53 o_images[i] = o
59 local a = (util.random() % 256) / 2 54 local a = (util.random() % 256) / 2
diff --git a/tests/poly_blend.lua b/tests/poly_blend.lua
index d5a143b..b8b5eed 100644
--- a/tests/poly_blend.lua
+++ b/tests/poly_blend.lua
@@ -46,31 +46,26 @@ local poly = function(o, tp, x, y)
46end 46end
47 47
48return function(queue, ui) 48return function(queue, ui)
49 local OBNUM = 128 49 local itern = 128
50 local SLOW = 5 50 local slow = 5
51 local o_images = {} 51 local o_images = {}
52 for i = 1, OBNUM do o_images[i] = false end
53 local fps_std = ui.fps_std
54 queue[#queue + 1] = { "rect.png", "Polygon Blend", function() 52 queue[#queue + 1] = { "rect.png", "Polygon Blend", function()
55 local win_w, win_h = ui.win_w, ui.win_h 53 local win_w, win_h = ui.win_w, ui.win_h
56 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 54 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
57 ui.func_set(function() 55 ui.func_set(util.del_objs(o_images), function(t, f)
58 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 56 for i = 1, itern do
59 end, function(t, f)
60 for i = 1, OBNUM do
61 local o = o_images[i] 57 local o = o_images[i]
62 evaslib.evas_object_geometry_get(o, nil, nil, w, h) 58 evaslib.evas_object_geometry_get(o, nil, nil, w, h)
63 local x = (win_w / 2) - (w[0] / 2) 59 local x = (win_w / 2) - (w[0] / 2)
64 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (win_w / 4) 60 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (win_w / 4)
65 local y = (win_h / 2) - (h[0] / 2) 61 local y = (win_h / 2) - (h[0] / 2)
66 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (win_h / 4) 62 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (win_h / 4)
67 evaslib.evas_object_move(o, x, y) 63 evaslib.evas_object_move(o, x, y)
68 end 64 end
69 fps_std("Polygon Blend", t, f) 65 end, "Polygon Blend")
70 end)
71 local evas = ui.evas 66 local evas = ui.evas
72 util.randomseed() 67 util.randomseed()
73 for i = 1, OBNUM do 68 for i = 1, itern do
74 local o = evaslib.evas_object_polygon_add(evas) 69 local o = evaslib.evas_object_polygon_add(evas)
75 o_images[i] = o 70 o_images[i] = o
76 local a = (util.random() % 256) / 2 71 local a = (util.random() % 256) / 2
diff --git a/tests/proxy_image.lua b/tests/proxy_image.lua
index f59b5cd..6abf6d5 100644
--- a/tests/proxy_image.lua
+++ b/tests/proxy_image.lua
@@ -5,27 +5,22 @@ local evaslib = util.get_lib("evas")
5local sin, cos = math.sin, math.cos 5local sin, cos = math.sin, math.cos
6 6
7return function(queue, ui) 7return function(queue, ui)
8 local OBNUM = 128 8 local itern = 128
9 local SLOW = 5 9 local slow = 5
10 local o_images = {} 10 local o_images = {}
11 for i = 1, OBNUM do o_images[i] = false end
12 local fps_std = ui.fps_std
13 queue[#queue + 1] = { "blend.png", "Image Blend Unscaled Proxy", function() 11 queue[#queue + 1] = { "blend.png", "Image Blend Unscaled Proxy", function()
14 local win_w, win_h = ui.win_w, ui.win_h 12 local win_w, win_h = ui.win_w, ui.win_h
15 ui.func_set(function() 13 ui.func_set(util.del_objs(o_images), function(t, f)
16 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 14 for i = 1, itern do
17 end, function(t, f)
18 for i = 1, OBNUM do
19 local w = 120 15 local w = 120
20 local h = 160 16 local h = 160
21 local x = (win_w / 2) - (w / 2) 17 local x = (win_w / 2) - (w / 2)
22 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (w / 2) 18 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (w / 2)
23 local y = (win_h / 2) - (h / 2) 19 local y = (win_h / 2) - (h / 2)
24 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (h / 2) 20 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (h / 2)
25 evaslib.evas_object_move(o_images[i], x, y) 21 evaslib.evas_object_move(o_images[i], x, y)
26 end 22 end
27 fps_std("Image Blend Unscaled Proxy", t, f) 23 end, "Image Blend Unscaled Proxy")
28 end)
29 local evas = ui.evas 24 local evas = ui.evas
30 local o = evaslib.evas_object_image_add(evas) 25 local o = evaslib.evas_object_image_add(evas)
31 evaslib.evas_object_image_file_set(o, util.build_path("logo.png"), nil) 26 evaslib.evas_object_image_file_set(o, util.build_path("logo.png"), nil)
@@ -33,8 +28,8 @@ return function(queue, ui)
33 evaslib.evas_object_resize(o, 120, 160) 28 evaslib.evas_object_resize(o, 120, 160)
34 evaslib.evas_object_show(o) 29 evaslib.evas_object_show(o)
35 o_images[1] = o 30 o_images[1] = o
36 local src = o 31 local src = o
37 for i = 2, OBNUM do 32 for i = 2, itern do
38 local o = evaslib.evas_object_image_add(evas) 33 local o = evaslib.evas_object_image_add(evas)
39 o_images[i] = o 34 o_images[i] = o
40 evaslib.evas_object_image_source_set(o, src) 35 evaslib.evas_object_image_source_set(o, src)
diff --git a/tests/proxy_text_fixed.lua b/tests/proxy_text_fixed.lua
index 4f1c059..6e66363 100644
--- a/tests/proxy_text_fixed.lua
+++ b/tests/proxy_text_fixed.lua
@@ -6,28 +6,23 @@ local evaslib = util.get_lib("evas")
6local sin, cos = math.sin, math.cos 6local sin, cos = math.sin, math.cos
7 7
8return function(queue, ui) 8return function(queue, ui)
9 local OBNUM = 128 9 local itern = 128
10 local SLOW = 5 10 local slow = 5
11 local o_texts = {} 11 local o_texts = {}
12 for i = 1, OBNUM do o_texts[i] = false end
13 local fps_std = ui.fps_std
14 queue[#queue + 1] = { "text.png", "Proxy Text Fixed", function() 12 queue[#queue + 1] = { "text.png", "Proxy Text Fixed", function()
15 local win_w, win_h = ui.win_w, ui.win_h 13 local win_w, win_h = ui.win_w, ui.win_h
16 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 14 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
17 ui.func_set(function() 15 ui.func_set(util.del_objs(o_texts), function(t, f)
18 for i = 1, OBNUM do evaslib.evas_object_del(o_texts[i]) end 16 for i = 1, itern do
19 end, function(t, f)
20 for i = 1, OBNUM do
21 local o = o_texts[i] 17 local o = o_texts[i]
22 evaslib.evas_object_geometry_get(o, nil, nil, w, h) 18 evaslib.evas_object_geometry_get(o, nil, nil, w, h)
23 local x = (win_w / 2) - (w[0] / 2) 19 local x = (win_w / 2) - (w[0] / 2)
24 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (w[0] / 2) 20 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (w[0] / 2)
25 local y = (win_h / 2) - (h[0] / 2) 21 local y = (win_h / 2) - (h[0] / 2)
26 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (w[0] / 2) 22 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (w[0] / 2)
27 evaslib.evas_object_move(o, x, y) 23 evaslib.evas_object_move(o, x, y)
28 end 24 end
29 fps_std("Proxy Text Fixed", t, f) 25 end, "Proxy Text Fixed")
30 end)
31 local evas = ui.evas 26 local evas = ui.evas
32 local st = evaslib.EVAS_TEXT_STYLE_SHADOW 27 local st = evaslib.EVAS_TEXT_STYLE_SHADOW
33 local i = 0 28 local i = 0
@@ -47,7 +42,7 @@ return function(queue, ui)
47 i = i + 1 42 i = i + 1
48 end 43 end
49 st = i 44 st = i
50 while i < OBNUM do 45 while i < itern do
51 local s = o_texts[(i % st) + 1] 46 local s = o_texts[(i % st) + 1]
52 local o = evaslib.evas_object_image_add(evas) 47 local o = evaslib.evas_object_image_add(evas)
53 o_texts[i + 1] = o 48 o_texts[i + 1] = o
diff --git a/tests/proxy_text_random.lua b/tests/proxy_text_random.lua
index 7bd4f8e..bc3b348 100644
--- a/tests/proxy_text_random.lua
+++ b/tests/proxy_text_random.lua
@@ -12,17 +12,13 @@ local strs = {
12} 12}
13 13
14return function(queue, ui) 14return function(queue, ui)
15 local OBNUM = 128 15 local itern = 128
16 local SLOW = 5 16 local slow = 5
17 local o_texts = {} 17 local o_texts = {}
18 for i = 1, OBNUM do o_texts[i] = false end
19 local fps_std = ui.fps_std
20 queue[#queue + 1] = { "text.png", "Proxy Text Random", function() 18 queue[#queue + 1] = { "text.png", "Proxy Text Random", function()
21 local win_w, win_h = ui.win_w, ui.win_h 19 local win_w, win_h = ui.win_w, ui.win_h
22 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 20 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
23 ui.func_set(function() 21 ui.func_set(util.del_objs(o_texts), function(t, f)
24 for i = 1, OBNUM do evaslib.evas_object_del(o_texts[i]) end
25 end, function(t, f)
26 local o = o_texts[1] 22 local o = o_texts[1]
27 evaslib.evas_object_text_text_set(o, ("%s %s %s %s."):format( 23 evaslib.evas_object_text_text_set(o, ("%s %s %s %s."):format(
28 strs[(util.random() % #strs) + 1], 24 strs[(util.random() % #strs) + 1],
@@ -31,13 +27,12 @@ return function(queue, ui)
31 strs[(util.random() % #strs) + 1])) 27 strs[(util.random() % #strs) + 1]))
32 evaslib.evas_object_geometry_get(o, nil, nil, w, h) 28 evaslib.evas_object_geometry_get(o, nil, nil, w, h)
33 local w, h = w[0], h[0] 29 local w, h = w[0], h[0]
34 for i = 2, OBNUM do 30 for i = 2, itern do
35 local o = o_texts[i] 31 local o = o_texts[i]
36 evaslib.evas_object_resize(o, w, h) 32 evaslib.evas_object_resize(o, w, h)
37 evaslib.evas_object_image_fill_set(o, 0, 0, w, h) 33 evaslib.evas_object_image_fill_set(o, 0, 0, w, h)
38 end 34 end
39 fps_std("Proxy Text Random", t, f) 35 end, "Proxy Text Random")
40 end)
41 local evas = ui.evas 36 local evas = ui.evas
42 util.randomseed() 37 util.randomseed()
43 local o = evaslib.evas_object_text_add(evas) 38 local o = evaslib.evas_object_text_add(evas)
@@ -51,20 +46,19 @@ return function(queue, ui)
51 evaslib.evas_object_color_set(o, 0, 0, 0, 255) 46 evaslib.evas_object_color_set(o, 0, 0, 0, 255)
52 evaslib.evas_object_geometry_get(o, nil, nil, w, h) 47 evaslib.evas_object_geometry_get(o, nil, nil, w, h)
53 local x = (win_w / 2) - (w[0] / 2) 48 local x = (win_w / 2) - (w[0] / 2)
54 local y = (win_h / 2) - (h[0] / 2) 49 local y = (win_h / 2) - (h[0] / 2) + (w[0] / 2)
55 y = y + (w[0] / 2)
56 evaslib.evas_object_move(o, x, y) 50 evaslib.evas_object_move(o, x, y)
57 evaslib.evas_object_show(o) 51 evaslib.evas_object_show(o)
58 for i = 2, OBNUM do 52 for i = 2, itern do
59 local o = evaslib.evas_object_image_add(evas) 53 local o = evaslib.evas_object_image_add(evas)
60 o_texts[i] = o 54 o_texts[i] = o
61 evaslib.evas_object_image_source_set(o, o_texts[1]) 55 evaslib.evas_object_image_source_set(o, o_texts[1])
62 evaslib.evas_object_geometry_get(o_texts[1], nil, nil, w, h) 56 evaslib.evas_object_geometry_get(o_texts[1], nil, nil, w, h)
63 evaslib.evas_object_resize(o, w[0], h[0]) 57 evaslib.evas_object_resize(o, w[0], h[0])
64 local x = (win_w / 2) - (w[0] / 2) 58 local x = (win_w / 2) - (w[0] / 2)
65 x = x + sin(((i - 1) * 13) / (36.7 * SLOW)) * (w[0] / 2) 59 + sin(((i - 1) * 13) / (36.7 * slow)) * (w[0] / 2)
66 local y = (win_h / 2) - (h[0] / 2) 60 local y = (win_h / 2) - (h[0] / 2)
67 y = y + cos(((i - 1) * 28) / (43.8 * SLOW)) * (w[0] / 2) 61 + cos(((i - 1) * 28) / (43.8 * slow)) * (w[0] / 2)
68 evaslib.evas_object_move(o, x, y) 62 evaslib.evas_object_move(o, x, y)
69 evaslib.evas_object_show(o) 63 evaslib.evas_object_show(o)
70 end 64 end
diff --git a/tests/rect.lua b/tests/rect.lua
index 7d1da92..baa8d53 100644
--- a/tests/rect.lua
+++ b/tests/rect.lua
@@ -13,43 +13,37 @@ local names = {
13} 13}
14 14
15return function(queue, ui, variant) 15return function(queue, ui, variant)
16 local image 16 local itern = (variant > 3) and 3 or 128
17 local OBNUM = (variant > 3) and 3 or 128 17 local slow = 5
18 local SLOW = 5
19 local o_images = {} 18 local o_images = {}
20 for i = 1, OBNUM do o_images[i] = false end
21 local fps_std = ui.fps_std
22 queue[#queue + 1] = { "rect.png", names[variant], function() 19 queue[#queue + 1] = { "rect.png", names[variant], function()
23 local win_w, win_h = ui.win_w, ui.win_h 20 local win_w, win_h = ui.win_w, ui.win_h
24 ui.func_set(function() 21 local i1, i2
25 for i = 1, OBNUM do evaslib.evas_object_del(o_images[i]) end 22 if variant == 4 then
26 end, function(t, f) 23 i1, i2 = 113, 228
27 for i = 1, OBNUM do 24 else
25 i1, i2 = 13, 28
26 end
27 ui.func_set(util.del_objs(o_images), function(t, f)
28 for i = 1, itern do
28 local o = o_images[i] 29 local o = o_images[i]
29 local w0 = 80 30 local w0 = 80
30 local h0 = 80 31 local h0 = 80
31 local w = 5 + ((1 + cos((f + ((i - 1) * 10)) / (7.4 * SLOW))) 32 local w = 5 + ((1 + cos((f + ((i - 1) * 10)) / (7.4 * slow)))
32 * w0 * 2) 33 * w0 * 2)
33 local h = 5 + ((1 + sin((f + ((i - 1) * 19)) / (12.6 * SLOW))) 34 local h = 5 + ((1 + sin((f + ((i - 1) * 19)) / (12.6 * slow)))
34 * h0 * 2) 35 * h0 * 2)
35 local x = (win_w / 2) - (w / 2) 36 local x = (win_w / 2) - (w / 2)
36 local i1, i2 37 + sin((f + ((i - 1) * i1)) / (36.7 * slow)) * (w0 / 2)
37 if variant == 4 then
38 i1, i2 = 113, 228
39 else
40 i1, i2 = 13, 28
41 end
42 x = x + sin((f + ((i - 1) * i1)) / (36.7 * SLOW)) * (w0 / 2)
43 local y = (win_h / 2) - (h / 2) 38 local y = (win_h / 2) - (h / 2)
44 y = y + cos((f + ((i - 1) * i2)) / (43.8 * SLOW)) * (h0 / 2) 39 + cos((f + ((i - 1) * i2)) / (43.8 * slow)) * (h0 / 2)
45 evaslib.evas_object_move(o, x, y) 40 evaslib.evas_object_move(o, x, y)
46 evaslib.evas_object_resize(o, w, h) 41 evaslib.evas_object_resize(o, w, h)
47 end 42 end
48 fps_std(names[variant], t, f) 43 end, names[variant])
49 end)
50 local evas = ui.evas 44 local evas = ui.evas
51 util.randomseed() 45 util.randomseed()
52 for i = 1, OBNUM do 46 for i = 1, itern do
53 local o = evaslib.evas_object_rectangle_add(evas) 47 local o = evaslib.evas_object_rectangle_add(evas)
54 o_images[i] = o 48 o_images[i] = o
55 local a, r, g, b 49 local a, r, g, b
diff --git a/tests/text.lua b/tests/text.lua
index 71abb36..4db6096 100644
--- a/tests/text.lua
+++ b/tests/text.lua
@@ -16,32 +16,27 @@ local strs = {
16local sin, cos = math.sin, math.cos 16local sin, cos = math.sin, math.cos
17 17
18return function(queue, ui, variant) 18return function(queue, ui, variant)
19 local OBNUM = 128 19 local itern = 128
20 local SLOW = 5 20 local slow = 5
21 local o_texts = {} 21 local o_texts = {}
22 for i = 1, OBNUM do o_texts[i] = false end
23 local fps_std = ui.fps_std
24 queue[#queue + 1] = { "text.png", variants[variant], function() 22 queue[#queue + 1] = { "text.png", variants[variant], function()
25 local win_w, win_h = ui.win_w, ui.win_h 23 local win_w, win_h = ui.win_w, ui.win_h
26 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 24 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
27 ui.func_set(function() 25 ui.func_set(util.del_objs(o_texts), function(t, f)
28 for i = 1, OBNUM do evaslib.evas_object_del(o_texts[i]) end 26 for i = 1, itern do
29 end, function(t, f)
30 for i = 1, OBNUM do
31 local o = o_texts[i] 27 local o = o_texts[i]
32 evaslib.evas_object_geometry_get(o, nil, nil, w, h) 28 evaslib.evas_object_geometry_get(o, nil, nil, w, h)
33 local x = (win_w / 2) - (w[0] / 2) 29 local x = (win_w / 2) - (w[0] / 2)
34 x = x + sin((f + ((i - 1) * 13)) / (36.7 * SLOW)) * (w[0] / 2) 30 + sin((f + ((i - 1) * 13)) / (36.7 * slow)) * (w[0] / 2)
35 local y = (win_h / 2) - (h[0] / 2) 31 local y = (win_h / 2) - (h[0] / 2)
36 y = y + cos((f + ((i - 1) * 28)) / (43.8 * SLOW)) * (w[0] / 2) 32 + cos((f + ((i - 1) * 28)) / (43.8 * slow)) * (w[0] / 2)
37 evaslib.evas_object_move(o, x, y) 33 evaslib.evas_object_move(o, x, y)
38 end 34 end
39 fps_std(variants[variant], t, f) 35 end, variants[variant])
40 end)
41 local evas = ui.evas 36 local evas = ui.evas
42 local st = evaslib.EVAS_TEXT_STYLE_SHADOW 37 local st = evaslib.EVAS_TEXT_STYLE_SHADOW
43 if variant == 3 then util.randomseed() end 38 if variant == 3 then util.randomseed() end
44 for i = 1, OBNUM do 39 for i = 1, itern do
45 local o = evaslib.evas_object_text_add(evas) 40 local o = evaslib.evas_object_text_add(evas)
46 o_texts[i] = o 41 o_texts[i] = o
47 evaslib.evas_object_text_font_set(o, "Vera-Bold", 20) 42 evaslib.evas_object_text_font_set(o, "Vera-Bold", 20)
diff --git a/tests/text_change.lua b/tests/text_change.lua
index 2880cdc..4365b6a 100644
--- a/tests/text_change.lua
+++ b/tests/text_change.lua
@@ -12,29 +12,24 @@ local strs = {
12local sin, cos = math.sin, math.cos 12local sin, cos = math.sin, math.cos
13 13
14return function(queue, ui) 14return function(queue, ui)
15 local OBNUM = 128 15 local itern = 128
16 local SLOW = 5 16 local slow = 5
17 local o_texts = {} 17 local o_texts = {}
18 for i = 1, OBNUM do o_texts[i] = false end
19 local fps_std = ui.fps_std
20 queue[#queue + 1] = { "text.png", "Text Change", function() 18 queue[#queue + 1] = { "text.png", "Text Change", function()
21 local win_w, win_h = ui.win_w, ui.win_h 19 local win_w, win_h = ui.win_w, ui.win_h
22 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 20 local w, h = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
23 ui.func_set(function() 21 ui.func_set(util.del_objs(o_texts), function(t, f)
24 for i = 1, OBNUM do evaslib.evas_object_del(o_texts[i]) end 22 for i = 1, itern do
25 end, function(t, f)
26 for i = 1, OBNUM do
27 evaslib.evas_object_text_text_set(o_texts[i], ("%s %s %s %s.") 23 evaslib.evas_object_text_text_set(o_texts[i], ("%s %s %s %s.")
28 :format(strs[(util.random() % #strs) + 1], 24 :format(strs[(util.random() % #strs) + 1],
29 strs[(util.random() % #strs) + 1], 25 strs[(util.random() % #strs) + 1],
30 strs[(util.random() % #strs) + 1], 26 strs[(util.random() % #strs) + 1],
31 strs[(util.random() % #strs) + 1])) 27 strs[(util.random() % #strs) + 1]))
32 end 28 end
33 fps_std("Text Change", t, f) 29 end, "Text Change")
34 end)
35 local evas = ui.evas 30 local evas = ui.evas
36 util.randomseed() 31 util.randomseed()
37 for i = 1, OBNUM do 32 for i = 1, itern do
38 local o = evaslib.evas_object_text_add(evas) 33 local o = evaslib.evas_object_text_add(evas)
39 o_texts[i] = o 34 o_texts[i] = o
40 evaslib.evas_object_text_font_set(o, "Vera-Bold", 20) 35 evaslib.evas_object_text_font_set(o, "Vera-Bold", 20)
@@ -46,9 +41,9 @@ return function(queue, ui)
46 evaslib.evas_object_color_set(o, 0, 0, 0, 255) 41 evaslib.evas_object_color_set(o, 0, 0, 0, 255)
47 evaslib.evas_object_geometry_get(o, nil, nil, w, h) 42 evaslib.evas_object_geometry_get(o, nil, nil, w, h)
48 local x = (win_w / 2) - (w[0] / 2) 43 local x = (win_w / 2) - (w[0] / 2)
49 x = x + sin(((i - 1) * 13) / (36.7 * SLOW)) * (w[0] / 2) 44 x = x + sin(((i - 1) * 13) / (36.7 * slow)) * (w[0] / 2)
50 local y = (win_h / 2) - (h[0] / 2) 45 local y = (win_h / 2) - (h[0] / 2)
51 y = y + cos(((i - 1) * 28) / (43.8 * SLOW)) * (w[0] / 2) 46 y = y + cos(((i - 1) * 28) / (43.8 * slow)) * (w[0] / 2)
52 evaslib.evas_object_move(o, x, y) 47 evaslib.evas_object_move(o, x, y)
53 evaslib.evas_object_show(o) 48 evaslib.evas_object_show(o)
54 end 49 end
diff --git a/tests/textblock_auto_align.lua b/tests/textblock_auto_align.lua
index e36746a..cb32224 100644
--- a/tests/textblock_auto_align.lua
+++ b/tests/textblock_auto_align.lua
@@ -7,8 +7,7 @@ local sin, abs = math.sin, math.abs
7 7
8return function(queue, ui, variant) 8return function(queue, ui, variant)
9 local text 9 local text
10 local SLOW = 5 10 local slow = 5
11 local fps_std = ui.fps_std
12 queue[#queue + 1] = { "text.png", "Textblock auto align", function() 11 queue[#queue + 1] = { "text.png", "Textblock auto align", function()
13 local win_w, win_h = ui.win_w, ui.win_h 12 local win_w, win_h = ui.win_w, ui.win_h
14 local w0, h0 = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 13 local w0, h0 = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
@@ -18,13 +17,12 @@ return function(queue, ui, variant)
18 evaslib.evas_object_textblock_size_native_get(text, w0, h0) 17 evaslib.evas_object_textblock_size_native_get(text, w0, h0)
19 local w = w0[0] 18 local w = w0[0]
20 local h = h0[0] 19 local h = h0[0]
21 w = w + abs(sin(f / (31.1 * SLOW))) * w0[0] 20 w = w + abs(sin(f / (31.1 * slow))) * w0[0]
22 local x = (win_w / 2) - (w / 2) 21 local x = (win_w / 2) - (w / 2)
23 local y = (win_h / 2) - (h / 2) 22 local y = (win_h / 2) - (h / 2)
24 evaslib.evas_object_move(text, x, y) 23 evaslib.evas_object_move(text, x, y)
25 evaslib.evas_object_resize(text, w, h) 24 evaslib.evas_object_resize(text, w, h)
26 fps_std("Textblock auto align", t, f) 25 end, "Textblock auto align")
27 end)
28 local evas = ui.evas 26 local evas = ui.evas
29 text = evaslib.evas_object_textblock_add(evas) 27 text = evaslib.evas_object_textblock_add(evas)
30 local st = evaslib.evas_textblock_style_new() 28 local st = evaslib.evas_textblock_style_new()
diff --git a/tests/textblock_basic.lua b/tests/textblock_basic.lua
index 7223661..95c0eb2 100644
--- a/tests/textblock_basic.lua
+++ b/tests/textblock_basic.lua
@@ -6,24 +6,22 @@ local sin, cos = math.sin, math.cos
6 6
7return function(queue, ui, variant) 7return function(queue, ui, variant)
8 local text 8 local text
9 local SLOW = 5 9 local slow = 5
10 local fps_std = ui.fps_std
11 queue[#queue + 1] = { "text.png", "Textblock Basic", function() 10 queue[#queue + 1] = { "text.png", "Textblock Basic", function()
12 local win_w, win_h = ui.win_w, ui.win_h 11 local win_w, win_h = ui.win_w, ui.win_h
13 ui.func_set(function() 12 ui.func_set(function()
14 evaslib.evas_object_del(text) 13 evaslib.evas_object_del(text)
15 end, function(t, f) 14 end, function(t, f)
16 local w0, h0 = 160, 120 15 local w0, h0 = 160, 120
17 local w = 150 + ((1 + cos(f / (37.4 * SLOW))) * w0 * 2) 16 local w = 150 + ((1 + cos(f / (37.4 * slow))) * w0 * 2)
18 local h = 50 + ((1 + sin(f / (52.6 * SLOW))) * h0 * 2) 17 local h = 50 + ((1 + sin(f / (52.6 * slow))) * h0 * 2)
19 local x = (win_w / 2) - (w / 2) 18 local x = (win_w / 2) - (w / 2)
20 x = x + sin(f / (86.7 * SLOW)) * (w0 / 2) 19 + sin(f / (86.7 * slow)) * (w0 / 2)
21 local y = (win_h / 2) - (h / 2) 20 local y = (win_h / 2) - (h / 2)
22 y = y + cos(f / (93.8 * SLOW)) * (h0 / 2) 21 + cos(f / (93.8 * slow)) * (h0 / 2)
23 evaslib.evas_object_move(text, x, y) 22 evaslib.evas_object_move(text, x, y)
24 evaslib.evas_object_resize(text, w, 5000) 23 evaslib.evas_object_resize(text, w, 5000)
25 fps_std("Textblock Basic", t, f) 24 end, "Textblock Basic")
26 end)
27 local evas = ui.evas 25 local evas = ui.evas
28 text = evaslib.evas_object_textblock_add(evas) 26 text = evaslib.evas_object_textblock_add(evas)
29 local st = evaslib.evas_textblock_style_new() 27 local st = evaslib.evas_textblock_style_new()
diff --git a/tests/textblock_intl.lua b/tests/textblock_intl.lua
index 8837dc9..4986055 100644
--- a/tests/textblock_intl.lua
+++ b/tests/textblock_intl.lua
@@ -7,8 +7,7 @@ local sin, cos = math.sin, math.cos
7 7
8return function(queue, ui, variant) 8return function(queue, ui, variant)
9 local text 9 local text
10 local SLOW = 5 10 local slow = 5
11 local fps_std = ui.fps_std
12 queue[#queue + 1] = { "text.png", "Textblock Intl", function() 11 queue[#queue + 1] = { "text.png", "Textblock Intl", function()
13 local win_w, win_h = ui.win_w, ui.win_h 12 local win_w, win_h = ui.win_w, ui.win_h
14 local w0, h0 = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 13 local w0, h0 = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
@@ -19,13 +18,12 @@ return function(queue, ui, variant)
19 local w = w0[0] 18 local w = w0[0]
20 local h = h0[0] 19 local h = h0[0]
21 local x = (win_w / 2) - (w / 2) 20 local x = (win_w / 2) - (w / 2)
22 x = x + sin(f / (31.1 * SLOW)) * (w0[0] / (2 * 2)) 21 + sin(f / (31.1 * slow)) * (w0[0] / (2 * 2))
23 local y = (win_h / 2) - (h / 2) 22 local y = (win_h / 2) - (h / 2)
24 y = y + cos(f / (19.6 * SLOW)) * (h0[0] / (2 * 2)) 23 + cos(f / (19.6 * slow)) * (h0[0] / (2 * 2))
25 evaslib.evas_object_move(text, x, y) 24 evaslib.evas_object_move(text, x, y)
26 evaslib.evas_object_resize(text, w, h) 25 evaslib.evas_object_resize(text, w, h)
27 fps_std("Textblock Intl", t, f) 26 end, "Textblock Intl")
28 end)
29 local evas = ui.evas 27 local evas = ui.evas
30 text = evaslib.evas_object_textblock_add(evas) 28 text = evaslib.evas_object_textblock_add(evas)
31 local st = evaslib.evas_textblock_style_new() 29 local st = evaslib.evas_textblock_style_new()
diff --git a/tests/textblock_text_append.lua b/tests/textblock_text_append.lua
index 0a4db51..c72b745 100644
--- a/tests/textblock_text_append.lua
+++ b/tests/textblock_text_append.lua
@@ -4,8 +4,7 @@ local evaslib = util.get_lib("evas")
4 4
5return function(queue, ui, variant) 5return function(queue, ui, variant)
6 local text 6 local text
7 local SLOW = 5 7 local slow = 5
8 local fps_std = ui.fps_std
9 queue[#queue + 1] = { "text.png", "Textblock text_append", function() 8 queue[#queue + 1] = { "text.png", "Textblock text_append", function()
10 local win_w, win_h = ui.win_w, ui.win_h 9 local win_w, win_h = ui.win_w, ui.win_h
11 local cur2 10 local cur2
@@ -26,8 +25,7 @@ return function(queue, ui, variant)
26 else 25 else
27 evaslib.evas_textblock_cursor_paragraph_next(cur) 26 evaslib.evas_textblock_cursor_paragraph_next(cur)
28 end 27 end
29 fps_std("Textblock text_append", t, f) 28 end, "Textblock text_append")
30 end)
31 local evas = ui.evas 29 local evas = ui.evas
32 text = evaslib.evas_object_textblock_add(evas) 30 text = evaslib.evas_object_textblock_add(evas)
33 local st = evaslib.evas_textblock_style_new() 31 local st = evaslib.evas_textblock_style_new()
diff --git a/tests/widgets_file_icons.lua b/tests/widgets_file_icons.lua
index 28e11f1..dc1abf6 100644
--- a/tests/widgets_file_icons.lua
+++ b/tests/widgets_file_icons.lua
@@ -3,8 +3,6 @@ local ffi_new = ffi.new
3local util = require("util") 3local util = require("util")
4local evaslib = util.get_lib("evas") 4local evaslib = util.get_lib("evas")
5 5
6local NUM = 512
7
8local icons = { 6local icons = {
9 "bug.png", 7 "bug.png",
10 "bulb.png", 8 "bulb.png",
@@ -32,46 +30,39 @@ local variants = {
32} 30}
33 31
34return function(queue, ui, variant) 32return function(queue, ui, variant)
35 local ICON_SIZE = (variant == 6) and 16 or ((variant == 7) and 96 or 64) 33 local itern = 512
34 local icon_size = (variant == 6) and 16 or ((variant == 7)
35 and 96 or 64)
36 local o_images, o_texts = {}, {} 36 local o_images, o_texts = {}, {}
37 local name = variants[variant] 37 local name = variants[variant]
38 -- populate the arrays to initialize the memory
39 for i = 1, NUM do o_images[i], o_texts[i] = false, false end
40 local fps_std = ui.fps_std
41 queue[#queue + 1] = { "widgets.png", name, function() 38 queue[#queue + 1] = { "widgets.png", name, function()
42 local win_w, win_h = ui.win_w, ui.win_h 39 local win_w, win_h = ui.win_w, ui.win_h
43 local tw, th = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 40 local tw, th = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
44 ui.func_set(function() 41 ui.func_set(util.del_objs(o_images, o_texts), function(t, f)
45 for i = 1, 512 do
46 evaslib.evas_object_del(o_images[i])
47 evaslib.evas_object_del(o_texts[i])
48 end
49 end, function(t, f)
50 local x, y = 0, 0 - f 42 local x, y = 0, 0 - f
51 for i = 1, NUM do 43 for i = 1, itern do
52 local o_img, o_txt = o_images[i], o_texts[i] 44 local o_img, o_txt = o_images[i], o_texts[i]
53 evaslib.evas_object_move(o_img, x + 8, y) 45 evaslib.evas_object_move(o_img, x + 8, y)
54 evaslib.evas_object_geometry_get(o_txt, nil, nil, tw, th) 46 evaslib.evas_object_geometry_get(o_txt, nil, nil, tw, th)
55 local cent = (ICON_SIZE + 16 - tw[0]) / 2 47 local cent = (icon_size + 16 - tw[0]) / 2
56 evaslib.evas_object_move(o_txt, x + cent, y + ICON_SIZE + 4) 48 evaslib.evas_object_move(o_txt, x + cent, y + icon_size + 4)
57 x = x + ICON_SIZE + 16 49 x = x + icon_size + 16
58 if x > win_w then 50 if x > win_w then
59 x = 0 51 x = 0
60 y = y + ICON_SIZE + 16 52 y = y + icon_size + 16
61 end 53 end
62 end 54 end
63 fps_std(name, t, f) 55 end, name)
64 end)
65 local evas = ui.evas 56 local evas = ui.evas
66 for i = 0, NUM - 1 do 57 for i = 0, itern - 1 do
67 local o = evaslib.evas_object_image_add(evas) 58 local o = evaslib.evas_object_image_add(evas)
68 o_images[i + 1] = o 59 o_images[i + 1] = o
69 local icon = (variant == 4 or variant == 5) and icons[5] 60 local icon = (variant == 4 or variant == 5) and icons[5]
70 or icons[i % 13 + 1] 61 or icons[i % 13 + 1]
71 evaslib.evas_object_image_file_set(o, util.build_path( 62 evaslib.evas_object_image_file_set(o, util.build_path(
72 icon), nil) 63 icon), nil)
73 evaslib.evas_object_image_fill_set(o, 0, 0, ICON_SIZE, ICON_SIZE) 64 evaslib.evas_object_image_fill_set(o, 0, 0, icon_size, icon_size)
74 evaslib.evas_object_resize(o, ICON_SIZE, ICON_SIZE) 65 evaslib.evas_object_resize(o, icon_size, icon_size)
75 evaslib.evas_object_show(o) 66 evaslib.evas_object_show(o)
76 o = evaslib.evas_object_text_add(evas) 67 o = evaslib.evas_object_text_add(evas)
77 o_texts[i + 1] = o 68 o_texts[i + 1] = o
@@ -88,16 +79,16 @@ return function(queue, ui, variant)
88 evaslib.evas_object_show(o) 79 evaslib.evas_object_show(o)
89 end 80 end
90 if variant == 3 then 81 if variant == 3 then
91 for i = 1, NUM do 82 for i = 1, itern do
92 evaslib.evas_object_raise(o_images[i]) 83 evaslib.evas_object_raise(o_images[i])
93 end 84 end
94 for i = 1, NUM do 85 for i = 1, itern do
95 if i > 14 then evaslib.evas_object_stack_above(o_images[i], 86 if i > 14 then evaslib.evas_object_stack_above(o_images[i],
96 o_images[i - 13]) end 87 o_images[i - 13]) end
97 end 88 end
98 end 89 end
99 if variant == 5 then 90 if variant == 5 then
100 for i = 1, NUM do 91 for i = 1, itern do
101 evaslib.evas_object_raise(o_images[i]) 92 evaslib.evas_object_raise(o_images[i])
102 end 93 end
103 end 94 end
diff --git a/tests/widgets_list.lua b/tests/widgets_list.lua
index 2a52bb8..fd36d2e 100644
--- a/tests/widgets_list.lua
+++ b/tests/widgets_list.lua
@@ -3,8 +3,6 @@ local ffi_new = ffi.new
3local util = require("util") 3local util = require("util")
4local evaslib = util.get_lib("evas") 4local evaslib = util.get_lib("evas")
5 5
6local NUM = 512
7
8local labels = { 6local labels = {
9 "Andrew", 7 "Andrew",
10 "Alex", 8 "Alex",
@@ -71,53 +69,41 @@ local iconsizes = {
71} 69}
72 70
73return function(queue, ui, variant) 71return function(queue, ui, variant)
74 local ICON_SIZE = iconsizes[variant] 72 local itern = 512
73 local icon_size = iconsizes[variant]
75 local o_images, o_texts = {}, {} 74 local o_images, o_texts = {}, {}
76 local o_icons 75 local o_icons
77 local name = variants[variant] 76 local name = variants[variant]
78 -- populate the arrays to initialize the memory 77 if variant > 4 then o_icons = {} end
79 for i = 1, NUM do o_images[i], o_texts[i] = false, false end
80 if variant > 4 then
81 o_icons = {}
82 for i = 1, NUM do o_icons[i] = false end
83 end
84 local fps_std = ui.fps_std
85 queue[#queue + 1] = { "widgets.png", name, function() 78 queue[#queue + 1] = { "widgets.png", name, function()
86 local win_w, win_h = ui.win_w, ui.win_h 79 local win_w, win_h = ui.win_w, ui.win_h
87 local tw, th = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]") 80 local tw, th = ffi_new("Evas_Coord[1]"), ffi_new("Evas_Coord[1]")
88 ui.func_set(function() 81 ui.func_set(util.del_objs(o_images, o_texts, o_icons), function(t, f)
89 for i = 1, 512 do
90 evaslib.evas_object_del(o_images[i])
91 evaslib.evas_object_del(o_texts[i])
92 if o_icons then evaslib.evas_object_del(o_icons[i]) end
93 end
94 end, function(t, f)
95 local x, y = 0, 0 - f 82 local x, y = 0, 0 - f
96 for i = 1, NUM do 83 for i = 1, itern do
97 local o_img, o_txt = o_images[i], o_texts[i] 84 local o_img, o_txt = o_images[i], o_texts[i]
98 local o_icon
99 if o_icons then o_icon = o_icons[i] end
100 evaslib.evas_object_move(o_img, x, y) 85 evaslib.evas_object_move(o_img, x, y)
101 if o_icon then
102 evaslib.evas_object_move(o_icon, x + 4, y + 4)
103 end
104 evaslib.evas_object_geometry_get(o_txt, nil, nil, tw, th) 86 evaslib.evas_object_geometry_get(o_txt, nil, nil, tw, th)
105 local cent = (ICON_SIZE - th[0]) / 2 87 local cent = (icon_size - th[0]) / 2
106 evaslib.evas_object_move(o_txt, x + 8 + (o_icon 88 if o_icons then
107 and (ICON_SIZE + 8) or 0), y + cent) 89 evaslib.evas_object_move(o_icons[i], x + 4, y + 4)
108 y = y + ICON_SIZE 90 evaslib.evas_object_move(o_txt, x + 8 + icon_size + 8,
91 y + cent)
92 else
93 evaslib.evas_object_move(o_txt, x + 8, y + cent)
94 end
95 y = y + icon_size
109 end 96 end
110 fps_std(name, t, f) 97 end, name)
111 end)
112 local evas = ui.evas 98 local evas = ui.evas
113 for i = 0, NUM - 1 do 99 for i = 0, itern - 1 do
114 local o = evaslib.evas_object_image_add(evas) 100 local o = evaslib.evas_object_image_add(evas)
115 o_images[i + 1] = o 101 o_images[i + 1] = o
116 evaslib.evas_object_image_filled_set(o, 1) 102 evaslib.evas_object_image_filled_set(o, 1)
117 evaslib.evas_object_image_border_set(o, 2, 2, 2, 2) 103 evaslib.evas_object_image_border_set(o, 2, 2, 2, 2)
118 evaslib.evas_object_image_file_set(o, util.build_path("pan.png"), 104 evaslib.evas_object_image_file_set(o, util.build_path("pan.png"),
119 nil) 105 nil)
120 evaslib.evas_object_resize(o, win_w, ICON_SIZE) 106 evaslib.evas_object_resize(o, win_w, icon_size)
121 evaslib.evas_object_show(o) 107 evaslib.evas_object_show(o)
122 if o_icons then 108 if o_icons then
123 o = evaslib.evas_object_image_add(evas) 109 o = evaslib.evas_object_image_add(evas)
@@ -126,7 +112,7 @@ return function(queue, ui, variant)
126 evaslib.evas_object_image_border_set(o, 2, 2, 2, 2) 112 evaslib.evas_object_image_border_set(o, 2, 2, 2, 2)
127 evaslib.evas_object_image_file_set(o, util.build_path( 113 evaslib.evas_object_image_file_set(o, util.build_path(
128 icons[(i % 13) + 1]), nil) 114 icons[(i % 13) + 1]), nil)
129 evaslib.evas_object_resize(o, ICON_SIZE - 8, ICON_SIZE - 8) 115 evaslib.evas_object_resize(o, icon_size - 8, icon_size - 8)
130 evaslib.evas_object_show(o) 116 evaslib.evas_object_show(o)
131 end 117 end
132 o = evaslib.evas_object_text_add(evas) 118 o = evaslib.evas_object_text_add(evas)
@@ -137,17 +123,17 @@ return function(queue, ui, variant)
137 evaslib.evas_object_show(o) 123 evaslib.evas_object_show(o)
138 end 124 end
139 if variant == 2 or variant == 4 or variant == 6 or variant == 8 then 125 if variant == 2 or variant == 4 or variant == 6 or variant == 8 then
140 for i = 1, NUM do evaslib.evas_object_raise(o_images[i]) end 126 for i = 1, itern do evaslib.evas_object_raise(o_images[i]) end
141 if o_icons then 127 if o_icons then
142 for i = 1, NUM do evaslib.evas_object_raise(o_icons[i]) end 128 for i = 1, itern do evaslib.evas_object_raise(o_icons[i]) end
143 for i = 1, NUM do 129 for i = 1, itern do
144 if i > 14 then 130 if i > 14 then
145 evaslib.evas_object_stack_above(o_icons[i], 131 evaslib.evas_object_stack_above(o_icons[i],
146 o_icons[i - 13]) 132 o_icons[i - 13])
147 end 133 end
148 end 134 end
149 end 135 end
150 for i = 1, NUM do evaslib.evas_object_raise(o_texts[i]) end 136 for i = 1, itern do evaslib.evas_object_raise(o_texts[i]) end
151 end 137 end
152 end } 138 end }
153end 139end
diff --git a/ui.lua b/ui.lua
index 660fe98..9e88733 100644
--- a/ui.lua
+++ b/ui.lua
@@ -16,6 +16,7 @@ local start = 0
16 16
17local t_start, t_loop = 0, 0 17local t_start, t_loop = 0, 0
18local f_start, f_loop = 0, 0 18local f_start, f_loop = 0, 0
19local t_name
19 20
20local data_dir 21local data_dir
21 22
@@ -208,7 +209,7 @@ local evas
208 209
209local M = {} 210local M = {}
210 211
211local ui_func_set, ui_menu, ui_fps, ui_loop 212local ui_func_set, ui_menu, ui_fps, ui_loop, ui_fps_std
212 213
213local about_cleanup = function() 214local about_cleanup = function()
214 evaslib.evas_object_del(o_text) 215 evaslib.evas_object_del(o_text)
@@ -688,7 +689,9 @@ M.loop = function()
688 t_loop = t 689 t_loop = t
689 f_loop = 0 690 f_loop = 0
690 end 691 end
691 loop_func(t - t_start, f_start) 692 local t, f = t - t_start, f_start
693 loop_func(t, f)
694 ui_fps_std(t_name, t, f)
692 return 695 return
693 end 696 end
694 t2 = get_time() 697 t2 = get_time()
@@ -785,7 +788,7 @@ ui_menu = M.menu
785 788
786local test_done = false 789local test_done = false
787 790
788M.func_set = function(cleanupf, loopf) 791M.func_set = function(cleanupf, loopf, name)
789 collectgarbage() 792 collectgarbage()
790 collectgarbage("stop") 793 collectgarbage("stop")
791 loop_func = loopf 794 loop_func = loopf
@@ -795,6 +798,7 @@ M.func_set = function(cleanupf, loopf)
795 ui_menu() 798 ui_menu()
796 end 799 end
797 end 800 end
801 t_name = name
798 t_start = get_time() 802 t_start = get_time()
799 t_loop = t_start 803 t_loop = t_start
800 f_loop, f_start = 0, 0 804 f_loop, f_start = 0, 0
@@ -811,7 +815,7 @@ M.fps = function(fps)
811end 815end
812ui_fps = M.fps 816ui_fps = M.fps
813 817
814M.fps_std = function(name, t, f) 818ui_fps_std = function(name, t, f)
815 if f >= loops and not test_done then 819 if f >= loops and not test_done then
816 local fps = f / t 820 local fps = f / t
817 ui_fps(fps) 821 ui_fps(fps)
diff --git a/util.lua b/util.lua
index 1df0dae..f303b3c 100644
--- a/util.lua
+++ b/util.lua
@@ -2,6 +2,8 @@
2 2
3local ffi = require("ffi") 3local ffi = require("ffi")
4 4
5local tonumber = tonumber
6
5local M = {} 7local M = {}
6 8
7local rp = 0 9local rp = 0
@@ -1243,4 +1245,23 @@ else
1243 end 1245 end
1244end 1246end
1245 1247
1248local evaslib
1249
1250M.del_objs = function(...)
1251 if not evaslib then evaslib = loaded_libs["evas"] end
1252 if select("#", ...) == 1 then
1253 local objs = (select(1, ...))
1254 return function()
1255 for i = 1, #objs do evaslib.evas_object_del(objs[i]) end
1256 end
1257 end
1258 local objsr = { ... }
1259 return function()
1260 for i = 1, #objsr do
1261 local objs = objsr[i]
1262 for j = 1, #objs do evaslib.evas_object_del(objs[j]) end
1263 end
1264 end
1265end
1266
1246return M \ No newline at end of file 1267return M \ No newline at end of file