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

Side by Side Diff: src/utils/SkLua.cpp

Issue 19091006: add more stats to the bitmap matrix locator (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 months 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/lua/bitmap_statistics.lua » ('j') | 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 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 SkMatrix::TypeMask mask = get_obj<SkMatrix>(L, 1)->getType(); 657 SkMatrix::TypeMask mask = get_obj<SkMatrix>(L, 1)->getType();
658 658
659 lua_newtable(L); 659 lua_newtable(L);
660 setfield_boolean(L, "translate", SkToBool(mask & SkMatrix::kTranslate_Mask )); 660 setfield_boolean(L, "translate", SkToBool(mask & SkMatrix::kTranslate_Mask ));
661 setfield_boolean(L, "scale", SkToBool(mask & SkMatrix::kScale_Mask)); 661 setfield_boolean(L, "scale", SkToBool(mask & SkMatrix::kScale_Mask));
662 setfield_boolean(L, "affine", SkToBool(mask & SkMatrix::kAffine_Mask)); 662 setfield_boolean(L, "affine", SkToBool(mask & SkMatrix::kAffine_Mask));
663 setfield_boolean(L, "perspective", SkToBool(mask & SkMatrix::kPerspective_Ma sk)); 663 setfield_boolean(L, "perspective", SkToBool(mask & SkMatrix::kPerspective_Ma sk));
664 return 1; 664 return 1;
665 } 665 }
666 666
667 static int lmatrix_getScaleX(lua_State* L) {
668 lua_pushnumber(L, get_obj<SkMatrix>(L,1)->getScaleX());
669 return 1;
670 }
671
672 static int lmatrix_getScaleY(lua_State* L) {
673 lua_pushnumber(L, get_obj<SkMatrix>(L,1)->getScaleY());
674 return 1;
675 }
676
677 static int lmatrix_getTranslateX(lua_State* L) {
678 lua_pushnumber(L, get_obj<SkMatrix>(L,1)->getTranslateX());
679 return 1;
680 }
681
682 static int lmatrix_getTranslateY(lua_State* L) {
683 lua_pushnumber(L, get_obj<SkMatrix>(L,1)->getTranslateY());
684 return 1;
685 }
686
667 static const struct luaL_Reg gSkMatrix_Methods[] = { 687 static const struct luaL_Reg gSkMatrix_Methods[] = {
668 { "getType", lmatrix_getType }, 688 { "getType", lmatrix_getType },
689 { "getScaleX", lmatrix_getScaleX },
690 { "getScaleY", lmatrix_getScaleY },
691 { "getTranslateX", lmatrix_getTranslateX },
692 { "getTranslateY", lmatrix_getTranslateY },
669 { NULL, NULL } 693 { NULL, NULL }
670 }; 694 };
671 695
672 /////////////////////////////////////////////////////////////////////////////// 696 ///////////////////////////////////////////////////////////////////////////////
673 697
674 static int lpath_getBounds(lua_State* L) { 698 static int lpath_getBounds(lua_State* L) {
675 SkLua(L).pushRect(get_obj<SkPath>(L, 1)->getBounds()); 699 SkLua(L).pushRect(get_obj<SkPath>(L, 1)->getBounds());
676 return 1; 700 return 1;
677 } 701 }
678 702
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
995 REG_CLASS(L, SkRRect); 1019 REG_CLASS(L, SkRRect);
996 REG_CLASS(L, SkTypeface); 1020 REG_CLASS(L, SkTypeface);
997 REG_CLASS(L, SkMatrix); 1021 REG_CLASS(L, SkMatrix);
998 } 1022 }
999 1023
1000 extern "C" int luaopen_skia(lua_State* L); 1024 extern "C" int luaopen_skia(lua_State* L);
1001 extern "C" int luaopen_skia(lua_State* L) { 1025 extern "C" int luaopen_skia(lua_State* L) {
1002 SkLua::Load(L); 1026 SkLua::Load(L);
1003 return 0; 1027 return 0;
1004 } 1028 }
OLDNEW
« no previous file with comments | « no previous file | tools/lua/bitmap_statistics.lua » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698