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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « resources/slides.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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 static int lpaint_isDevKernText(lua_State* L) { 799 static int lpaint_isDevKernText(lua_State* L) {
800 lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isDevKernText()); 800 lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isDevKernText());
801 return 1; 801 return 1;
802 } 802 }
803 803
804 static int lpaint_isLCDRenderText(lua_State* L) { 804 static int lpaint_isLCDRenderText(lua_State* L) {
805 lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isLCDRenderText()); 805 lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isLCDRenderText());
806 return 1; 806 return 1;
807 } 807 }
808 808
809 static int lpaint_setLCDRenderText(lua_State* L) {
810 get_obj<SkPaint>(L, 1)->setLCDRenderText(lua2bool(L, 2));
811 return 1;
812 }
813
809 static int lpaint_isEmbeddedBitmapText(lua_State* L) { 814 static int lpaint_isEmbeddedBitmapText(lua_State* L) {
810 lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isEmbeddedBitmapText()); 815 lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isEmbeddedBitmapText());
811 return 1; 816 return 1;
812 } 817 }
813 818
814 static int lpaint_isAutohinted(lua_State* L) { 819 static int lpaint_isAutohinted(lua_State* L) {
815 lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isAutohinted()); 820 lua_pushboolean(L, get_obj<SkPaint>(L, 1)->isAutohinted());
816 return 1; 821 return 1;
817 } 822 }
818 823
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 { "isDither", lpaint_isDither }, 1073 { "isDither", lpaint_isDither },
1069 { "setDither", lpaint_setDither }, 1074 { "setDither", lpaint_setDither },
1070 { "isUnderlineText", lpaint_isUnderlineText }, 1075 { "isUnderlineText", lpaint_isUnderlineText },
1071 { "isStrikeThruText", lpaint_isStrikeThruText }, 1076 { "isStrikeThruText", lpaint_isStrikeThruText },
1072 { "isFakeBoldText", lpaint_isFakeBoldText }, 1077 { "isFakeBoldText", lpaint_isFakeBoldText },
1073 { "isLinearText", lpaint_isLinearText }, 1078 { "isLinearText", lpaint_isLinearText },
1074 { "isSubpixelText", lpaint_isSubpixelText }, 1079 { "isSubpixelText", lpaint_isSubpixelText },
1075 { "setSubpixelText", lpaint_setSubpixelText }, 1080 { "setSubpixelText", lpaint_setSubpixelText },
1076 { "isDevKernText", lpaint_isDevKernText }, 1081 { "isDevKernText", lpaint_isDevKernText },
1077 { "isLCDRenderText", lpaint_isLCDRenderText }, 1082 { "isLCDRenderText", lpaint_isLCDRenderText },
1083 { "setLCDRenderText", lpaint_setLCDRenderText },
1078 { "isEmbeddedBitmapText", lpaint_isEmbeddedBitmapText }, 1084 { "isEmbeddedBitmapText", lpaint_isEmbeddedBitmapText },
1079 { "isAutohinted", lpaint_isAutohinted }, 1085 { "isAutohinted", lpaint_isAutohinted },
1080 { "isVerticalText", lpaint_isVerticalText }, 1086 { "isVerticalText", lpaint_isVerticalText },
1081 { "getAlpha", lpaint_getAlpha }, 1087 { "getAlpha", lpaint_getAlpha },
1082 { "setAlpha", lpaint_setAlpha }, 1088 { "setAlpha", lpaint_setAlpha },
1083 { "getColor", lpaint_getColor }, 1089 { "getColor", lpaint_getColor },
1084 { "setColor", lpaint_setColor }, 1090 { "setColor", lpaint_setColor },
1085 { "getTextSize", lpaint_getTextSize }, 1091 { "getTextSize", lpaint_getTextSize },
1086 { "setTextSize", lpaint_setTextSize }, 1092 { "setTextSize", lpaint_setTextSize },
1087 { "getTextScaleX", lpaint_getTextScaleX }, 1093 { "getTextScaleX", lpaint_getTextScaleX },
(...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after
1724 } 1730 }
1725 1731
1726 static const struct luaL_Reg gSkTextBlob_Methods[] = { 1732 static const struct luaL_Reg gSkTextBlob_Methods[] = {
1727 { "bounds", ltextblob_bounds }, 1733 { "bounds", ltextblob_bounds },
1728 { "__gc", ltextblob_gc }, 1734 { "__gc", ltextblob_gc },
1729 { NULL, NULL } 1735 { NULL, NULL }
1730 }; 1736 };
1731 1737
1732 /////////////////////////////////////////////////////////////////////////////// 1738 ///////////////////////////////////////////////////////////////////////////////
1733 1739
1740 static int ltypeface_getFamilyName(lua_State* L) {
1741 SkString str;
1742 get_ref<SkTypeface>(L, 1)->getFamilyName(&str);
1743 lua_pushstring(L, str.c_str());
1744 return 1;
1745 }
1746
1747 static int ltypeface_getStyle(lua_State* L) {
1748 lua_pushnumber(L, (double)get_ref<SkTypeface>(L, 1)->style());
1749 return 1;
1750 }
1751
1734 static int ltypeface_gc(lua_State* L) { 1752 static int ltypeface_gc(lua_State* L) {
1735 SkSafeUnref(get_ref<SkTypeface>(L, 1)); 1753 SkSafeUnref(get_ref<SkTypeface>(L, 1));
1736 return 0; 1754 return 0;
1737 } 1755 }
1738 1756
1739 static const struct luaL_Reg gSkTypeface_Methods[] = { 1757 static const struct luaL_Reg gSkTypeface_Methods[] = {
1758 { "getFamilyName", ltypeface_getFamilyName },
1759 { "getStyle", ltypeface_getStyle },
1740 { "__gc", ltypeface_gc }, 1760 { "__gc", ltypeface_gc },
1741 { NULL, NULL } 1761 { NULL, NULL }
1742 }; 1762 };
1743 1763
1744 /////////////////////////////////////////////////////////////////////////////// 1764 ///////////////////////////////////////////////////////////////////////////////
1745 1765
1746 class AutoCallLua { 1766 class AutoCallLua {
1747 public: 1767 public:
1748 AutoCallLua(lua_State* L, const char func[], const char verb[]) : fL(L) { 1768 AutoCallLua(lua_State* L, const char func[], const char verb[]) : fL(L) {
1749 lua_getglobal(L, func); 1769 lua_getglobal(L, func);
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1962 REG_CLASS(L, SkSurface); 1982 REG_CLASS(L, SkSurface);
1963 REG_CLASS(L, SkTextBlob); 1983 REG_CLASS(L, SkTextBlob);
1964 REG_CLASS(L, SkTypeface); 1984 REG_CLASS(L, SkTypeface);
1965 } 1985 }
1966 1986
1967 extern "C" int luaopen_skia(lua_State* L); 1987 extern "C" int luaopen_skia(lua_State* L);
1968 extern "C" int luaopen_skia(lua_State* L) { 1988 extern "C" int luaopen_skia(lua_State* L) {
1969 SkLua::Load(L); 1989 SkLua::Load(L);
1970 return 0; 1990 return 0;
1971 } 1991 }
OLDNEW
« 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