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
diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h
index b3cef88..5a530eb 100644
--- a/libs/hwui/OpenGLRenderer.h
+++ b/libs/hwui/OpenGLRenderer.h
@@ -103,8 +103,8 @@
void resetShader();
void setupBitmapShader(SkBitmap* bitmap, SkShader::TileMode tileX, SkShader::TileMode tileY,
SkMatrix* matrix, bool hasAlpha);
- void setupLinearGradientShader(float* bounds, uint32_t* colors, float* positions,
- SkShader::TileMode tileMode, SkMatrix* matrix, bool hasAlpha);
+ void setupLinearGradientShader(SkShader* shader, float* bounds, uint32_t* colors,
+ float* positions, SkShader::TileMode tileMode, SkMatrix* matrix, bool hasAlpha);
private:
/**
@@ -309,6 +309,7 @@
sp<Program> mCurrentProgram;
sp<DrawColorProgram> mDrawColorProgram;
sp<DrawTextureProgram> mDrawTextureProgram;
+ sp<DrawLinearGradientProgram> mDrawLinearGradientProgram;
// Used to draw textured quads
TextureVertex mDrawTextureVertices[4];
@@ -323,6 +324,7 @@
// Skia shaders
ShaderType mShader;
+ SkShader* mShaderKey;
bool mShaderBlend;
SkShader::TileMode mShaderTileX;
SkShader::TileMode mShaderTileY;