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 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
634 SkLua(L).pushClipStack(*get_ref<SkCanvas>(L, 1)->getClipStack()); | 634 SkLua(L).pushClipStack(*get_ref<SkCanvas>(L, 1)->getClipStack()); |
635 return 1; | 635 return 1; |
636 } | 636 } |
637 | 637 |
638 int SkLua::lcanvas_getReducedClipStack(lua_State* L) { | 638 int SkLua::lcanvas_getReducedClipStack(lua_State* L) { |
639 #if SK_SUPPORT_GPU | 639 #if SK_SUPPORT_GPU |
640 const SkCanvas* canvas = get_ref<SkCanvas>(L, 1); | 640 const SkCanvas* canvas = get_ref<SkCanvas>(L, 1); |
641 SkIRect queryBounds = canvas->getTopLayerBounds(); | 641 SkIRect queryBounds = canvas->getTopLayerBounds(); |
642 | 642 |
643 GrReducedClip::ElementList elements; | 643 GrReducedClip::ElementList elements; |
644 GrReducedClip::InitialState initialState; | |
645 int32_t genID; | 644 int32_t genID; |
646 SkIRect resultBounds; | 645 SkIRect resultBounds; |
646 bool requiresAA; | |
647 | 647 |
648 const SkClipStack& stack = *canvas->getClipStack(); | 648 const SkClipStack& stack = *canvas->getClipStack(); |
649 | 649 |
650 GrReducedClip::ReduceClipStack(stack, | 650 GrReducedClip::InitialState initialState SK_UNUSED = |
651 queryBounds, | 651 GrReducedClip::ReduceClipStack(stack, |
652 &elements, | 652 SkRect::Make(queryBounds), |
653 &genID, | 653 &elements, |
654 &initialState, | 654 &genID, |
655 &resultBounds, | 655 &resultBounds, |
656 nullptr); | 656 &requiresAA); |
657 | 657 |
658 GrReducedClip::ElementList::Iter iter(elements); | 658 GrReducedClip::ElementList::Iter iter(elements); |
659 int i = 0; | 659 int i = 0; |
660 lua_newtable(L); | 660 lua_newtable(L); |
661 while(iter.get()) { | 661 while(iter.get()) { |
662 SkLua(L).pushClipStackElement(*iter.get()); | 662 SkLua(L).pushClipStackElement(*iter.get()); |
663 iter.next(); | 663 iter.next(); |
664 lua_rawseti(L, -2, ++i); | 664 lua_rawseti(L, -2, ++i); |
665 } | 665 } |
666 // Currently this only returns the element list to lua, not the initial stat e or result bounds. | 666 // Currently this only returns the element list to lua, not the initial stat e or result bounds. |
667 // It could return these as additional items on the lua stack. | 667 // It absolutely must return these as additional items on the lua stack in o rder to be correct. |
bsalomon
2016/07/19 13:33:12
This was used to gather information about multi-el
csmartdalton
2016/07/19 15:59:01
Done.
| |
668 return 1; | 668 return 1; |
669 #else | 669 #else |
670 return 0; | 670 return 0; |
671 #endif | 671 #endif |
672 } | 672 } |
673 | 673 |
674 static int lcanvas_save(lua_State* L) { | 674 static int lcanvas_save(lua_State* L) { |
675 lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->save()); | 675 lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->save()); |
676 return 1; | 676 return 1; |
677 } | 677 } |
(...skipping 1458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2136 REG_CLASS(L, SkTextBlob); | 2136 REG_CLASS(L, SkTextBlob); |
2137 REG_CLASS(L, SkTypeface); | 2137 REG_CLASS(L, SkTypeface); |
2138 REG_CLASS(L, SkXfermode); | 2138 REG_CLASS(L, SkXfermode); |
2139 } | 2139 } |
2140 | 2140 |
2141 extern "C" int luaopen_skia(lua_State* L); | 2141 extern "C" int luaopen_skia(lua_State* L); |
2142 extern "C" int luaopen_skia(lua_State* L) { | 2142 extern "C" int luaopen_skia(lua_State* L) { |
2143 SkLua::Load(L); | 2143 SkLua::Load(L); |
2144 return 0; | 2144 return 0; |
2145 } | 2145 } |
OLD | NEW |