Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: src/utils/SkLua.cpp

Issue 2222873002: Encapsulate GrReducedClip result in class members (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW
« include/gpu/GrClip.h ('K') | « src/gpu/GrReducedClip.cpp ('k') | tests/ClipStackTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698