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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 } | 449 } |
450 SkScalar x = lua2scalar(L, 3); | 450 SkScalar x = lua2scalar(L, 3); |
451 SkScalar y = lua2scalar(L, 4); | 451 SkScalar y = lua2scalar(L, 4); |
452 | 452 |
453 SkPaint paint; | 453 SkPaint paint; |
454 const SkPaint* paintPtr = NULL; | 454 const SkPaint* paintPtr = NULL; |
455 if (lua_isnumber(L, 5)) { | 455 if (lua_isnumber(L, 5)) { |
456 paint.setAlpha(SkScalarRoundToInt(lua2scalar(L, 5) * 255)); | 456 paint.setAlpha(SkScalarRoundToInt(lua2scalar(L, 5) * 255)); |
457 paintPtr = &paint; | 457 paintPtr = &paint; |
458 } | 458 } |
459 image->draw(canvas, x, y, paintPtr); | 459 canvas->drawImage(image, x, y, paintPtr); |
460 return 0; | 460 return 0; |
461 } | 461 } |
462 | 462 |
463 static int lcanvas_drawPath(lua_State* L) { | 463 static int lcanvas_drawPath(lua_State* L) { |
464 get_ref<SkCanvas>(L, 1)->drawPath(*get_obj<SkPath>(L, 2), | 464 get_ref<SkCanvas>(L, 1)->drawPath(*get_obj<SkPath>(L, 2), |
465 *get_obj<SkPaint>(L, 3)); | 465 *get_obj<SkPaint>(L, 3)); |
466 return 0; | 466 return 0; |
467 } | 467 } |
468 | 468 |
469 static int lcanvas_drawText(lua_State* L) { | 469 static int lcanvas_drawText(lua_State* L) { |
(...skipping 1040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1510 REG_CLASS(L, SkShader); | 1510 REG_CLASS(L, SkShader); |
1511 REG_CLASS(L, SkTypeface); | 1511 REG_CLASS(L, SkTypeface); |
1512 REG_CLASS(L, SkMatrix); | 1512 REG_CLASS(L, SkMatrix); |
1513 } | 1513 } |
1514 | 1514 |
1515 extern "C" int luaopen_skia(lua_State* L); | 1515 extern "C" int luaopen_skia(lua_State* L); |
1516 extern "C" int luaopen_skia(lua_State* L) { | 1516 extern "C" int luaopen_skia(lua_State* L) { |
1517 SkLua::Load(L); | 1517 SkLua::Load(L); |
1518 return 0; | 1518 return 0; |
1519 } | 1519 } |
OLD | NEW |