| 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 637 |
| 638 static int lcanvas_getClipStack(lua_State* L) { | 638 static int lcanvas_getClipStack(lua_State* L) { |
| 639 SkLua(L).pushClipStack(*get_ref<SkCanvas>(L, 1)->getClipStack()); | 639 SkLua(L).pushClipStack(*get_ref<SkCanvas>(L, 1)->getClipStack()); |
| 640 return 1; | 640 return 1; |
| 641 } | 641 } |
| 642 | 642 |
| 643 int SkLua::lcanvas_getReducedClipStack(lua_State* L) { | 643 int SkLua::lcanvas_getReducedClipStack(lua_State* L) { |
| 644 #if SK_SUPPORT_GPU | 644 #if SK_SUPPORT_GPU |
| 645 const SkCanvas* canvas = get_ref<SkCanvas>(L, 1); | 645 const SkCanvas* canvas = get_ref<SkCanvas>(L, 1); |
| 646 SkRect queryBounds = SkRect::Make(canvas->getTopLayerBounds()); | 646 SkRect queryBounds = SkRect::Make(canvas->getTopLayerBounds()); |
| 647 const GrReducedClip reducedClip(*canvas->getClipStack(), queryBounds); |
| 647 | 648 |
| 648 GrReducedClip::ElementList elements; | 649 GrReducedClip::ElementList::Iter iter(reducedClip.elements()); |
| 649 int32_t genID; | |
| 650 SkIRect resultBounds; | |
| 651 bool requiresAA; | |
| 652 | |
| 653 const SkClipStack& stack = *canvas->getClipStack(); | |
| 654 | |
| 655 GrReducedClip::ReduceClipStack(stack, | |
| 656 queryBounds, | |
| 657 &elements, | |
| 658 &genID, | |
| 659 &resultBounds, | |
| 660 &requiresAA); | |
| 661 | |
| 662 GrReducedClip::ElementList::Iter iter(elements); | |
| 663 int i = 0; | 650 int i = 0; |
| 664 lua_newtable(L); | 651 lua_newtable(L); |
| 665 while(iter.get()) { | 652 while(iter.get()) { |
| 666 SkLua(L).pushClipStackElement(*iter.get()); | 653 SkLua(L).pushClipStackElement(*iter.get()); |
| 667 iter.next(); | 654 iter.next(); |
| 668 lua_rawseti(L, -2, ++i); | 655 lua_rawseti(L, -2, ++i); |
| 669 } | 656 } |
| 670 // Currently this only returns the element list to lua, not the initial stat
e or result bounds. | 657 // Currently this only returns the element list to lua, not the initial stat
e or result bounds. |
| 671 // It could return these as additional items on the lua stack. | 658 // It could return these as additional items on the lua stack. |
| 672 return 1; | 659 return 1; |
| (...skipping 1521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2194 REG_CLASS(L, SkTextBlob); | 2181 REG_CLASS(L, SkTextBlob); |
| 2195 REG_CLASS(L, SkTypeface); | 2182 REG_CLASS(L, SkTypeface); |
| 2196 REG_CLASS(L, SkXfermode); | 2183 REG_CLASS(L, SkXfermode); |
| 2197 } | 2184 } |
| 2198 | 2185 |
| 2199 extern "C" int luaopen_skia(lua_State* L); | 2186 extern "C" int luaopen_skia(lua_State* L); |
| 2200 extern "C" int luaopen_skia(lua_State* L) { | 2187 extern "C" int luaopen_skia(lua_State* L) { |
| 2201 SkLua::Load(L); | 2188 SkLua::Load(L); |
| 2202 return 0; | 2189 return 0; |
| 2203 } | 2190 } |
| OLD | NEW |