Layer.h revision 8550c4c7b5952b7a4e1e0ede95c9492d03099a13
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_UI_LAYER_H 18#define ANDROID_UI_LAYER_H 19 20#include <sys/types.h> 21 22#include <GLES2/gl2.h> 23 24#include <SkXfermode.h> 25 26#include "Rect.h" 27 28namespace android { 29namespace uirenderer { 30 31/////////////////////////////////////////////////////////////////////////////// 32// Layers 33/////////////////////////////////////////////////////////////////////////////// 34 35/** 36 * A layer has dimensions and is backed by an OpenGL texture or FBO. 37 */ 38struct Layer { 39 Layer(const uint32_t layerWidth, const uint32_t layerHeight): 40 width(layerWidth), height(layerHeight) { 41 } 42 43 /** 44 * Bounds of the layer. 45 */ 46 Rect layer; 47 /** 48 * Texture coordinates of the layer. 49 */ 50 Rect texCoords; 51 52 /** 53 * Name of the FBO used to render the layer. If the name is 0 54 * this layer is not backed by an FBO, but a simple texture. 55 */ 56 GLuint fbo; 57 58 /** 59 * Opacity of the layer. 60 */ 61 int alpha; 62 /** 63 * Blending mode of the layer. 64 */ 65 SkXfermode::Mode mode; 66 /** 67 * Indicates whether this layer should be blended. 68 */ 69 bool blend; 70 71 /** 72 * Indicates whether this layer has been used already. 73 */ 74 bool empty; 75 76 /** 77 * Name of the texture used to render the layer. 78 */ 79 GLuint texture; 80 /** 81 * Width of the layer texture. 82 */ 83 uint32_t width; 84 /** 85 * Height of the layer texture. 86 */ 87 uint32_t height; 88}; // struct Layer 89 90}; // namespace uirenderer 91}; // namespace android 92 93#endif // ANDROID_UI_LAYER_H 94