Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Unified Diff: samplecode/SampleLua.cpp

Issue 651823004: create and modify matrices in lua (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: samplecode/SampleLua.cpp
diff --git a/samplecode/SampleLua.cpp b/samplecode/SampleLua.cpp
index 1536ed4fb846198cf2efb23cc0cf038383d4da72..7825ecaf69cad2db3ec81a3389096e577216e254 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)) {
« no previous file with comments | « resources/slides.lua ('k') | src/utils/SkLua.cpp » ('j') | src/utils/SkLua.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698