Chromium Code Reviews| Index: src/utils/SkLua.cpp |
| diff --git a/src/utils/SkLua.cpp b/src/utils/SkLua.cpp |
| index 66a9c08597188ceaedcc21a105b249d4ab10ffd6..d8af2bf442f4aa10f5506e9fd99df37034f76f5b 100644 |
| --- a/src/utils/SkLua.cpp |
| +++ b/src/utils/SkLua.cpp |
| @@ -712,11 +712,21 @@ 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]; // can get data for all gradient types by calling asAGradient twice |
|
reed1
2013/08/01 16:00:10
not sure what this comment means. all types? do we
dierk
2013/08/01 16:07:39
Done.
|
| + |
| + 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_number(L, "mid", pos[1]); |
|
reed1
2013/08/01 16:00:10
Should we add this field if colorCount != 3 ?
Per
dierk
2013/08/01 16:07:39
Done.
|
| setfield_string(L, "tile", mode2string(info.fTileMode)); |
| return 1; |
| } |