Index: src/utils/SkLua.cpp |
diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp |
index 66a9c08597188ceaedcc21a105b249d4ab10ffd6..8267132b2f98ef073f0b49dd7f02ca127943ce82 100644 |
--- a/src/utils/SkLua.cpp |
+++ b/src/utils/SkLua.cpp |
@@ -712,12 +712,26 @@ static int lshader_asAGradient(lua_State* L) { |
if (shader) { |
SkShader::GradientInfo info; |
sk_bzero(&info, sizeof(info)); |
+ |
+ SkColor colors[3]; // hacked in for extracting info on 3 color case. |
+ SkScalar pos[3]; |
+ |
+ info.fColorCount = 3; |
+ info.fColors = &colors[0]; |
+ info.fColorOffsets = &pos[0]; |
+ |
SkShader::GradientType t = shader->asAGradient(&info); |
+ |
if (SkShader::kNone_GradientType != t) { |
lua_newtable(L); |
setfield_string(L, "type", gradtype2string(t)); |
setfield_number(L, "colorCount", info.fColorCount); |
setfield_string(L, "tile", mode2string(info.fTileMode)); |
+ |
+ if (info.fColorCount == 3){ |
reed1
2013/08/01 16:23:26
nit: 3 == info.fColorCount
This ordering ensures
|
+ setfield_number(L, "midPos", pos[1]); |
+ } |
+ |
return 1; |
} |
} |