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

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

Issue 583453002: SkCanvas::drawImage is the new way for drawing an SkImage to a Canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@refactor_skImage
Patch Set: Make SkImage::draw public temporary for compatibility reasons Created 6 years, 3 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
« no previous file with comments | « src/image/SkSurface.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('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 9
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « src/image/SkSurface.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698