From 37d898fb1a29f074747dbd9c81d6e2ad97d2e23e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C5=99emysl=20Janouch?=
Date: Fri, 10 Dec 2010 08:57:42 +0100
Subject: Change LdSymbolArea members.
Now it contains coordinates of the top-left delimiting
point and computed dimensions (instead of coorinates of
both delimiting points).
---
src/ld-lua.c | 15 +++++++++++----
1 file changed, 11 insertions(+), 4 deletions(-)
(limited to 'src/ld-lua.c')
diff --git a/src/ld-lua.c b/src/ld-lua.c
index 54ba0c4..4ed68eb 100644
--- a/src/ld-lua.c
+++ b/src/ld-lua.c
@@ -501,28 +501,35 @@ get_translation (lua_State *L, int index)
static gboolean
read_symbol_area (lua_State *L, int index, LdSymbolArea *area)
{
+ lua_Number x1, x2, y1, y2;
+
if (lua_objlen (L, index) != 4)
return FALSE;
lua_rawgeti (L, index, 1);
if (!lua_isnumber (L, -1))
return FALSE;
- area->x1 = lua_tonumber (L, -1);
+ x1 = lua_tonumber (L, -1);
lua_rawgeti (L, index, 2);
if (!lua_isnumber (L, -1))
return FALSE;
- area->y1 = lua_tonumber (L, -1);
+ y1 = lua_tonumber (L, -1);
lua_rawgeti (L, index, 3);
if (!lua_isnumber (L, -1))
return FALSE;
- area->x2 = lua_tonumber (L, -1);
+ x2 = lua_tonumber (L, -1);
lua_rawgeti (L, index, 4);
if (!lua_isnumber (L, -1))
return FALSE;
- area->y2 = lua_tonumber (L, -1);
+ y2 = lua_tonumber (L, -1);
+
+ area->x = MIN (x1, x2);
+ area->y = MIN (y1, y2);
+ area->width = ABS (x2 - x1);
+ area->height = ABS (y2 - y1);
return TRUE;
}
--
cgit v1.2.3