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

Unified Diff: src/utils/SkLua.cpp

Issue 1287263005: change asABitmap to isABitmap on shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: src/utils/SkLua.cpp
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp
index 7c378c9b81e51d2987f7f5fcd4793f32ac8d21fc..e5d4c2b3a49ea93342f8fc07a20a7efe09c78b14 100644
--- a/src/utils/SkLua.cpp
+++ b/src/utils/SkLua.cpp
@@ -1200,23 +1200,20 @@ static int lshader_isOpaque(lua_State* L) {
return shader && shader->isOpaque();
}
-static int lshader_asABitmap(lua_State* L) {
+static int lshader_isABitmap(lua_State* L) {
SkShader* shader = get_ref<SkShader>(L, 1);
if (shader) {
SkBitmap bm;
SkMatrix matrix;
SkShader::TileMode modes[2];
- switch (shader->asABitmap(&bm, &matrix, modes)) {
- case SkShader::kDefault_BitmapType:
- lua_newtable(L);
- setfield_number(L, "genID", bm.pixelRef() ? bm.pixelRef()->getGenerationID() : 0);
- setfield_number(L, "width", bm.width());
- setfield_number(L, "height", bm.height());
- setfield_string(L, "tileX", mode2string(modes[0]));
- setfield_string(L, "tileY", mode2string(modes[1]));
- return 1;
- default:
- break;
+ if (shader->isABitmap(&bm, &matrix, modes)) {
+ lua_newtable(L);
+ setfield_number(L, "genID", bm.pixelRef() ? bm.pixelRef()->getGenerationID() : 0);
+ setfield_number(L, "width", bm.width());
+ setfield_number(L, "height", bm.height());
+ setfield_string(L, "tileX", mode2string(modes[0]));
+ setfield_string(L, "tileY", mode2string(modes[1]));
+ return 1;
}
}
return 0;
@@ -1260,7 +1257,7 @@ static int lshader_gc(lua_State* L) {
static const struct luaL_Reg gSkShader_Methods[] = {
{ "isOpaque", lshader_isOpaque },
- { "asABitmap", lshader_asABitmap },
+ { "isABitmap", lshader_isABitmap },
{ "asAGradient", lshader_asAGradient },
{ "__gc", lshader_gc },
{ NULL, NULL }

Powered by Google App Engine
This is Rietveld 408576698