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