diff options
author | Romain Guy <romainguy@google.com> | 2013-02-13 18:39:43 -0800 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2013-02-13 18:39:43 -0800 |
commit | ff316ec7a76e52572a2e89b691e6b3bba0cafba3 (patch) | |
tree | 8418a45b809c9382a0fc3d9d9bb6db6a537dd4cc /libs/hwui/Vertex.h | |
parent | 2b44eb75c42e4caa94f0b002f0ea9e134fe7b543 (diff) |
Implement support for drawBitmapMesh's colors array
Change-Id: I3d901f6267c2918771ac30ff55c8d80c3ab5b725
Diffstat (limited to 'libs/hwui/Vertex.h')
-rw-r--r-- | libs/hwui/Vertex.h | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/libs/hwui/Vertex.h b/libs/hwui/Vertex.h index c120428e16d0..523120e358ba 100644 --- a/libs/hwui/Vertex.h +++ b/libs/hwui/Vertex.h @@ -33,7 +33,7 @@ struct Vertex { }; // struct Vertex /** - * Simple structure to describe a vertex with a position and a texture. + * Simple structure to describe a vertex with a position and texture UV. */ struct TextureVertex { float position[2]; @@ -53,6 +53,24 @@ struct TextureVertex { }; // struct TextureVertex /** + * Simple structure to describe a vertex with a position, texture UV and ARGB color. + */ +struct ColorTextureVertex : TextureVertex { + float color[4]; + + static inline void set(ColorTextureVertex* vertex, float x, float y, + float u, float v, int color) { + TextureVertex::set(vertex, x, y, u, v); + + const float a = ((color >> 24) & 0xff) / 255.0f; + vertex[0].color[0] = a * ((color >> 16) & 0xff) / 255.0f; + vertex[0].color[1] = a * ((color >> 8) & 0xff) / 255.0f; + vertex[0].color[2] = a * ((color ) & 0xff) / 255.0f; + vertex[0].color[3] = a; + } +}; // struct ColorTextureVertex + +/** * Simple structure to describe a vertex with a position and an alpha value. */ struct AlphaVertex : Vertex { |