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 1806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1817 SkCanvas* canvas = get_obj<SkPictureRecorder>(L, 1)->getRecordingCanvas(); | 1817 SkCanvas* canvas = get_obj<SkPictureRecorder>(L, 1)->getRecordingCanvas(); |
1818 if (nullptr == canvas) { | 1818 if (nullptr == canvas) { |
1819 lua_pushnil(L); | 1819 lua_pushnil(L); |
1820 return 1; | 1820 return 1; |
1821 } | 1821 } |
1822 push_ref(L, canvas); | 1822 push_ref(L, canvas); |
1823 return 1; | 1823 return 1; |
1824 } | 1824 } |
1825 | 1825 |
1826 static int lpicturerecorder_endRecording(lua_State* L) { | 1826 static int lpicturerecorder_endRecording(lua_State* L) { |
1827 SkPicture* pic = get_obj<SkPictureRecorder>(L, 1)->endRecording(); | 1827 sk_sp<SkPicture> pic = get_obj<SkPictureRecorder>(L, 1)->finishRecordingAsPi
cture(); |
1828 if (nullptr == pic) { | 1828 if (!pic) { |
1829 lua_pushnil(L); | 1829 lua_pushnil(L); |
1830 return 1; | 1830 return 1; |
1831 } | 1831 } |
1832 push_ref(L, pic)->unref(); | 1832 push_ref(L, std::move(pic)); |
1833 return 1; | 1833 return 1; |
1834 } | 1834 } |
1835 | 1835 |
1836 static int lpicturerecorder_gc(lua_State* L) { | 1836 static int lpicturerecorder_gc(lua_State* L) { |
1837 get_obj<SkPictureRecorder>(L, 1)->~SkPictureRecorder(); | 1837 get_obj<SkPictureRecorder>(L, 1)->~SkPictureRecorder(); |
1838 return 0; | 1838 return 0; |
1839 } | 1839 } |
1840 | 1840 |
1841 static const struct luaL_Reg gSkPictureRecorder_Methods[] = { | 1841 static const struct luaL_Reg gSkPictureRecorder_Methods[] = { |
1842 { "beginRecording", lpicturerecorder_beginRecording }, | 1842 { "beginRecording", lpicturerecorder_beginRecording }, |
(...skipping 293 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 |