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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 return "replace"; | 310 return "replace"; |
311 } | 311 } |
312 return "unknown"; | 312 return "unknown"; |
313 } | 313 } |
314 | 314 |
315 void SkLua::pushClipStack(const SkClipStack& stack, const char* key) { | 315 void SkLua::pushClipStack(const SkClipStack& stack, const char* key) { |
316 lua_newtable(fL); | 316 lua_newtable(fL); |
317 SkClipStack::B2TIter iter(stack); | 317 SkClipStack::B2TIter iter(stack); |
318 const SkClipStack::Element* element; | 318 const SkClipStack::Element* element; |
319 int i = 0; | 319 int i = 0; |
320 while (NULL != (element = iter.next())) { | 320 while ((element = iter.next())) { |
321 this->pushClipStackElement(*element); | 321 this->pushClipStackElement(*element); |
322 lua_rawseti(fL, -2, ++i); | 322 lua_rawseti(fL, -2, ++i); |
323 } | 323 } |
324 CHECK_SETFIELD(key); | 324 CHECK_SETFIELD(key); |
325 } | 325 } |
326 | 326 |
327 void SkLua::pushClipStackElement(const SkClipStack::Element& element, const char
* key) { | 327 void SkLua::pushClipStackElement(const SkClipStack::Element& element, const char
* key) { |
328 lua_newtable(fL); | 328 lua_newtable(fL); |
329 SkClipStack::Element::Type type = element.getType(); | 329 SkClipStack::Element::Type type = element.getType(); |
330 this->pushString(element_type(type), "type"); | 330 this->pushString(element_type(type), "type"); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 queryBounds, | 514 queryBounds, |
515 &elements, | 515 &elements, |
516 &genID, | 516 &genID, |
517 &initialState, | 517 &initialState, |
518 &resultBounds, | 518 &resultBounds, |
519 NULL); | 519 NULL); |
520 | 520 |
521 GrReducedClip::ElementList::Iter iter(elements); | 521 GrReducedClip::ElementList::Iter iter(elements); |
522 int i = 0; | 522 int i = 0; |
523 lua_newtable(L); | 523 lua_newtable(L); |
524 while(NULL != iter.get()) { | 524 while(iter.get()) { |
525 SkLua(L).pushClipStackElement(*iter.get()); | 525 SkLua(L).pushClipStackElement(*iter.get()); |
526 iter.next(); | 526 iter.next(); |
527 lua_rawseti(L, -2, ++i); | 527 lua_rawseti(L, -2, ++i); |
528 } | 528 } |
529 // Currently this only returns the element list to lua, not the initial stat
e or result bounds. | 529 // Currently this only returns the element list to lua, not the initial stat
e or result bounds. |
530 // It could return these as additional items on the lua stack. | 530 // It could return these as additional items on the lua stack. |
531 return 1; | 531 return 1; |
532 #else | 532 #else |
533 return 0; | 533 return 0; |
534 #endif | 534 #endif |
(...skipping 972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 REG_CLASS(L, SkShader); | 1507 REG_CLASS(L, SkShader); |
1508 REG_CLASS(L, SkTypeface); | 1508 REG_CLASS(L, SkTypeface); |
1509 REG_CLASS(L, SkMatrix); | 1509 REG_CLASS(L, SkMatrix); |
1510 } | 1510 } |
1511 | 1511 |
1512 extern "C" int luaopen_skia(lua_State* L); | 1512 extern "C" int luaopen_skia(lua_State* L); |
1513 extern "C" int luaopen_skia(lua_State* L) { | 1513 extern "C" int luaopen_skia(lua_State* L) { |
1514 SkLua::Load(L); | 1514 SkLua::Load(L); |
1515 return 0; | 1515 return 0; |
1516 } | 1516 } |
OLD | NEW |