summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Program.h
diff options
context:
space:
mode:
authorRomain Guy <romainguy@android.com>2010-07-16 23:13:33 -0700
committerRomain Guy <romainguy@android.com>2010-07-16 23:18:27 -0700
commitf9764a4f532561f6e2e985ff3b25112f1132ce44 (patch)
tree910110cc35d1d3e2a48f000734ec50f6e53ced0f /libs/hwui/Program.h
parent7fac2e18339f765320d759e8d4c090f92431959e (diff)
downloadframeworks_base-f9764a4f532561f6e2e985ff3b25112f1132ce44.zip
frameworks_base-f9764a4f532561f6e2e985ff3b25112f1132ce44.tar.gz
frameworks_base-f9764a4f532561f6e2e985ff3b25112f1132ce44.tar.bz2
Add program for linear gradient.
This change adds a new DrawLinearGradientProgram class to enable the drawing of linear gradients. Two new vertex and fragment shaders are introduced, based on DrawTextureProgram's shaders. Change-Id: I885afc076bb6cef8cd3962ae21a086fa6a03bf96
Diffstat (limited to 'libs/hwui/Program.h')
-rw-r--r--libs/hwui/Program.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h
index d90bcaf..d7970d9 100644
--- a/libs/hwui/Program.h
+++ b/libs/hwui/Program.h
@@ -148,6 +148,7 @@ public:
* Name of the color uniform.
*/
int color;
+
/**
* Name of the transform uniform.
*/
@@ -189,6 +190,44 @@ public:
int texCoords;
};
+/**
+ * Program used to draw linear gradients. In addition to everything that the
+ * DrawColorProgram supports, the following two attributes must be specified:
+ * vec2 gradient, the vector describing the linear gradient
+ * float gradientLength, the invert of the magnitude of the gradient vector
+ * sampler2D sampler, the texture sampler
+ */
+class DrawLinearGradientProgram: public DrawColorProgram {
+public:
+ DrawLinearGradientProgram();
+
+ /**
+ * Binds this program to the GL context.
+ */
+ virtual void use();
+
+ /**
+ * Marks this program as unused. This will not unbind
+ * the program from the GL context.
+ */
+ virtual void remove();
+
+ /**
+ * Name of the linear gradient vector.
+ */
+ int gradient;
+
+ /**
+ * Name of the inverse of linear gradient vector's magnitude.
+ */
+ int gradientLength;
+
+ /**
+ * Name of the texture sampler uniform.
+ */
+ int sampler;
+};
+
}; // namespace uirenderer
}; // namespace android