aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleLua.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-10-14 09:34:52 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-14 09:34:52 -0700
commitbdc49ae0d422b8fe1957af570c4f4e63272f5285 (patch)
treec66cc89e1e49e83e157d962635bbdd7810ae3416 /samplecode/SampleLua.cpp
parent8c27a188a0b216021d439eb627622d17b9f78343 (diff)
create and modify matrices in lua
Diffstat (limited to 'samplecode/SampleLua.cpp')
-rw-r--r--samplecode/SampleLua.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/samplecode/SampleLua.cpp b/samplecode/SampleLua.cpp
index 1536ed4fb8..7825ecaf69 100644
--- a/samplecode/SampleLua.cpp
+++ b/samplecode/SampleLua.cpp
@@ -100,12 +100,6 @@ protected:
}
virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
- SkMatrix matrix;
- matrix.setRectToRect(SkRect::MakeWH(640, 480),
- SkRect::MakeWH(this->width(), this->height()),
- SkMatrix::kCenter_ScaleToFit);
- canvas->concat(matrix);
-
lua_State* L = this->ensureLua();
lua_getglobal(L, gDrawName);
@@ -117,7 +111,9 @@ protected:
// does it make sense to try to "cache" the lua version of this
// canvas between draws?
fLua->pushCanvas(canvas);
- if (lua_pcall(L, 1, 1, 0) != LUA_OK) {
+ fLua->pushScalar(this->width());
+ fLua->pushScalar(this->height());
+ if (lua_pcall(L, 3, 1, 0) != LUA_OK) {
SkDebugf("lua err: %s\n", lua_tostring(L, -1));
} else {
if (lua_isboolean(L, -1) && lua_toboolean(L, -1)) {