From 88f0bb1dca75834add77541399d5bf13bacd1163 Mon Sep 17 00:00:00 2001 From: Qingping Hou Date: Thu, 10 Jan 2013 11:29:13 +0800 Subject: [PATCH] add getPitch method to einkfb.c --- einkfb.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/einkfb.c b/einkfb.c index 599033548..01a012b06 100644 --- a/einkfb.c +++ b/einkfb.c @@ -279,6 +279,16 @@ static int getSize(lua_State *L) { return 2; } +static int getPitch(lua_State *L) { + FBInfo *fb = (FBInfo*) luaL_checkudata(L, 1, "einkfb"); +#ifndef EMULATE_READER + lua_pushinteger(L, fb->finfo.line_length); +#else + lua_pushinteger(L, fb->buf->pitch); +#endif + return 1; +} + static int closeFrameBuffer(lua_State *L) { FBInfo *fb = (FBInfo*) luaL_checkudata(L, 1, "einkfb"); // should be save if called twice @@ -432,6 +442,7 @@ static const struct luaL_Reg einkfb_meth[] = { {"getOrientation", einkGetOrientation}, {"setOrientation", einkSetOrientation}, {"getSize", getSize}, + {"getPitch", getPitch}, {NULL, NULL} };