summaryrefslogtreecommitdiffstats
path: root/libs/hwui/shaders
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-07-19 18:43:02 -0700
committerRomain Guy <romainguy@google.com>2010-07-19 18:44:05 -0700
commitc0ac193b9415680f0a69e20a3f5f22d16f8053be (patch)
tree9a1d680ad20ba3f6ec0924c6b445290696d63b8c /libs/hwui/shaders
parent9d339c13aaa30ddfd51d0f13f8ab22af05e40ea0 (diff)
downloadframeworks_base-c0ac193b9415680f0a69e20a3f5f22d16f8053be.zip
frameworks_base-c0ac193b9415680f0a69e20a3f5f22d16f8053be.tar.gz
frameworks_base-c0ac193b9415680f0a69e20a3f5f22d16f8053be.tar.bz2
Add support for linear gradients.
Change-Id: Id15329da065045b3f06fdaed615f33cd57608496
Diffstat (limited to 'libs/hwui/shaders')
-rw-r--r--libs/hwui/shaders/drawLinearGradient.vert6
1 files changed, 5 insertions, 1 deletions
diff --git a/libs/hwui/shaders/drawLinearGradient.vert b/libs/hwui/shaders/drawLinearGradient.vert
index 963dc87..f5c669b 100644
--- a/libs/hwui/shaders/drawLinearGradient.vert
+++ b/libs/hwui/shaders/drawLinearGradient.vert
@@ -4,13 +4,17 @@ attribute vec4 position;
uniform float gradientLength;
uniform vec2 gradient;
+uniform vec2 start;
uniform mat4 transform;
+uniform mat4 screenSpace;
varying float index;
void main(void) {
+ vec4 location = screenSpace * position;
+ index = dot(location.xy - start, gradient) * gradientLength;
+
gl_Position = transform * position;
- index = dot(gl_Position.xy, gradient) * gradientLength;
}
);