From f9764a4f532561f6e2e985ff3b25112f1132ce44 Mon Sep 17 00:00:00 2001 From: Romain Guy Date: Fri, 16 Jul 2010 23:13:33 -0700 Subject: 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 --- libs/hwui/Program.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'libs/hwui/Program.h') diff --git a/libs/hwui/Program.h b/libs/hwui/Program.h index d90bcaf382ed..d7970d92ab3f 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 -- cgit v1.2.3-59-g8ed1b