Layer.h revision 5b3b35296e8b2c8d3f07d32bb645d5414db41a1d
1/* 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 17#ifndef ANDROID_HWUI_LAYER_H 18#define ANDROID_HWUI_LAYER_H 19 20#include <sys/types.h> 21 22#include <GLES2/gl2.h> 23 24#include <ui/Region.h> 25 26#include <SkXfermode.h> 27 28#include "Rect.h" 29 30namespace android { 31namespace uirenderer { 32 33/////////////////////////////////////////////////////////////////////////////// 34// Layers 35/////////////////////////////////////////////////////////////////////////////// 36 37/** 38 * A layer has dimensions and is backed by an OpenGL texture or FBO. 39 */ 40struct Layer { 41 Layer(const uint32_t layerWidth, const uint32_t layerHeight): 42 width(layerWidth), height(layerHeight) { 43 } 44 45 /** 46 * Bounds of the layer. 47 */ 48 Rect layer; 49 /** 50 * Texture coordinates of the layer. 51 */ 52 Rect texCoords; 53 54 /** 55 * 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; 59 60 /** 61 * Opacity of the layer. 62 */ 63 int alpha; 64 /** 65 * Blending mode of the layer. 66 */ 67 SkXfermode::Mode mode; 68 /** 69 * Indicates whether this layer should be blended. 70 */ 71 bool blend; 72 73 /** 74 * Indicates whether this layer has been used already. 75 */ 76 bool empty; 77 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; 90 91 /** 92 * Dirty region indicating what parts of the layer 93 * have been drawn. 94 */ 95 Region region; 96}; // struct Layer 97 98}; // namespace uirenderer 99}; // namespace android 100 101#endif // ANDROID_HWUI_LAYER_H 102