blob: bbf4d4af579ce6a05e0611a0ffd856f641b324a5 [file] [log] [blame]
Romain Guyf7f93552010-07-08 19:17:03 -07001/*
2 * Copyright (C) 2010 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Romain Guy5b3b3522010-10-27 18:57:51 -070017#ifndef ANDROID_HWUI_VERTEX_H
18#define ANDROID_HWUI_VERTEX_H
Romain Guyf7f93552010-07-08 19:17:03 -070019
20namespace android {
21namespace uirenderer {
22
23/**
Romain Guyf7f93552010-07-08 19:17:03 -070024 * Simple structure to describe a vertex with a position and a texture.
25 */
26struct TextureVertex {
27 float position[2];
28 float texture[2];
29
30 static inline void set(TextureVertex* vertex, float x, float y, float u, float v) {
31 vertex[0].position[0] = x;
32 vertex[0].position[1] = y;
33 vertex[0].texture[0] = u;
34 vertex[0].texture[1] = v;
35 }
Romain Guy82ba8142010-07-09 13:25:56 -070036
37 static inline void setUV(TextureVertex* vertex, float u, float v) {
38 vertex[0].texture[0] = u;
39 vertex[0].texture[1] = v;
40 }
Romain Guyf7f93552010-07-08 19:17:03 -070041}; // struct TextureVertex
42
43}; // namespace uirenderer
44}; // namespace android
45
Romain Guy5b3b3522010-10-27 18:57:51 -070046#endif // ANDROID_HWUI_VERTEX_H