blob: a780183a1c3353ddd592f4b9b5889fd152615cca [file] [log] [blame]
Romain Guydda57022010-07-06 11:39:32 -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_LAYER_H
18#define ANDROID_HWUI_LAYER_H
Romain Guydda57022010-07-06 11:39:32 -070019
Romain Guyf7f93552010-07-08 19:17:03 -070020#include <sys/types.h>
21
Romain Guydda57022010-07-06 11:39:32 -070022#include <GLES2/gl2.h>
23
Romain Guy5b3b3522010-10-27 18:57:51 -070024#include <ui/Region.h>
25
Romain Guydda57022010-07-06 11:39:32 -070026#include <SkXfermode.h>
27
28#include "Rect.h"
29
30namespace android {
31namespace uirenderer {
32
Romain Guy8550c4c2010-10-08 15:49:53 -070033///////////////////////////////////////////////////////////////////////////////
34// Layers
35///////////////////////////////////////////////////////////////////////////////
Romain Guydda57022010-07-06 11:39:32 -070036
37/**
Romain Guyeb993562010-10-05 18:14:38 -070038 * A layer has dimensions and is backed by an OpenGL texture or FBO.
Romain Guydda57022010-07-06 11:39:32 -070039 */
40struct Layer {
Romain Guy8550c4c2010-10-08 15:49:53 -070041 Layer(const uint32_t layerWidth, const uint32_t layerHeight):
42 width(layerWidth), height(layerHeight) {
43 }
44
Romain Guydda57022010-07-06 11:39:32 -070045 /**
Romain Guy8550c4c2010-10-08 15:49:53 -070046 * Bounds of the layer.
Romain Guydda57022010-07-06 11:39:32 -070047 */
48 Rect layer;
49 /**
Romain Guy8550c4c2010-10-08 15:49:53 -070050 * Texture coordinates of the layer.
Romain Guydda57022010-07-06 11:39:32 -070051 */
Romain Guy8550c4c2010-10-08 15:49:53 -070052 Rect texCoords;
53
Romain Guydda57022010-07-06 11:39:32 -070054 /**
Romain Guyeb993562010-10-05 18:14:38 -070055 * Name of the FBO used to render the layer. If the name is 0
56 * this layer is not backed by an FBO, but a simple texture.
57 */
58 GLuint fbo;
Romain Guy8550c4c2010-10-08 15:49:53 -070059
Romain Guyeb993562010-10-05 18:14:38 -070060 /**
Romain Guydda57022010-07-06 11:39:32 -070061 * Opacity of the layer.
Romain Guydda57022010-07-06 11:39:32 -070062 */
Romain Guyf607bdc2010-09-10 19:20:06 -070063 int alpha;
Romain Guydda57022010-07-06 11:39:32 -070064 /**
65 * Blending mode of the layer.
Romain Guydda57022010-07-06 11:39:32 -070066 */
67 SkXfermode::Mode mode;
68 /**
69 * Indicates whether this layer should be blended.
70 */
71 bool blend;
Romain Guy8550c4c2010-10-08 15:49:53 -070072
Romain Guy38c85b92010-09-22 22:48:20 -070073 /**
Romain Guy0bb56672010-10-01 00:25:02 -070074 * Indicates whether this layer has been used already.
Romain Guy38c85b92010-09-22 22:48:20 -070075 */
76 bool empty;
Romain Guy8550c4c2010-10-08 15:49:53 -070077
78 /**
79 * Name of the texture used to render the layer.
80 */
81 GLuint texture;
82 /**
83 * Width of the layer texture.
84 */
85 uint32_t width;
86 /**
87 * Height of the layer texture.
88 */
89 uint32_t height;
Romain Guy5b3b3522010-10-27 18:57:51 -070090
91 /**
92 * Dirty region indicating what parts of the layer
93 * have been drawn.
94 */
95 Region region;
Romain Guydda57022010-07-06 11:39:32 -070096}; // struct Layer
97
98}; // namespace uirenderer
99}; // namespace android
100
Romain Guy5b3b3522010-10-27 18:57:51 -0700101#endif // ANDROID_HWUI_LAYER_H