blob: e13073aea9fb30b2deccd9b6aa46ba415014e2f3 [file] [log] [blame]
reed@google.comdff7e112013-05-15 19:34:20 +00001/*
2 * Copyright 2013 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#include "SkLuaCanvas.h"
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +00009#include "SkRRect.h"
reed@google.comdff7e112013-05-15 19:34:20 +000010
11extern "C" {
12 #include "lua.h"
mike@reedtribe.orgf02fe3d2013-05-21 12:20:39 +000013 #include "lauxlib.h"
reed@google.comdff7e112013-05-15 19:34:20 +000014}
15
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000016static void setfield_string(lua_State* L, const char key[], const char value[]) {
17 lua_pushstring(L, value);
18 lua_setfield(L, -2, key);
reed@google.comdff7e112013-05-15 19:34:20 +000019}
20
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000021static void setfield_number(lua_State* L, const char key[], double value) {
22 lua_pushnumber(L, value);
23 lua_setfield(L, -2, key);
24}
25
26static void setfield_bool(lua_State* L, const char key[], bool value) {
27 lua_pushboolean(L, value);
28 lua_setfield(L, -2, key);
29}
30
reed@google.com57de5cf2013-05-16 13:51:07 +000031// sets [1]...[count] in the table on the top of the stack
32static void setfield_arrayf(lua_State* L, const SkScalar array[], int count) {
33 for (int i = 0; i < count; ++i) {
34 lua_pushnumber(L, SkScalarToDouble(i + 1)); // key
35 lua_pushnumber(L, SkScalarToDouble(array[i])); // value
36 lua_settable(L, -3);
37 }
38}
39
reed@google.com9a731042013-05-21 17:52:33 +000040static void push_rect(lua_State* L, const SkRect& r) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000041 lua_newtable(L);
42 setfield_number(L, "left", r.fLeft);
43 setfield_number(L, "top", r.fTop);
44 setfield_number(L, "right", r.fRight);
45 setfield_number(L, "bottom", r.fBottom);
reed@google.com9a731042013-05-21 17:52:33 +000046}
47
48static void setfield_rect(lua_State* L, const char key[], const SkRect& r) {
49 push_rect(L, r);
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000050 lua_setfield(L, -2, key);
51}
52
reed@google.com57de5cf2013-05-16 13:51:07 +000053static const char* rrect_type(const SkRRect& rr) {
54 switch (rr.getType()) {
55 case SkRRect::kUnknown_Type: return "unknown";
56 case SkRRect::kEmpty_Type: return "empty";
57 case SkRRect::kRect_Type: return "rect";
58 case SkRRect::kOval_Type: return "oval";
59 case SkRRect::kSimple_Type: return "simple";
60 case SkRRect::kComplex_Type: return "complex";
61 }
62 SkASSERT(!"never get here");
63 return "";
64}
65
66static void setfield_rrect(lua_State* L, const char key[], const SkRRect& rr) {
67 lua_newtable(L);
68 setfield_rect(L, "rect", rr.getBounds());
69 setfield_string(L, "type", rrect_type(rr));
70
71 SkVector rad[4] = {
72 rr.radii(SkRRect::kUpperLeft_Corner),
73 rr.radii(SkRRect::kUpperRight_Corner),
74 rr.radii(SkRRect::kLowerRight_Corner),
75 rr.radii(SkRRect::kLowerLeft_Corner),
76 };
77 setfield_arrayf(L, &rad[0].fX, 8);
78 lua_setfield(L, -2, key);
79}
80
mike@reedtribe.orgf02fe3d2013-05-21 12:20:39 +000081static void push_matrix(lua_State* L, const SkMatrix& mat) {
82 SkScalar m[9];
83 for (int i = 0; i < 9; ++i) {
84 m[i] = mat[i];
85 }
86 lua_newtable(L);
87 setfield_arrayf(L, m, 9);
88}
89
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +000090enum PaintUsage {
91 kText_PaintUsage,
92 kImage_PaintUsage,
93 kGeometry_PaintUsage
94};
95
96static const char* color2string(SkColor c, SkString* str) {
97 str->printf("0x%08X", c);
98 return str->c_str();
99}
100
101static void setfield_paint(lua_State* L, const SkPaint& p,
102 PaintUsage pu = kGeometry_PaintUsage) {
103 SkString str;
104
105 lua_newtable(L);
106 setfield_bool(L, "aa", p.isAntiAlias());
107 setfield_string(L, "color", color2string(p.getColor(), &str));
108
109 if (kGeometry_PaintUsage == pu) {
110 if (SkPaint::kFill_Style != p.getStyle()) {
111 setfield_number(L, "stroke-width", p.getStrokeWidth());
112 }
113 }
114 lua_setfield(L, -2, "paint");
115}
116
117class AutoCallLua {
118public:
119 AutoCallLua(lua_State* L, const char func[], const char verb[]) : fL(L) {
120 lua_getglobal(L, func);
121 if (!lua_isfunction(L, -1)) {
122 int t = lua_type(L, -1);
123 SkDebugf("--- expected function %d\n", t);
124 }
skia.committer@gmail.com539f3642013-05-16 07:01:00 +0000125
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000126 lua_newtable(L);
127 setfield_string(L, "verb", verb);
128 }
129
130 ~AutoCallLua() {
131 if (lua_pcall(fL, 1, 0, 0) != LUA_OK) {
132 SkDebugf("lua err: %s\n", lua_tostring(fL, -1));
133 }
134 lua_settop(fL, -1);
135 }
136
137private:
138 lua_State* fL;
139};
140
141#define AUTO_LUA(verb) AutoCallLua acl(fL, fFunc.c_str(), verb)
142
reed@google.comdff7e112013-05-15 19:34:20 +0000143///////////////////////////////////////////////////////////////////////////////
144
mike@reedtribe.orgf02fe3d2013-05-21 12:20:39 +0000145static const char gCanvasMetaTableName[] = "SkCanvas_MetaTable";
146
147static int lcanvas_getSaveCount(lua_State* L) {
148 SkCanvas* c = *(SkCanvas**)luaL_checkudata(L, 1, gCanvasMetaTableName);
149 lua_pushnumber(L, (double)c->getSaveCount());
150 return 1;
151}
152
153static int lcanvas_getTotalMatrix(lua_State* L) {
154 SkCanvas* c = *(SkCanvas**)luaL_checkudata(L, 1, gCanvasMetaTableName);
155 push_matrix(L, c->getTotalMatrix());
156 return 1;
157}
158
159static int lcanvas_gc(lua_State* L) {
160 SkCanvas** cptr = (SkCanvas**)luaL_checkudata(L, 1, gCanvasMetaTableName);
161 SkSafeUnref(*cptr);
162 *cptr = NULL;
163 return 0;
164}
165
166static const struct luaL_Reg gLuaCanvasMethods[] = {
167 { "getSaveCount", lcanvas_getSaveCount },
168 { "getTotalMatrix", lcanvas_getTotalMatrix },
169 { "__gc", lcanvas_gc },
170 { NULL, NULL }
171};
172
173static void ensure_canvas_metatable(lua_State* L) {
174 static bool gOnce;
175 if (gOnce) {
176 return;
177 }
178 gOnce = true;
skia.committer@gmail.comb148aca2013-05-22 07:01:13 +0000179
mike@reedtribe.orgf02fe3d2013-05-21 12:20:39 +0000180 luaL_newmetatable(L, gCanvasMetaTableName);
181 lua_pushvalue(L, -1);
182 lua_setfield(L, -2, "__index");
skia.committer@gmail.comb148aca2013-05-22 07:01:13 +0000183
mike@reedtribe.orgf02fe3d2013-05-21 12:20:39 +0000184 luaL_setfuncs(L, gLuaCanvasMethods, 0);
185 lua_settop(L, -2); // pop off the meta-table
186}
187
reed@google.com9a731042013-05-21 17:52:33 +0000188///////////////////////////////////////////////////////////////////////////////
189
190static const char gPathMetaTableName[] = "SkPath_MetaTable";
191
192static int lpath_getBounds(lua_State* L) {
193 SkPath* p = (SkPath*)luaL_checkudata(L, 1, gPathMetaTableName);
194 push_rect(L, p->getBounds());
195 return 1;
196}
197
198static int lpath_isEmpty(lua_State* L) {
199 SkPath* p = (SkPath*)luaL_checkudata(L, 1, gPathMetaTableName);
200 lua_pushboolean(L, p->isEmpty());
201 return 1;
202}
203
204static int lpath_isRect(lua_State* L) {
205 SkPath* p = (SkPath*)luaL_checkudata(L, 1, gPathMetaTableName);
206 SkRect r;
207 bool pred = p->isRect(&r);
208 int ret_count = 1;
209 lua_pushboolean(L, pred);
210 if (pred) {
211 push_rect(L, r);
212 ret_count += 1;
213 }
214 return ret_count;
215}
216
217static const char* dir2string(SkPath::Direction dir) {
218 static const char* gStr[] = {
219 "unknown", "cw", "ccw"
220 };
221 SkASSERT((unsigned)dir < SK_ARRAY_COUNT(gStr));
222 return gStr[dir];
223}
224
225static int lpath_isNestedRects(lua_State* L) {
226 SkPath* p = (SkPath*)luaL_checkudata(L, 1, gPathMetaTableName);
227 SkRect rects[2];
228 SkPath::Direction dirs[2];
229 bool pred = p->isNestedRects(rects, dirs);
230 int ret_count = 1;
231 lua_pushboolean(L, pred);
232 if (pred) {
233 push_rect(L, rects[0]);
234 push_rect(L, rects[1]);
235 lua_pushstring(L, dir2string(dirs[0]));
236 lua_pushstring(L, dir2string(dirs[0]));
237 ret_count += 4;
238 }
239 return ret_count;
reed@google.com9a731042013-05-21 17:52:33 +0000240}
241
242static int lpath_gc(lua_State* L) {
243 SkPath* p = (SkPath*)luaL_checkudata(L, 1, gPathMetaTableName);
244 p->~SkPath();
245 return 0;
246}
247
248static const struct luaL_Reg gLuaPathMethods[] = {
249 { "getBounds", lpath_getBounds },
250 { "isEmpty", lpath_isEmpty },
251 { "isRect", lpath_isRect },
252 { "isNestedRects", lpath_isNestedRects },
253 { "__gc", lpath_gc },
254 { NULL, NULL }
255};
256
257static void ensure_path_metatable(lua_State* L) {
258 static bool gOnce;
259 if (gOnce) {
260 return;
261 }
262 gOnce = true;
skia.committer@gmail.comb148aca2013-05-22 07:01:13 +0000263
reed@google.com9a731042013-05-21 17:52:33 +0000264 luaL_newmetatable(L, gPathMetaTableName);
265 lua_pushvalue(L, -1);
266 lua_setfield(L, -2, "__index");
skia.committer@gmail.comb148aca2013-05-22 07:01:13 +0000267
reed@google.com9a731042013-05-21 17:52:33 +0000268 luaL_setfuncs(L, gLuaPathMethods, 0);
269 lua_settop(L, -2); // pop off the meta-table
270}
271
272static void push_path(lua_State* L, const SkPath& src) {
273 ensure_path_metatable(L);
skia.committer@gmail.comb148aca2013-05-22 07:01:13 +0000274
reed@google.com9a731042013-05-21 17:52:33 +0000275 SkPath* path = (SkPath*)lua_newuserdata(L, sizeof(SkPath));
276 new (path) SkPath(src);
277
278 luaL_getmetatable(L, gPathMetaTableName);
279 lua_setmetatable(L, -2);
280}
281
282static void setfield_path(lua_State* L, const char key[], const SkPath& path) {
283 push_path(L, path);
284 lua_setfield(L, -2, key);
285}
286
287///////////////////////////////////////////////////////////////////////////////
288
mike@reedtribe.orgf02fe3d2013-05-21 12:20:39 +0000289void SkLuaCanvas::pushThis() {
290 ensure_canvas_metatable(fL);
291
292 SkCanvas** canvasPtr = (SkCanvas**)lua_newuserdata(fL, sizeof(SkCanvas*));
293 luaL_getmetatable(fL, gCanvasMetaTableName);
294 lua_setmetatable(fL, -2);
295
296 this->ref();
297 *canvasPtr = this;
298}
299
300///////////////////////////////////////////////////////////////////////////////
301
reed@google.comdff7e112013-05-15 19:34:20 +0000302static SkBitmap make_bm(int width, int height) {
303 SkBitmap bm;
304 bm.setConfig(SkBitmap::kNo_Config, width, height);
305 return bm;
306}
307
308SkLuaCanvas::SkLuaCanvas(int width, int height, lua_State* L, const char func[])
309 : INHERITED(make_bm(width, height))
310 , fL(L)
311 , fFunc(func) {
312}
313
314SkLuaCanvas::~SkLuaCanvas() {}
315
316int SkLuaCanvas::save(SaveFlags flags) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000317 AUTO_LUA("save");
reed@google.comdff7e112013-05-15 19:34:20 +0000318 return this->INHERITED::save(flags);
319}
320
321int SkLuaCanvas::saveLayer(const SkRect* bounds, const SkPaint* paint,
322 SaveFlags flags) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000323 AUTO_LUA("saveLayer");
324 if (bounds) {
325 setfield_rect(fL, "bounds", *bounds);
326 }
327 if (paint) {
328 setfield_paint(fL, *paint);
329 }
reed@google.comdff7e112013-05-15 19:34:20 +0000330 return this->INHERITED::save(flags);
331}
332
333void SkLuaCanvas::restore() {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000334 AUTO_LUA("restore");
reed@google.comdff7e112013-05-15 19:34:20 +0000335 this->INHERITED::restore();
336}
337
338bool SkLuaCanvas::translate(SkScalar dx, SkScalar dy) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000339 AUTO_LUA("translate");
340 setfield_number(fL, "dx", dx);
341 setfield_number(fL, "dy", dy);
reed@google.comdff7e112013-05-15 19:34:20 +0000342 return this->INHERITED::translate(dx, dy);
343}
344
345bool SkLuaCanvas::scale(SkScalar sx, SkScalar sy) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000346 AUTO_LUA("scale");
347 setfield_number(fL, "sx", sx);
348 setfield_number(fL, "sy", sy);
reed@google.comdff7e112013-05-15 19:34:20 +0000349 return this->INHERITED::scale(sx, sy);
350}
351
352bool SkLuaCanvas::rotate(SkScalar degrees) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000353 AUTO_LUA("rotate");
354 setfield_number(fL, "degrees", degrees);
reed@google.comdff7e112013-05-15 19:34:20 +0000355 return this->INHERITED::rotate(degrees);
356}
357
358bool SkLuaCanvas::skew(SkScalar sx, SkScalar sy) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000359 AUTO_LUA("skew");
360 setfield_number(fL, "sx", sx);
361 setfield_number(fL, "sy", sy);
reed@google.comdff7e112013-05-15 19:34:20 +0000362 return this->INHERITED::skew(sx, sy);
363}
364
365bool SkLuaCanvas::concat(const SkMatrix& matrix) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000366 AUTO_LUA("concat");
reed@google.comdff7e112013-05-15 19:34:20 +0000367 return this->INHERITED::concat(matrix);
368}
369
370void SkLuaCanvas::setMatrix(const SkMatrix& matrix) {
371 this->INHERITED::setMatrix(matrix);
372}
373
374bool SkLuaCanvas::clipRect(const SkRect& r, SkRegion::Op op, bool doAA) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000375 AUTO_LUA("clipRect");
376 setfield_rect(fL, "rect", r);
377 setfield_bool(fL, "aa", doAA);
reed@google.comdff7e112013-05-15 19:34:20 +0000378 return this->INHERITED::clipRect(r, op, doAA);
379}
380
381bool SkLuaCanvas::clipRRect(const SkRRect& rrect, SkRegion::Op op, bool doAA) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000382 AUTO_LUA("clipRRect");
reed@google.com57de5cf2013-05-16 13:51:07 +0000383 setfield_rrect(fL, "rrect", rrect);
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000384 setfield_bool(fL, "aa", doAA);
reed@google.comdff7e112013-05-15 19:34:20 +0000385 return this->INHERITED::clipRRect(rrect, op, doAA);
386}
387
388bool SkLuaCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000389 AUTO_LUA("clipPath");
reed@google.com9a731042013-05-21 17:52:33 +0000390 setfield_path(fL, "path", path);
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000391 setfield_bool(fL, "aa", doAA);
reed@google.comdff7e112013-05-15 19:34:20 +0000392 return this->INHERITED::clipPath(path, op, doAA);
393}
394
395bool SkLuaCanvas::clipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000396 AUTO_LUA("clipRegion");
reed@google.comdff7e112013-05-15 19:34:20 +0000397 return this->INHERITED::clipRegion(deviceRgn, op);
398}
399
400void SkLuaCanvas::drawPaint(const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000401 AUTO_LUA("drawPaint");
402 setfield_paint(fL, paint);
reed@google.comdff7e112013-05-15 19:34:20 +0000403}
404
405void SkLuaCanvas::drawPoints(PointMode mode, size_t count,
406 const SkPoint pts[], const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000407 AUTO_LUA("drawPoints");
408 setfield_paint(fL, paint);
reed@google.comdff7e112013-05-15 19:34:20 +0000409}
410
411void SkLuaCanvas::drawOval(const SkRect& rect, const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000412 AUTO_LUA("drawOval");
reed@google.com57de5cf2013-05-16 13:51:07 +0000413 setfield_rect(fL, "oval", rect);
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000414 setfield_paint(fL, paint);
reed@google.comdff7e112013-05-15 19:34:20 +0000415}
416
417void SkLuaCanvas::drawRect(const SkRect& rect, const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000418 AUTO_LUA("drawRect");
419 setfield_rect(fL, "rect", rect);
420 setfield_paint(fL, paint);
reed@google.comdff7e112013-05-15 19:34:20 +0000421}
422
423void SkLuaCanvas::drawRRect(const SkRRect& rrect, const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000424 AUTO_LUA("drawRRect");
reed@google.com57de5cf2013-05-16 13:51:07 +0000425 setfield_rrect(fL, "rrect", rrect);
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000426 setfield_paint(fL, paint);
reed@google.comdff7e112013-05-15 19:34:20 +0000427}
428
429void SkLuaCanvas::drawPath(const SkPath& path, const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000430 AUTO_LUA("drawPath");
reed@google.com9a731042013-05-21 17:52:33 +0000431 setfield_path(fL, "path", path);
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000432 setfield_paint(fL, paint);
reed@google.comdff7e112013-05-15 19:34:20 +0000433}
434
435void SkLuaCanvas::drawBitmap(const SkBitmap& bitmap, SkScalar x, SkScalar y,
436 const SkPaint* paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000437 AUTO_LUA("drawBitmap");
438 if (paint) {
439 setfield_paint(fL, *paint, kImage_PaintUsage);
440 }
reed@google.comdff7e112013-05-15 19:34:20 +0000441}
442
443void SkLuaCanvas::drawBitmapRectToRect(const SkBitmap& bitmap, const SkRect* src,
444 const SkRect& dst, const SkPaint* paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000445 AUTO_LUA("drawBitmapRectToRect");
446 if (paint) {
447 setfield_paint(fL, *paint, kImage_PaintUsage);
448 }
reed@google.comdff7e112013-05-15 19:34:20 +0000449}
450
451void SkLuaCanvas::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& m,
452 const SkPaint* paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000453 AUTO_LUA("drawBitmapMatrix");
454 if (paint) {
455 setfield_paint(fL, *paint, kImage_PaintUsage);
456 }
reed@google.comdff7e112013-05-15 19:34:20 +0000457}
458
459void SkLuaCanvas::drawSprite(const SkBitmap& bitmap, int x, int y,
460 const SkPaint* paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000461 AUTO_LUA("drawSprite");
462 if (paint) {
463 setfield_paint(fL, *paint, kImage_PaintUsage);
464 }
reed@google.comdff7e112013-05-15 19:34:20 +0000465}
466
467void SkLuaCanvas::drawText(const void* text, size_t byteLength, SkScalar x,
468 SkScalar y, const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000469 AUTO_LUA("drawText");
470 setfield_paint(fL, paint, kText_PaintUsage);
reed@google.comdff7e112013-05-15 19:34:20 +0000471}
472
473void SkLuaCanvas::drawPosText(const void* text, size_t byteLength,
474 const SkPoint pos[], const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000475 AUTO_LUA("drawPosText");
476 setfield_paint(fL, paint, kText_PaintUsage);
reed@google.comdff7e112013-05-15 19:34:20 +0000477}
478
479void SkLuaCanvas::drawPosTextH(const void* text, size_t byteLength,
480 const SkScalar xpos[], SkScalar constY,
481 const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000482 AUTO_LUA("drawPosTextH");
483 setfield_paint(fL, paint, kText_PaintUsage);
reed@google.comdff7e112013-05-15 19:34:20 +0000484}
485
486void SkLuaCanvas::drawTextOnPath(const void* text, size_t byteLength,
487 const SkPath& path, const SkMatrix* matrix,
488 const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000489 AUTO_LUA("drawTextOnPath");
reed@google.com9a731042013-05-21 17:52:33 +0000490 setfield_path(fL, "path", path);
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000491 setfield_paint(fL, paint, kText_PaintUsage);
reed@google.comdff7e112013-05-15 19:34:20 +0000492}
493
494void SkLuaCanvas::drawPicture(SkPicture& picture) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000495 AUTO_LUA("drawPicture");
reed@google.comdff7e112013-05-15 19:34:20 +0000496 // call through so we can see the nested picture ops
497 this->INHERITED::drawPicture(picture);
498}
499
500void SkLuaCanvas::drawVertices(VertexMode vmode, int vertexCount,
501 const SkPoint vertices[], const SkPoint texs[],
502 const SkColor colors[], SkXfermode* xmode,
503 const uint16_t indices[], int indexCount,
504 const SkPaint& paint) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000505 AUTO_LUA("drawVertices");
506 setfield_paint(fL, paint);
reed@google.comdff7e112013-05-15 19:34:20 +0000507}
508
509void SkLuaCanvas::drawData(const void* data, size_t length) {
mike@reedtribe.org1c5a94f2013-05-16 04:20:23 +0000510 AUTO_LUA("drawData");
reed@google.comdff7e112013-05-15 19:34:20 +0000511}