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 1888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1899 (SkTypeface::Style)style); | 1899 (SkTypeface::Style)style); |
1900 // SkDebugf("---- name <%s> style=%d, face=%p ref=%d\n", name, style, face, f
ace->getRefCnt()); | 1900 // SkDebugf("---- name <%s> style=%d, face=%p ref=%d\n", name, style, face, f
ace->getRefCnt()); |
1901 if (NULL == face) { | 1901 if (NULL == face) { |
1902 face = SkTypeface::RefDefault(); | 1902 face = SkTypeface::RefDefault(); |
1903 } | 1903 } |
1904 push_ref(L, face)->unref(); | 1904 push_ref(L, face)->unref(); |
1905 return 1; | 1905 return 1; |
1906 } | 1906 } |
1907 | 1907 |
1908 static int lsk_newRasterSurface(lua_State* L) { | 1908 static int lsk_newRasterSurface(lua_State* L) { |
1909 int width = lua2int_def(L, 2, 0); | 1909 int width = lua2int_def(L, 1, 0); |
1910 int height = lua2int_def(L, 2, 0); | 1910 int height = lua2int_def(L, 2, 0); |
1911 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); | 1911 SkImageInfo info = SkImageInfo::MakeN32Premul(width, height); |
1912 SkSurface* surface = SkSurface::NewRaster(info); | 1912 SkSurface* surface = SkSurface::NewRaster(info); |
1913 if (NULL == surface) { | 1913 if (NULL == surface) { |
1914 lua_pushnil(L); | 1914 lua_pushnil(L); |
1915 } else { | 1915 } else { |
1916 push_ref(L, surface)->unref(); | 1916 push_ref(L, surface)->unref(); |
1917 } | 1917 } |
1918 return 1; | 1918 return 1; |
1919 } | 1919 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1982 REG_CLASS(L, SkSurface); | 1982 REG_CLASS(L, SkSurface); |
1983 REG_CLASS(L, SkTextBlob); | 1983 REG_CLASS(L, SkTextBlob); |
1984 REG_CLASS(L, SkTypeface); | 1984 REG_CLASS(L, SkTypeface); |
1985 } | 1985 } |
1986 | 1986 |
1987 extern "C" int luaopen_skia(lua_State* L); | 1987 extern "C" int luaopen_skia(lua_State* L); |
1988 extern "C" int luaopen_skia(lua_State* L) { | 1988 extern "C" int luaopen_skia(lua_State* L) { |
1989 SkLua::Load(L); | 1989 SkLua::Load(L); |
1990 return 0; | 1990 return 0; |
1991 } | 1991 } |
OLD | NEW |