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