OLD | NEW |
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 "SkLua.h" | 8 #include "SkLua.h" |
9 | 9 |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 1477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1488 } | 1488 } |
1489 | 1489 |
1490 static const char* dir2string(SkPath::Direction dir) { | 1490 static const char* dir2string(SkPath::Direction dir) { |
1491 static const char* gStr[] = { | 1491 static const char* gStr[] = { |
1492 "unknown", "cw", "ccw" | 1492 "unknown", "cw", "ccw" |
1493 }; | 1493 }; |
1494 SkASSERT((unsigned)dir < SK_ARRAY_COUNT(gStr)); | 1494 SkASSERT((unsigned)dir < SK_ARRAY_COUNT(gStr)); |
1495 return gStr[dir]; | 1495 return gStr[dir]; |
1496 } | 1496 } |
1497 | 1497 |
1498 static int lpath_isNestedRects(lua_State* L) { | 1498 static int lpath_isNestedFillRects(lua_State* L) { |
1499 SkRect rects[2]; | 1499 SkRect rects[2]; |
1500 SkPath::Direction dirs[2]; | 1500 SkPath::Direction dirs[2]; |
1501 bool pred = get_obj<SkPath>(L, 1)->isNestedRects(rects, dirs); | 1501 bool pred = get_obj<SkPath>(L, 1)->isNestedFillRects(rects, dirs); |
1502 int ret_count = 1; | 1502 int ret_count = 1; |
1503 lua_pushboolean(L, pred); | 1503 lua_pushboolean(L, pred); |
1504 if (pred) { | 1504 if (pred) { |
1505 SkLua lua(L); | 1505 SkLua lua(L); |
1506 lua.pushRect(rects[0]); | 1506 lua.pushRect(rects[0]); |
1507 lua.pushRect(rects[1]); | 1507 lua.pushRect(rects[1]); |
1508 lua_pushstring(L, dir2string(dirs[0])); | 1508 lua_pushstring(L, dir2string(dirs[0])); |
1509 lua_pushstring(L, dir2string(dirs[0])); | 1509 lua_pushstring(L, dir2string(dirs[0])); |
1510 ret_count += 4; | 1510 ret_count += 4; |
1511 } | 1511 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1555 return 0; | 1555 return 0; |
1556 } | 1556 } |
1557 | 1557 |
1558 static const struct luaL_Reg gSkPath_Methods[] = { | 1558 static const struct luaL_Reg gSkPath_Methods[] = { |
1559 { "getBounds", lpath_getBounds }, | 1559 { "getBounds", lpath_getBounds }, |
1560 { "getFillType", lpath_getFillType }, | 1560 { "getFillType", lpath_getFillType }, |
1561 { "getSegmentTypes", lpath_getSegmentTypes }, | 1561 { "getSegmentTypes", lpath_getSegmentTypes }, |
1562 { "isConvex", lpath_isConvex }, | 1562 { "isConvex", lpath_isConvex }, |
1563 { "isEmpty", lpath_isEmpty }, | 1563 { "isEmpty", lpath_isEmpty }, |
1564 { "isRect", lpath_isRect }, | 1564 { "isRect", lpath_isRect }, |
1565 { "isNestedRects", lpath_isNestedRects }, | 1565 { "isNestedFillRects", lpath_isNestedFillRects }, |
1566 { "countPoints", lpath_countPoints }, | 1566 { "countPoints", lpath_countPoints }, |
1567 { "reset", lpath_reset }, | 1567 { "reset", lpath_reset }, |
1568 { "moveTo", lpath_moveTo }, | 1568 { "moveTo", lpath_moveTo }, |
1569 { "lineTo", lpath_lineTo }, | 1569 { "lineTo", lpath_lineTo }, |
1570 { "quadTo", lpath_quadTo }, | 1570 { "quadTo", lpath_quadTo }, |
1571 { "cubicTo", lpath_cubicTo }, | 1571 { "cubicTo", lpath_cubicTo }, |
1572 { "close", lpath_close }, | 1572 { "close", lpath_close }, |
1573 { "__gc", lpath_gc }, | 1573 { "__gc", lpath_gc }, |
1574 { NULL, NULL } | 1574 { NULL, NULL } |
1575 }; | 1575 }; |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2064 REG_CLASS(L, SkSurface); | 2064 REG_CLASS(L, SkSurface); |
2065 REG_CLASS(L, SkTextBlob); | 2065 REG_CLASS(L, SkTextBlob); |
2066 REG_CLASS(L, SkTypeface); | 2066 REG_CLASS(L, SkTypeface); |
2067 } | 2067 } |
2068 | 2068 |
2069 extern "C" int luaopen_skia(lua_State* L); | 2069 extern "C" int luaopen_skia(lua_State* L); |
2070 extern "C" int luaopen_skia(lua_State* L) { | 2070 extern "C" int luaopen_skia(lua_State* L) { |
2071 SkLua::Load(L); | 2071 SkLua::Load(L); |
2072 return 0; | 2072 return 0; |
2073 } | 2073 } |
OLD | NEW |