1/*
2 * Copyright 2012 The Android Open Source Project
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8#ifndef ANDROID_HWUI_VERTEX_H
9#define ANDROID_HWUI_VERTEX_H
10
11namespace android {
12namespace uirenderer {
13
14/**
15 * Simple structure to describe a vertex with a position and a texture.
16 */
17struct Vertex {
18    float position[2];
19
20    static inline void set(Vertex* vertex, float x, float y) {
21        vertex[0].position[0] = x;
22        vertex[0].position[1] = y;
23    }
24}; // struct Vertex
25
26/**
27 * Simple structure to describe a vertex with a position and a texture.
28 */
29/*struct TextureVertex {
30    float position[2];
31    float texture[2];
32
33    static inline void set(TextureVertex* vertex, float x, float y, float u, float v) {
34        vertex[0].position[0] = x;
35        vertex[0].position[1] = y;
36        vertex[0].texture[0] = u;
37        vertex[0].texture[1] = v;
38    }
39
40    static inline void setUV(TextureVertex* vertex, float u, float v) {
41        vertex[0].texture[0] = u;
42        vertex[0].texture[1] = v;
43    }
44};*/ // struct TextureVertex
45
46/**
47 * Simple structure to describe a vertex with a position and an alpha value.
48 */
49struct AlphaVertex : Vertex {
50    float alpha;
51
52    static inline void set(AlphaVertex* vertex, float x, float y, float alpha) {
53        Vertex::set(vertex, x, y);
54        vertex[0].alpha = alpha;
55    }
56
57    static inline void setColor(AlphaVertex* vertex, float alpha) {
58        vertex[0].alpha = alpha;
59    }
60}; // struct AlphaVertex
61
62/**
63 * Simple structure to describe a vertex with a position and an alpha value.
64 */
65/*struct AAVertex : Vertex {
66    float width;
67    float length;
68
69    static inline void set(AAVertex* vertex, float x, float y, float width, float length) {
70        Vertex::set(vertex, x, y);
71        vertex[0].width = width;
72        vertex[0].length = length;
73    }
74
75    static inline void setColor(AAVertex* vertex, float width, float length) {
76        vertex[0].width = width;
77        vertex[0].length = length;
78    }
79};*/ // struct AlphaVertex
80
81}; // namespace uirenderer
82}; // namespace android
83
84#endif // ANDROID_HWUI_VERTEX_H
85