Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 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 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 17 | #ifndef ANDROID_HWUI_LAYER_H |
| 18 | #define ANDROID_HWUI_LAYER_H |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 19 | |
Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 20 | #include <sys/types.h> |
| 21 | |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 22 | #include <GLES2/gl2.h> |
| 23 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 24 | #include <ui/Region.h> |
| 25 | |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 26 | #include <SkXfermode.h> |
| 27 | |
| 28 | #include "Rect.h" |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 29 | #include "RenderBuffer.h" |
Romain Guy | 171c592 | 2011-01-06 10:04:23 -0800 | [diff] [blame] | 30 | #include "SkiaColorFilter.h" |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 31 | #include "Texture.h" |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 32 | #include "Vertex.h" |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 33 | |
| 34 | namespace android { |
| 35 | namespace uirenderer { |
| 36 | |
Romain Guy | 8550c4c | 2010-10-08 15:49:53 -0700 | [diff] [blame] | 37 | /////////////////////////////////////////////////////////////////////////////// |
| 38 | // Layers |
| 39 | /////////////////////////////////////////////////////////////////////////////// |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 40 | |
Romain Guy | 2bf68f0 | 2012-03-02 13:37:47 -0800 | [diff] [blame] | 41 | // Forward declarations |
| 42 | class OpenGLRenderer; |
| 43 | class DisplayList; |
| 44 | |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 45 | /** |
Romain Guy | eb99356 | 2010-10-05 18:14:38 -0700 | [diff] [blame] | 46 | * A layer has dimensions and is backed by an OpenGL texture or FBO. |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 47 | */ |
| 48 | struct Layer { |
Chet Haase | 603f6de | 2012-09-14 15:31:25 -0700 | [diff] [blame] | 49 | Layer(const uint32_t layerWidth, const uint32_t layerHeight); |
Chet Haase | d15ebf2 | 2012-09-05 11:40:29 -0700 | [diff] [blame] | 50 | ~Layer(); |
Romain Guy | 8550c4c | 2010-10-08 15:49:53 -0700 | [diff] [blame] | 51 | |
Romain Guy | 2055aba | 2013-01-18 16:42:51 -0800 | [diff] [blame] | 52 | static uint32_t computeIdealWidth(uint32_t layerWidth); |
| 53 | static uint32_t computeIdealHeight(uint32_t layerHeight); |
| 54 | |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 55 | /** |
| 56 | * Calling this method will remove (either by recycling or |
| 57 | * destroying) the associated FBO, if present, and any render |
| 58 | * buffer (stencil for instance.) |
| 59 | */ |
| 60 | void removeFbo(bool flush = true); |
Dave Burke | 56257af | 2012-09-25 20:30:09 -0700 | [diff] [blame] | 61 | |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 62 | /** |
Romain Guy | 9fc2781 | 2011-04-27 14:21:41 -0700 | [diff] [blame] | 63 | * Sets this layer's region to a rectangle. Computes the appropriate |
| 64 | * texture coordinates. |
| 65 | */ |
| 66 | void setRegionAsRect() { |
| 67 | const android::Rect& bounds = region.getBounds(); |
| 68 | regionRect.set(bounds.leftTop().x, bounds.leftTop().y, |
| 69 | bounds.rightBottom().x, bounds.rightBottom().y); |
| 70 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 71 | const float texX = 1.0f / float(texture.width); |
| 72 | const float texY = 1.0f / float(texture.height); |
Romain Guy | 9fc2781 | 2011-04-27 14:21:41 -0700 | [diff] [blame] | 73 | const float height = layer.getHeight(); |
| 74 | texCoords.set( |
| 75 | regionRect.left * texX, (height - regionRect.top) * texY, |
| 76 | regionRect.right * texX, (height - regionRect.bottom) * texY); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 77 | |
| 78 | regionRect.translate(layer.left, layer.top); |
| 79 | } |
| 80 | |
Romain Guy | 2bf68f0 | 2012-03-02 13:37:47 -0800 | [diff] [blame] | 81 | void updateDeferred(OpenGLRenderer* renderer, DisplayList* displayList, |
| 82 | int left, int top, int right, int bottom) { |
| 83 | this->renderer = renderer; |
| 84 | this->displayList = displayList; |
| 85 | const Rect r(left, top, right, bottom); |
| 86 | dirtyRect.unionWith(r); |
| 87 | deferredUpdateScheduled = true; |
| 88 | } |
| 89 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 90 | inline uint32_t getWidth() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 91 | return texture.width; |
| 92 | } |
| 93 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 94 | inline uint32_t getHeight() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 95 | return texture.height; |
| 96 | } |
| 97 | |
Romain Guy | 2055aba | 2013-01-18 16:42:51 -0800 | [diff] [blame] | 98 | /** |
| 99 | * Resize the layer and its texture if needed. |
| 100 | * |
| 101 | * @param width The new width of the layer |
| 102 | * @param height The new height of the layer |
| 103 | * |
| 104 | * @return True if the layer was resized or nothing happened, false if |
| 105 | * a failure occurred during the resizing operation |
| 106 | */ |
| 107 | bool resize(const uint32_t width, const uint32_t height); |
| 108 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 109 | void setSize(uint32_t width, uint32_t height) { |
| 110 | texture.width = width; |
| 111 | texture.height = height; |
| 112 | } |
| 113 | |
Chet Haase | d15ebf2 | 2012-09-05 11:40:29 -0700 | [diff] [blame] | 114 | ANDROID_API void setPaint(SkPaint* paint); |
| 115 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 116 | inline void setBlend(bool blend) { |
| 117 | texture.blend = blend; |
| 118 | } |
| 119 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 120 | inline bool isBlend() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 121 | return texture.blend; |
| 122 | } |
| 123 | |
| 124 | inline void setAlpha(int alpha) { |
| 125 | this->alpha = alpha; |
| 126 | } |
| 127 | |
| 128 | inline void setAlpha(int alpha, SkXfermode::Mode mode) { |
| 129 | this->alpha = alpha; |
| 130 | this->mode = mode; |
| 131 | } |
| 132 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 133 | inline int getAlpha() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 134 | return alpha; |
| 135 | } |
| 136 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 137 | inline SkXfermode::Mode getMode() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 138 | return mode; |
| 139 | } |
| 140 | |
| 141 | inline void setEmpty(bool empty) { |
| 142 | this->empty = empty; |
| 143 | } |
| 144 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 145 | inline bool isEmpty() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 146 | return empty; |
| 147 | } |
| 148 | |
| 149 | inline void setFbo(GLuint fbo) { |
| 150 | this->fbo = fbo; |
| 151 | } |
| 152 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 153 | inline GLuint getFbo() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 154 | return fbo; |
| 155 | } |
| 156 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 157 | inline void setStencilRenderBuffer(RenderBuffer* renderBuffer) { |
| 158 | if (RenderBuffer::isStencilBuffer(renderBuffer->getFormat())) { |
| 159 | this->stencil = renderBuffer; |
| 160 | glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, |
| 161 | GL_RENDERBUFFER, stencil->getName()); |
| 162 | } else { |
| 163 | ALOGE("The specified render buffer is not a stencil buffer"); |
| 164 | } |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 165 | } |
| 166 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 167 | inline RenderBuffer* getStencilRenderBuffer() const { |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 168 | return stencil; |
| 169 | } |
| 170 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 171 | inline GLuint getTexture() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 172 | return texture.id; |
| 173 | } |
| 174 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 175 | inline GLenum getRenderTarget() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 176 | return renderTarget; |
| 177 | } |
| 178 | |
| 179 | inline void setRenderTarget(GLenum renderTarget) { |
| 180 | this->renderTarget = renderTarget; |
| 181 | } |
| 182 | |
Romain Guy | d21b6e1 | 2011-11-30 20:21:23 -0800 | [diff] [blame] | 183 | void setWrap(GLenum wrap, bool bindTexture = false, bool force = false) { |
| 184 | texture.setWrap(wrap, bindTexture, force, renderTarget); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 185 | } |
| 186 | |
Romain Guy | d21b6e1 | 2011-11-30 20:21:23 -0800 | [diff] [blame] | 187 | void setFilter(GLenum filter, bool bindTexture = false, bool force = false) { |
| 188 | texture.setFilter(filter, bindTexture, force, renderTarget); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 189 | } |
| 190 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 191 | inline bool isCacheable() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 192 | return cacheable; |
| 193 | } |
| 194 | |
| 195 | inline void setCacheable(bool cacheable) { |
| 196 | this->cacheable = cacheable; |
| 197 | } |
| 198 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 199 | inline bool isDirty() const { |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 200 | return dirty; |
| 201 | } |
| 202 | |
| 203 | inline void setDirty(bool dirty) { |
| 204 | this->dirty = dirty; |
| 205 | } |
| 206 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 207 | inline bool isTextureLayer() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 208 | return textureLayer; |
| 209 | } |
| 210 | |
| 211 | inline void setTextureLayer(bool textureLayer) { |
| 212 | this->textureLayer = textureLayer; |
| 213 | } |
| 214 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 215 | inline SkiaColorFilter* getColorFilter() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 216 | return colorFilter; |
| 217 | } |
| 218 | |
Chet Haase | d15ebf2 | 2012-09-05 11:40:29 -0700 | [diff] [blame] | 219 | ANDROID_API void setColorFilter(SkiaColorFilter* filter); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 220 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 221 | inline void bindTexture() const { |
Romain Guy | ef09a21 | 2012-09-25 12:17:14 -0700 | [diff] [blame] | 222 | if (texture.id) { |
| 223 | glBindTexture(renderTarget, texture.id); |
| 224 | } |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 225 | } |
| 226 | |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 227 | inline void bindStencilRenderBuffer() const { |
Romain Guy | 2055aba | 2013-01-18 16:42:51 -0800 | [diff] [blame] | 228 | if (stencil) { |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 229 | stencil->bind(); |
Romain Guy | 2055aba | 2013-01-18 16:42:51 -0800 | [diff] [blame] | 230 | } |
| 231 | } |
| 232 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 233 | inline void generateTexture() { |
Romain Guy | ef09a21 | 2012-09-25 12:17:14 -0700 | [diff] [blame] | 234 | if (!texture.id) { |
| 235 | glGenTextures(1, &texture.id); |
| 236 | } |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 237 | } |
| 238 | |
| 239 | inline void deleteTexture() { |
Romain Guy | ef09a21 | 2012-09-25 12:17:14 -0700 | [diff] [blame] | 240 | if (texture.id) { |
| 241 | glDeleteTextures(1, &texture.id); |
| 242 | texture.id = 0; |
| 243 | } |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * When the caller frees the texture itself, the caller |
| 248 | * must call this method to tell this layer that it lost |
| 249 | * the texture. |
| 250 | */ |
| 251 | void clearTexture() { |
| 252 | texture.id = 0; |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 253 | } |
| 254 | |
| 255 | inline void allocateTexture(GLenum format, GLenum storage) { |
Romain Guy | b2e2f24 | 2012-10-17 18:18:35 -0700 | [diff] [blame] | 256 | #if DEBUG_LAYERS |
| 257 | ALOGD(" Allocate layer: %dx%d", getWidth(), getHeight()); |
| 258 | #endif |
Romain Guy | 2055aba | 2013-01-18 16:42:51 -0800 | [diff] [blame] | 259 | if (texture.id) { |
| 260 | glTexImage2D(renderTarget, 0, format, getWidth(), getHeight(), 0, |
| 261 | format, storage, NULL); |
| 262 | } |
| 263 | } |
| 264 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 265 | inline mat4& getTexTransform() { |
| 266 | return texTransform; |
Romain Guy | 9fc2781 | 2011-04-27 14:21:41 -0700 | [diff] [blame] | 267 | } |
| 268 | |
Romain Guy | 302a9df | 2011-08-16 13:55:02 -0700 | [diff] [blame] | 269 | inline mat4& getTransform() { |
| 270 | return transform; |
| 271 | } |
| 272 | |
Romain Guy | 9fc2781 | 2011-04-27 14:21:41 -0700 | [diff] [blame] | 273 | /** |
Romain Guy | 8550c4c | 2010-10-08 15:49:53 -0700 | [diff] [blame] | 274 | * Bounds of the layer. |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 275 | */ |
| 276 | Rect layer; |
| 277 | /** |
Romain Guy | 8550c4c | 2010-10-08 15:49:53 -0700 | [diff] [blame] | 278 | * Texture coordinates of the layer. |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 279 | */ |
Romain Guy | 8550c4c | 2010-10-08 15:49:53 -0700 | [diff] [blame] | 280 | Rect texCoords; |
Romain Guy | c3fedaf | 2013-01-29 17:26:25 -0800 | [diff] [blame] | 281 | /** |
| 282 | * Clipping rectangle. |
| 283 | */ |
| 284 | Rect clipRect; |
Romain Guy | 8550c4c | 2010-10-08 15:49:53 -0700 | [diff] [blame] | 285 | |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 286 | /** |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 287 | * Dirty region indicating what parts of the layer |
| 288 | * have been drawn. |
| 289 | */ |
| 290 | Region region; |
Romain Guy | 4066767 | 2011-03-18 14:34:03 -0700 | [diff] [blame] | 291 | /** |
| 292 | * If the region is a rectangle, coordinates of the |
| 293 | * region are stored here. |
| 294 | */ |
| 295 | Rect regionRect; |
Romain Guy | 171c592 | 2011-01-06 10:04:23 -0800 | [diff] [blame] | 296 | |
| 297 | /** |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 298 | * If the layer can be rendered as a mesh, this is non-null. |
| 299 | */ |
| 300 | TextureVertex* mesh; |
| 301 | uint16_t* meshIndices; |
| 302 | GLsizei meshElementCount; |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 303 | |
Romain Guy | 2bf68f0 | 2012-03-02 13:37:47 -0800 | [diff] [blame] | 304 | /** |
| 305 | * Used for deferred updates. |
| 306 | */ |
| 307 | bool deferredUpdateScheduled; |
| 308 | OpenGLRenderer* renderer; |
| 309 | DisplayList* displayList; |
| 310 | Rect dirtyRect; |
Romain Guy | 5bb3c73 | 2012-11-29 17:52:58 -0800 | [diff] [blame] | 311 | bool debugDrawUpdate; |
Romain Guy | 2bf68f0 | 2012-03-02 13:37:47 -0800 | [diff] [blame] | 312 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 313 | private: |
| 314 | /** |
| 315 | * Name of the FBO used to render the layer. If the name is 0 |
| 316 | * this layer is not backed by an FBO, but a simple texture. |
| 317 | */ |
| 318 | GLuint fbo; |
| 319 | |
| 320 | /** |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 321 | * The render buffer used as the stencil buffer. |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 322 | */ |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame^] | 323 | RenderBuffer* stencil; |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 324 | |
| 325 | /** |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 326 | * Indicates whether this layer has been used already. |
| 327 | */ |
| 328 | bool empty; |
| 329 | |
| 330 | /** |
| 331 | * The texture backing this layer. |
| 332 | */ |
| 333 | Texture texture; |
| 334 | |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 335 | /** |
| 336 | * If set to true (by default), the layer can be reused. |
| 337 | */ |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 338 | bool cacheable; |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 339 | |
| 340 | /** |
| 341 | * When set to true, this layer must be treated as a texture |
| 342 | * layer. |
| 343 | */ |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 344 | bool textureLayer; |
| 345 | |
| 346 | /** |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 347 | * When set to true, this layer is dirty and should be cleared |
| 348 | * before any rendering occurs. |
| 349 | */ |
| 350 | bool dirty; |
| 351 | |
| 352 | /** |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 353 | * Indicates the render target. |
| 354 | */ |
| 355 | GLenum renderTarget; |
| 356 | |
| 357 | /** |
| 358 | * Color filter used to draw this layer. Optional. |
| 359 | */ |
| 360 | SkiaColorFilter* colorFilter; |
| 361 | |
| 362 | /** |
| 363 | * Opacity of the layer. |
| 364 | */ |
| 365 | int alpha; |
| 366 | /** |
| 367 | * Blending mode of the layer. |
| 368 | */ |
| 369 | SkXfermode::Mode mode; |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 370 | |
| 371 | /** |
| 372 | * Optional texture coordinates transform. |
| 373 | */ |
| 374 | mat4 texTransform; |
Romain Guy | 8f0095c | 2011-05-02 17:24:22 -0700 | [diff] [blame] | 375 | |
Romain Guy | 302a9df | 2011-08-16 13:55:02 -0700 | [diff] [blame] | 376 | /** |
| 377 | * Optional transform. |
| 378 | */ |
| 379 | mat4 transform; |
| 380 | |
Romain Guy | dda57020 | 2010-07-06 11:39:32 -0700 | [diff] [blame] | 381 | }; // struct Layer |
| 382 | |
| 383 | }; // namespace uirenderer |
| 384 | }; // namespace android |
| 385 | |
Romain Guy | 5b3b352 | 2010-10-27 18:57:51 -0700 | [diff] [blame] | 386 | #endif // ANDROID_HWUI_LAYER_H |