summaryrefslogtreecommitdiffstats
path: root/libs/hwui/SkiaShader.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/SkiaShader.h')
-rw-r--r--libs/hwui/SkiaShader.h27
1 files changed, 23 insertions, 4 deletions
diff --git a/libs/hwui/SkiaShader.h b/libs/hwui/SkiaShader.h
index cc56c50..9f30257 100644
--- a/libs/hwui/SkiaShader.h
+++ b/libs/hwui/SkiaShader.h
@@ -43,7 +43,8 @@ class Caches;
* Represents a Skia shader. A shader will modify the GL context and active
* program to recreate the original effect.
*/
-struct SkiaShader {
+class SkiaShader {
+public:
/**
* Type of Skia shader in use.
*/
@@ -57,7 +58,7 @@ struct SkiaShader {
};
ANDROID_API SkiaShader(Type type, SkShader* key, SkShader::TileMode tileX,
- SkShader::TileMode tileY, SkMatrix* matrix, bool blend);
+ SkShader::TileMode tileY, const SkMatrix* matrix, bool blend);
virtual ~SkiaShader();
virtual SkiaShader* copy() = 0;
@@ -87,7 +88,7 @@ struct SkiaShader {
return mGenerationId;
}
- void setMatrix(SkMatrix* matrix) {
+ void setMatrix(const SkMatrix* matrix) {
updateLocalMatrix(matrix);
mGenerationId++;
}
@@ -133,6 +134,24 @@ private:
///////////////////////////////////////////////////////////////////////////////
/**
+ * A shader that draws a layer.
+ */
+struct SkiaLayerShader: public SkiaShader {
+ SkiaLayerShader(Layer* layer, const SkMatrix* matrix);
+ SkiaShader* copy();
+
+ void describe(ProgramDescription& description, const Extensions& extensions);
+ void setupProgram(Program* program, const mat4& modelView, const Snapshot& snapshot,
+ GLuint* textureUnit);
+
+private:
+ SkiaLayerShader() {
+ }
+
+ Layer* mLayer;
+}; // struct SkiaLayerShader
+
+/**
* A shader that draws a bitmap.
*/
struct SkiaBitmapShader: public SkiaShader {
@@ -192,7 +211,7 @@ struct SkiaSweepGradientShader: public SkiaShader {
GLuint* textureUnit);
protected:
- SkiaSweepGradientShader(Type type, float x, float y, uint32_t* colors, float* positions,
+ SkiaSweepGradientShader(Type type, uint32_t* colors, float* positions,
int count, SkShader* key, SkShader::TileMode tileMode, SkMatrix* matrix, bool blend);
SkiaSweepGradientShader() {
}