[tekui-devel] tekui: Class: tracing uninitialized variables did not work corre...

Timm S. Mueller tmueller at schulze-mueller.de
Mon Dec 12 15:28:15 CET 2016


details:   http://hg.neoscientists.org/tekui/rev/e86e5c6cb434
changeset: 283:e86e5c6cb434
user:      Timm S. Mueller <tmueller at schulze-mueller.de>
date:      Mon Dec 12 15:24:51 2016 +0100
description:
Class: tracing uninitialized variables did not work correctly for boolean 'false', corrected
From: Timm S. Mueller <tmueller at schulze-mueller.de>
Subject: tekui: Pixconv: fixed huge potential waste of CPU for certain pixel format conversions

details:   http://hg.neoscientists.org/tekui/rev/337aaf0ed960
changeset: 284:337aaf0ed960
user:      Timm S. Mueller <tmueller at schulze-mueller.de>
date:      Mon Dec 12 15:26:09 2016 +0100
description:
Pixconv: fixed huge potential waste of CPU for certain pixel format conversions
From: Timm S. Mueller <tmueller at schulze-mueller.de>
Subject: tekui: added mouse coordinate examples

details:   http://hg.neoscientists.org/tekui/rev/3c0054553c1d
changeset: 285:3c0054553c1d
user:      Timm S. Mueller <tmueller at schulze-mueller.de>
date:      Mon Dec 12 15:26:28 2016 +0100
description:
added mouse coordinate examples

diffstat:

 bin/mousecoord1.lua |  33 +++++++++++++++++++++++++++++++++
 bin/mousecoord2.lua |  24 ++++++++++++++++++++++++
 src/misc/pixconv.c  |   3 +--
 tek/class.lua       |   4 ++--
 4 files changed, 60 insertions(+), 4 deletions(-)

diffs (99 lines):

diff -r 98c32746b56c -r 3c0054553c1d bin/mousecoord1.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/mousecoord1.lua	Mon Dec 12 15:26:28 2016 +0100
@@ -0,0 +1,33 @@
+#!/usr/bin/env lua
+
+--	how to retrieve mouse coordinates.
+--	see also mousecoord2.lua for another method.
+
+local ui = require "tek.ui"
+
+ui.Application:new { 
+	Children = {
+		ui.Window:new { 
+		
+			show = function(self)
+				ui.Window.show(self)
+				self:addInputHandler(ui.MSG_MOUSEMOVE, self, self.getMouse)
+			end,
+			hide = function(self)
+				ui.Window.hide(self)
+				self:remInputHandler(ui.MSG_MOUSEMOVE, self, self.getMouse)
+			end,
+			
+			getMouse = function(self, msg)
+				local x, y = self:getMsgFields(msg, "mousexy")
+				self:getById("text-coord"):setValue("Text", "x="..x.." y="..y)
+				return msg
+			end,
+		
+			Children = { 
+				ui.Text:new { Id = "text-coord", Text = "Hallo" }
+			}
+		}
+	}
+}:run()
+
diff -r 98c32746b56c -r 3c0054553c1d bin/mousecoord2.lua
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/mousecoord2.lua	Mon Dec 12 15:26:28 2016 +0100
@@ -0,0 +1,24 @@
+#!/usr/bin/env lua
+
+--	how to retrieve mouse coordinates.
+--	see also mousecoord1.lua for another method.
+
+local ui = require "tek.ui"
+
+ui.Application:new { 
+	Children = {
+		ui.Window:new { 
+			
+			passMsg = function(self, msg)
+				local x, y = self:getMsgFields(msg, "mousexy")
+				self:getById("text-coord"):setValue("Text", "x="..x.." y="..y)
+				return ui.Window.passMsg(self, msg)
+			end,
+
+			Children = { 
+				ui.Text:new { Id = "text-coord", Text = "Hallo" }
+			}
+		}
+	}
+}:run()
+
diff -r 98c32746b56c -r 3c0054553c1d src/misc/pixconv.c
--- a/src/misc/pixconv.c	Sun Jan 10 14:42:58 2016 +0100
+++ b/src/misc/pixconv.c	Mon Dec 12 15:26:28 2016 +0100
@@ -37,8 +37,7 @@
 			case ((TVPIXFMT_08B8G8R8 & 0xff) << 8) | (TVPIXFMT_08B8G8R8 & 0xff):
 			case ((TVPIXFMT_08B8G8R8 & 0xff) << 8) | (TVPIXFMT_A8B8G8R8 & 0xff):
 			case ((TVPIXFMT_A8B8G8R8 & 0xff) << 8) | (TVPIXFMT_A8B8G8R8 & 0xff):
-				for (y = 0; y < h; ++y, dp += dst->tpb_BytesPerLine, sp += src->tpb_BytesPerLine)
-					memcpy(dp, sp, w * 4);
+				memcpy(dp, sp, w * 4);
 				break;
 				
 			case ((TVPIXFMT_A8R8G8B8 & 0xff) << 8) | (TVPIXFMT_08R8G8B8 & 0xff):
diff -r 98c32746b56c -r 3c0054553c1d tek/class.lua
--- a/tek/class.lua	Sun Jan 10 14:42:58 2016 +0100
+++ b/tek/class.lua	Mon Dec 12 15:26:28 2016 +0100
@@ -43,7 +43,7 @@
 
 local Class = { }
 Class._NAME = "tek.class"
-Class._VERSION = "Class 9.0"
+Class._VERSION = "Class 9.1"
 Class.__index = Class
 
 if PROXY then
@@ -56,7 +56,7 @@
 		if DEBUG then
 			function mt.__index(tab, key)
 				local val = mt[key]
-				if not val then
+				if val == nil then
 					error(("Uninitialized read: %s.%s"):format(
 						tab:getClassName(), key), 2)
 				end


More information about the tekui-devel mailing list