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

Unified Diff: src/utils/SkLua.cpp

Issue 697053004: add more typeface methods 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « resources/slides.lua ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkLua.cpp
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 7491086a85ed569368477c070d08c702c478d2d3..967233d21b379ebfd3437d1a1c7dcbae52ff02df 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -806,6 +806,11 @@ static int lpaint_isLCDRenderText(lua_State* L) {
return 1;
}
+static int lpaint_setLCDRenderText(lua_State* L) {
+ get_obj<SkPaint>(L, 1)->setLCDRenderText(lua2bool(L, 2));
+ return 1;
+}
+
static int lpaint_isEmbeddedBitmapText(lua_State* L) {
lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isEmbeddedBitmapText());
return 1;
@@ -1075,6 +1080,7 @@ static const struct luaL_Reg gSkPaint_Methods[] = {
{ "setSubpixelText", lpaint_setSubpixelText },
{ "isDevKernText", lpaint_isDevKernText },
{ "isLCDRenderText", lpaint_isLCDRenderText },
+ { "setLCDRenderText", lpaint_setLCDRenderText },
{ "isEmbeddedBitmapText", lpaint_isEmbeddedBitmapText },
{ "isAutohinted", lpaint_isAutohinted },
{ "isVerticalText", lpaint_isVerticalText },
@@ -1731,12 +1737,26 @@ static const struct luaL_Reg gSkTextBlob_Methods[] = {
///////////////////////////////////////////////////////////////////////////////
+static int ltypeface_getFamilyName(lua_State* L) {
+ SkString str;
+ get_ref<SkTypeface>(L, 1)->getFamilyName(&str);
+ lua_pushstring(L, str.c_str());
+ return 1;
+}
+
+static int ltypeface_getStyle(lua_State* L) {
+ lua_pushnumber(L, (double)get_ref<SkTypeface>(L, 1)->style());
+ return 1;
+}
+
static int ltypeface_gc(lua_State* L) {
SkSafeUnref(get_ref<SkTypeface>(L, 1));
return 0;
}
static const struct luaL_Reg gSkTypeface_Methods[] = {
+ { "getFamilyName", ltypeface_getFamilyName },
+ { "getStyle", ltypeface_getStyle },
{ "__gc", ltypeface_gc },
{ NULL, NULL }
};
« no previous file with comments | « resources/slides.lua ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698