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

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

Issue 679903002: add saveLayer to lua (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « resources/slides_utils.lua ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 597 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 #else 608 #else
609 return 0; 609 return 0;
610 #endif 610 #endif
611 } 611 }
612 612
613 static int lcanvas_save(lua_State* L) { 613 static int lcanvas_save(lua_State* L) {
614 lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->save()); 614 lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->save());
615 return 1; 615 return 1;
616 } 616 }
617 617
618 static int lcanvas_saveLayer(lua_State* L) {
619 SkPaint paint;
620 lua_pushinteger(L, get_ref<SkCanvas>(L, 1)->saveLayer(NULL, lua2OptionalPain t(L, 2, &paint)));
621 return 1;
622 }
623
618 static int lcanvas_restore(lua_State* L) { 624 static int lcanvas_restore(lua_State* L) {
619 get_ref<SkCanvas>(L, 1)->restore(); 625 get_ref<SkCanvas>(L, 1)->restore();
620 return 0; 626 return 0;
621 } 627 }
622 628
623 static int lcanvas_scale(lua_State* L) { 629 static int lcanvas_scale(lua_State* L) {
624 SkScalar sx = lua2scalar_def(L, 2, 1); 630 SkScalar sx = lua2scalar_def(L, 2, 1);
625 SkScalar sy = lua2scalar_def(L, 3, sx); 631 SkScalar sy = lua2scalar_def(L, 3, sx);
626 get_ref<SkCanvas>(L, 1)->scale(sx, sy); 632 get_ref<SkCanvas>(L, 1)->scale(sx, sy);
627 return 0; 633 return 0;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
675 { "drawPath", lcanvas_drawPath }, 681 { "drawPath", lcanvas_drawPath },
676 { "drawPicture", lcanvas_drawPicture }, 682 { "drawPicture", lcanvas_drawPicture },
677 { "drawText", lcanvas_drawText }, 683 { "drawText", lcanvas_drawText },
678 { "getSaveCount", lcanvas_getSaveCount }, 684 { "getSaveCount", lcanvas_getSaveCount },
679 { "getTotalMatrix", lcanvas_getTotalMatrix }, 685 { "getTotalMatrix", lcanvas_getTotalMatrix },
680 { "getClipStack", lcanvas_getClipStack }, 686 { "getClipStack", lcanvas_getClipStack },
681 #if SK_SUPPORT_GPU 687 #if SK_SUPPORT_GPU
682 { "getReducedClipStack", SkLua::lcanvas_getReducedClipStack }, 688 { "getReducedClipStack", SkLua::lcanvas_getReducedClipStack },
683 #endif 689 #endif
684 { "save", lcanvas_save }, 690 { "save", lcanvas_save },
691 { "saveLayer", lcanvas_saveLayer },
685 { "restore", lcanvas_restore }, 692 { "restore", lcanvas_restore },
686 { "scale", lcanvas_scale }, 693 { "scale", lcanvas_scale },
687 { "translate", lcanvas_translate }, 694 { "translate", lcanvas_translate },
688 { "rotate", lcanvas_rotate }, 695 { "rotate", lcanvas_rotate },
689 { "concat", lcanvas_concat }, 696 { "concat", lcanvas_concat },
690 697
691 { "newSurface", lcanvas_newSurface }, 698 { "newSurface", lcanvas_newSurface },
692 699
693 { "__gc", lcanvas_gc }, 700 { "__gc", lcanvas_gc },
694 { NULL, NULL } 701 { NULL, NULL }
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 REG_CLASS(L, SkSurface); 1906 REG_CLASS(L, SkSurface);
1900 REG_CLASS(L, SkTypeface); 1907 REG_CLASS(L, SkTypeface);
1901 REG_CLASS(L, SkMatrix); 1908 REG_CLASS(L, SkMatrix);
1902 } 1909 }
1903 1910
1904 extern "C" int luaopen_skia(lua_State* L); 1911 extern "C" int luaopen_skia(lua_State* L);
1905 extern "C" int luaopen_skia(lua_State* L) { 1912 extern "C" int luaopen_skia(lua_State* L) {
1906 SkLua::Load(L); 1913 SkLua::Load(L);
1907 return 0; 1914 return 0;
1908 } 1915 }
OLDNEW
« no previous file with comments | « resources/slides_utils.lua ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698