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 1932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1943 #define AUTO_LUA(verb) AutoCallLua acl(fL, fFunc.c_str(), verb) | 1943 #define AUTO_LUA(verb) AutoCallLua acl(fL, fFunc.c_str(), verb) |
1944 | 1944 |
1945 /////////////////////////////////////////////////////////////////////////////// | 1945 /////////////////////////////////////////////////////////////////////////////// |
1946 | 1946 |
1947 static int lsk_newDocumentPDF(lua_State* L) { | 1947 static int lsk_newDocumentPDF(lua_State* L) { |
1948 const char* file = nullptr; | 1948 const char* file = nullptr; |
1949 if (lua_gettop(L) > 0 && lua_isstring(L, 1)) { | 1949 if (lua_gettop(L) > 0 && lua_isstring(L, 1)) { |
1950 file = lua_tolstring(L, 1, nullptr); | 1950 file = lua_tolstring(L, 1, nullptr); |
1951 } | 1951 } |
1952 | 1952 |
1953 SkDocument* doc = SkDocument::CreatePDF(file); | 1953 sk_sp<SkDocument> doc = SkDocument::MakePDF(file); |
1954 if (nullptr == doc) { | 1954 if (nullptr == doc) { |
1955 // do I need to push a nil on the stack and return 1? | 1955 // do I need to push a nil on the stack and return 1? |
1956 return 0; | 1956 return 0; |
1957 } else { | 1957 } else { |
1958 push_ref(L, doc)->unref(); | 1958 push_ref(L, std::move(doc)); |
1959 return 1; | 1959 return 1; |
1960 } | 1960 } |
1961 } | 1961 } |
1962 | 1962 |
1963 static int lsk_newBlurImageFilter(lua_State* L) { | 1963 static int lsk_newBlurImageFilter(lua_State* L) { |
1964 SkScalar sigmaX = lua2scalar_def(L, 1, 0); | 1964 SkScalar sigmaX = lua2scalar_def(L, 1, 0); |
1965 SkScalar sigmaY = lua2scalar_def(L, 2, 0); | 1965 SkScalar sigmaY = lua2scalar_def(L, 2, 0); |
1966 sk_sp<SkImageFilter> imf(SkBlurImageFilter::Make(sigmaX, sigmaY, nullptr)); | 1966 sk_sp<SkImageFilter> imf(SkBlurImageFilter::Make(sigmaX, sigmaY, nullptr)); |
1967 if (!imf) { | 1967 if (!imf) { |
1968 lua_pushnil(L); | 1968 lua_pushnil(L); |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2137 REG_CLASS(L, SkTextBlob); | 2137 REG_CLASS(L, SkTextBlob); |
2138 REG_CLASS(L, SkTypeface); | 2138 REG_CLASS(L, SkTypeface); |
2139 REG_CLASS(L, SkXfermode); | 2139 REG_CLASS(L, SkXfermode); |
2140 } | 2140 } |
2141 | 2141 |
2142 extern "C" int luaopen_skia(lua_State* L); | 2142 extern "C" int luaopen_skia(lua_State* L); |
2143 extern "C" int luaopen_skia(lua_State* L) { | 2143 extern "C" int luaopen_skia(lua_State* L) { |
2144 SkLua::Load(L); | 2144 SkLua::Load(L); |
2145 return 0; | 2145 return 0; |
2146 } | 2146 } |
OLD | NEW |