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

Side by Side Diff: samplecode/SampleLua.cpp

Issue 646613004: add fade_slide transition to lua slides (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 unified diff | Download patch
« no previous file with comments | « resources/slides.lua ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkLua.h" 10 #include "SkLua.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 this->inval(NULL); 93 this->inval(NULL);
94 return true; 94 return true;
95 } 95 }
96 } 96 }
97 } 97 }
98 } 98 }
99 return this->INHERITED::onQuery(evt); 99 return this->INHERITED::onQuery(evt);
100 } 100 }
101 101
102 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { 102 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE {
103 SkMatrix matrix;
104 matrix.setRectToRect(SkRect::MakeWH(640, 480),
105 SkRect::MakeWH(this->width(), this->height()),
106 SkMatrix::kCenter_ScaleToFit);
107 canvas->concat(matrix);
108
103 lua_State* L = this->ensureLua(); 109 lua_State* L = this->ensureLua();
104 110
105 lua_getglobal(L, gDrawName); 111 lua_getglobal(L, gDrawName);
106 if (!lua_isfunction(L, -1)) { 112 if (!lua_isfunction(L, -1)) {
107 int t = lua_type(L, -1); 113 int t = lua_type(L, -1);
108 SkDebugf("--- expected %s function %d, ignoring.\n", gDrawName, t); 114 SkDebugf("--- expected %s function %d, ignoring.\n", gDrawName, t);
109 lua_pop(L, 1); 115 lua_pop(L, 1);
110 } else { 116 } else {
111 // does it make sense to try to "cache" the lua version of this 117 // does it make sense to try to "cache" the lua version of this
112 // canvas between draws? 118 // canvas between draws?
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 private: 152 private:
147 SkLua* fLua; 153 SkLua* fLua;
148 154
149 typedef SampleView INHERITED; 155 typedef SampleView INHERITED;
150 }; 156 };
151 157
152 ////////////////////////////////////////////////////////////////////////////// 158 //////////////////////////////////////////////////////////////////////////////
153 159
154 static SkView* MyFactory() { return new LuaView; } 160 static SkView* MyFactory() { return new LuaView; }
155 static SkViewRegister reg(MyFactory); 161 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « resources/slides.lua ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698