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

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: Small revisions for clarity and imprecision. 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') | no next file with comments »
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..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;
}
}
« no previous file with comments | « no previous file | tools/lua/gradients.lua » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698