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

Unified Diff: src/utils/SkLua.cpp

Issue 21571002: Added 3-color gradient scraper for detecting symmetrical gradients. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 5 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
« no previous file with comments | « no previous file | tools/lua/gradients.lua » ('j') | tools/lua/gradients.lua » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | tools/lua/gradients.lua » ('j') | tools/lua/gradients.lua » ('J')

Powered by Google App Engine
This is Rietveld 408576698