Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 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 | #define LOG_TAG "OpenGLRenderer" |
John Reck | ec4cefc | 2014-07-29 09:49:13 -0700 | [diff] [blame] | 18 | #define ATRACE_TAG ATRACE_TAG_VIEW |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 19 | |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 20 | #include <ui/Rect.h> |
| 21 | |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 22 | #include <private/hwui/DrawGlInfo.h> |
| 23 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 24 | #include "RenderState.h" |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 25 | #include "LayerCache.h" |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 26 | #include "LayerRenderer.h" |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 27 | #include "Matrix.h" |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 28 | #include "Properties.h" |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 29 | #include "Rect.h" |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 30 | |
| 31 | namespace android { |
| 32 | namespace uirenderer { |
| 33 | |
| 34 | /////////////////////////////////////////////////////////////////////////////// |
| 35 | // Rendering |
| 36 | /////////////////////////////////////////////////////////////////////////////// |
| 37 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 38 | LayerRenderer::LayerRenderer(RenderState& renderState, Layer* layer) |
| 39 | : OpenGLRenderer(renderState) |
| 40 | , mLayer(layer) { |
Romain Guy | 7953745 | 2011-10-12 13:48:51 -0700 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | LayerRenderer::~LayerRenderer() { |
| 44 | } |
| 45 | |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 46 | void LayerRenderer::prepareDirty(float left, float top, float right, float bottom, |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 47 | bool opaque) { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 48 | LAYER_RENDERER_LOGD("Rendering into layer, fbo = %d", mLayer->getFbo()); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 49 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 50 | renderState().bindFramebuffer(mLayer->getFbo()); |
Romain Guy | 62687ec | 2011-02-02 15:44:19 -0800 | [diff] [blame] | 51 | |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 52 | const float width = mLayer->layer.getWidth(); |
| 53 | const float height = mLayer->layer.getHeight(); |
| 54 | |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 55 | Rect dirty(left, top, right, bottom); |
| 56 | if (dirty.isEmpty() || (dirty.left <= 0 && dirty.top <= 0 && |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 57 | dirty.right >= width && dirty.bottom >= height)) { |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 58 | mLayer->region.clear(); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 59 | dirty.set(0.0f, 0.0f, width, height); |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 60 | } else { |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 61 | dirty.intersect(0.0f, 0.0f, width, height); |
Romain Guy | 3a3133d | 2011-02-01 22:59:58 -0800 | [diff] [blame] | 62 | android::Rect r(dirty.left, dirty.top, dirty.right, dirty.bottom); |
| 63 | mLayer->region.subtractSelf(r); |
| 64 | } |
Romain Guy | c3fedaf | 2013-01-29 17:26:25 -0800 | [diff] [blame] | 65 | mLayer->clipRect.set(dirty); |
Romain Guy | c88e357 | 2011-01-22 00:32:12 -0800 | [diff] [blame] | 66 | |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 67 | OpenGLRenderer::prepareDirty(dirty.left, dirty.top, dirty.right, dirty.bottom, opaque); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 68 | } |
| 69 | |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 70 | void LayerRenderer::clear(float left, float top, float right, float bottom, bool opaque) { |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 71 | if (mLayer->isDirty()) { |
| 72 | getCaches().disableScissor(); |
| 73 | glClear(GL_COLOR_BUFFER_BIT); |
| 74 | |
| 75 | getCaches().resetScissor(); |
| 76 | mLayer->setDirty(false); |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 77 | } else { |
| 78 | OpenGLRenderer::clear(left, top, right, bottom, opaque); |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 79 | } |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 80 | } |
| 81 | |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 82 | bool LayerRenderer::finish() { |
| 83 | bool retval = OpenGLRenderer::finish(); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 84 | |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 85 | generateMesh(); |
| 86 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 87 | LAYER_RENDERER_LOGD("Finished rendering into layer, fbo = %d", mLayer->getFbo()); |
Romain Guy | 42f3a4b | 2011-01-19 13:42:26 -0800 | [diff] [blame] | 88 | |
| 89 | // No need to unbind our FBO, this will be taken care of by the caller |
| 90 | // who will invoke OpenGLRenderer::resume() |
Tom Hudson | 107843d | 2014-09-08 11:26:26 -0400 | [diff] [blame] | 91 | return retval; |
Romain Guy | 42f3a4b | 2011-01-19 13:42:26 -0800 | [diff] [blame] | 92 | } |
| 93 | |
Tom Hudson | 984162f | 2014-10-10 13:38:16 -0400 | [diff] [blame^] | 94 | GLuint LayerRenderer::onGetTargetFbo() const { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 95 | return mLayer->getFbo(); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 96 | } |
| 97 | |
Romain Guy | 624234f | 2013-03-05 16:43:31 -0800 | [diff] [blame] | 98 | bool LayerRenderer::suppressErrorChecks() const { |
Romain Guy | 11cb642 | 2012-09-21 00:39:43 -0700 | [diff] [blame] | 99 | return true; |
| 100 | } |
| 101 | |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 102 | /////////////////////////////////////////////////////////////////////////////// |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 103 | // Layer support |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 104 | /////////////////////////////////////////////////////////////////////////////// |
| 105 | |
Romain Guy | 624234f | 2013-03-05 16:43:31 -0800 | [diff] [blame] | 106 | bool LayerRenderer::hasLayer() const { |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 107 | return true; |
| 108 | } |
| 109 | |
Romain Guy | 8ce0030 | 2013-01-15 18:51:42 -0800 | [diff] [blame] | 110 | void LayerRenderer::ensureStencilBuffer() { |
| 111 | attachStencilBufferToLayer(mLayer); |
| 112 | } |
| 113 | |
| 114 | /////////////////////////////////////////////////////////////////////////////// |
| 115 | // Dirty region tracking |
| 116 | /////////////////////////////////////////////////////////////////////////////// |
| 117 | |
Romain Guy | 624234f | 2013-03-05 16:43:31 -0800 | [diff] [blame] | 118 | Region* LayerRenderer::getRegion() const { |
Tom Hudson | 984162f | 2014-10-10 13:38:16 -0400 | [diff] [blame^] | 119 | if (mState.currentFlags() & Snapshot::kFlagFboTarget) { |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 120 | return OpenGLRenderer::getRegion(); |
| 121 | } |
| 122 | return &mLayer->region; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 123 | } |
| 124 | |
Chris Craik | 6c5b9be | 2013-02-27 14:03:19 -0800 | [diff] [blame] | 125 | // TODO: This implementation uses a very simple approach to fixing T-junctions which keeps the |
| 126 | // results as rectangles, and is thus not necessarily efficient in the geometry |
| 127 | // produced. Eventually, it may be better to develop triangle-based mechanism. |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 128 | void LayerRenderer::generateMesh() { |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 129 | if (mLayer->region.isRect() || mLayer->region.isEmpty()) { |
| 130 | if (mLayer->mesh) { |
Romain Guy | 96885eb | 2013-03-26 15:05:58 -0700 | [diff] [blame] | 131 | delete[] mLayer->mesh; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 132 | mLayer->mesh = NULL; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 133 | mLayer->meshElementCount = 0; |
| 134 | } |
Romain Guy | 4066767 | 2011-03-18 14:34:03 -0700 | [diff] [blame] | 135 | |
Romain Guy | 9fc2781 | 2011-04-27 14:21:41 -0700 | [diff] [blame] | 136 | mLayer->setRegionAsRect(); |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 137 | return; |
| 138 | } |
| 139 | |
Chris Craik | 6c5b9be | 2013-02-27 14:03:19 -0800 | [diff] [blame] | 140 | // avoid T-junctions as they cause artifacts in between the resultant |
| 141 | // geometry when complex transforms occur. |
| 142 | // TODO: generate the safeRegion only if necessary based on drawing transform (see |
| 143 | // OpenGLRenderer::composeLayerRegion()) |
| 144 | Region safeRegion = Region::createTJunctionFreeRegion(mLayer->region); |
| 145 | |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 146 | size_t count; |
Chris Craik | 6c5b9be | 2013-02-27 14:03:19 -0800 | [diff] [blame] | 147 | const android::Rect* rects = safeRegion.getArray(&count); |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 148 | |
| 149 | GLsizei elementCount = count * 6; |
| 150 | |
| 151 | if (mLayer->mesh && mLayer->meshElementCount < elementCount) { |
Romain Guy | 96885eb | 2013-03-26 15:05:58 -0700 | [diff] [blame] | 152 | delete[] mLayer->mesh; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 153 | mLayer->mesh = NULL; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 154 | } |
| 155 | |
| 156 | if (!mLayer->mesh) { |
| 157 | mLayer->mesh = new TextureVertex[count * 4]; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 158 | } |
Romain Guy | 4f09f54 | 2011-01-26 22:41:43 -0800 | [diff] [blame] | 159 | mLayer->meshElementCount = elementCount; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 160 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 161 | const float texX = 1.0f / float(mLayer->getWidth()); |
| 162 | const float texY = 1.0f / float(mLayer->getHeight()); |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 163 | const float height = mLayer->layer.getHeight(); |
| 164 | |
| 165 | TextureVertex* mesh = mLayer->mesh; |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 166 | |
| 167 | for (size_t i = 0; i < count; i++) { |
| 168 | const android::Rect* r = &rects[i]; |
| 169 | |
| 170 | const float u1 = r->left * texX; |
| 171 | const float v1 = (height - r->top) * texY; |
| 172 | const float u2 = r->right * texX; |
| 173 | const float v2 = (height - r->bottom) * texY; |
| 174 | |
| 175 | TextureVertex::set(mesh++, r->left, r->top, u1, v1); |
| 176 | TextureVertex::set(mesh++, r->right, r->top, u2, v1); |
| 177 | TextureVertex::set(mesh++, r->left, r->bottom, u1, v2); |
| 178 | TextureVertex::set(mesh++, r->right, r->bottom, u2, v2); |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 179 | } |
Romain Guy | f219da5 | 2011-01-16 12:54:25 -0800 | [diff] [blame] | 180 | } |
| 181 | |
| 182 | /////////////////////////////////////////////////////////////////////////////// |
| 183 | // Layers management |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 184 | /////////////////////////////////////////////////////////////////////////////// |
| 185 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 186 | Layer* LayerRenderer::createRenderLayer(RenderState& renderState, uint32_t width, uint32_t height) { |
John Reck | ec4cefc | 2014-07-29 09:49:13 -0700 | [diff] [blame] | 187 | ATRACE_CALL(); |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 188 | LAYER_RENDERER_LOGD("Requesting new render layer %dx%d", width, height); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 189 | |
Romain Guy | a1d3c91 | 2011-12-13 14:55:06 -0800 | [diff] [blame] | 190 | Caches& caches = Caches::getInstance(); |
| 191 | GLuint fbo = caches.fboCache.get(); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 192 | if (!fbo) { |
Steve Block | 8564c8d | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 193 | ALOGW("Could not obtain an FBO"); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 194 | return NULL; |
| 195 | } |
| 196 | |
Romain Guy | a1d3c91 | 2011-12-13 14:55:06 -0800 | [diff] [blame] | 197 | caches.activeTexture(0); |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 198 | Layer* layer = caches.layerCache.get(renderState, width, height); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 199 | if (!layer) { |
Steve Block | 8564c8d | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 200 | ALOGW("Could not obtain a layer"); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 201 | return NULL; |
| 202 | } |
| 203 | |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 204 | // We first obtain a layer before comparing against the max texture size |
| 205 | // because layers are not allocated at the exact desired size. They are |
| 206 | // always created slighly larger to improve recycling |
| 207 | const uint32_t maxTextureSize = caches.maxTextureSize; |
| 208 | if (layer->getWidth() > maxTextureSize || layer->getHeight() > maxTextureSize) { |
| 209 | ALOGW("Layer exceeds max. dimensions supported by the GPU (%dx%d, max=%dx%d)", |
| 210 | width, height, maxTextureSize, maxTextureSize); |
| 211 | |
| 212 | // Creating a new layer always increment its refcount by 1, this allows |
| 213 | // us to destroy the layer object if one was created for us |
John Reck | 0e89e2b | 2014-10-31 14:49:06 -0700 | [diff] [blame] | 214 | layer->decStrong(0); |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 215 | |
| 216 | return NULL; |
| 217 | } |
| 218 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 219 | layer->setFbo(fbo); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 220 | layer->layer.set(0.0f, 0.0f, width, height); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 221 | layer->texCoords.set(0.0f, height / float(layer->getHeight()), |
| 222 | width / float(layer->getWidth()), 0.0f); |
| 223 | layer->setAlpha(255, SkXfermode::kSrcOver_Mode); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 224 | layer->setColorFilter(NULL); |
Romain Guy | 7c25aab | 2012-10-18 15:05:02 -0700 | [diff] [blame] | 225 | layer->setDirty(true); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 226 | layer->region.clear(); |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 227 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 228 | GLuint previousFbo = renderState.getFramebuffer(); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 229 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 230 | renderState.bindFramebuffer(layer->getFbo()); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 231 | layer->bindTexture(); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 232 | |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 233 | // Initialize the texture if needed |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 234 | if (layer->isEmpty()) { |
| 235 | layer->setEmpty(false); |
Romain Guy | 0908764 | 2013-04-04 12:27:54 -0700 | [diff] [blame] | 236 | layer->allocateTexture(); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 237 | |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 238 | // This should only happen if we run out of memory |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 239 | if (glGetError() != GL_NO_ERROR) { |
Romain Guy | ce4a7df | 2013-03-28 11:32:33 -0700 | [diff] [blame] | 240 | ALOGE("Could not allocate texture for layer (fbo=%d %dx%d)", fbo, width, height); |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 241 | renderState.bindFramebuffer(previousFbo); |
John Reck | 0e89e2b | 2014-10-31 14:49:06 -0700 | [diff] [blame] | 242 | layer->decStrong(0); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 243 | return NULL; |
| 244 | } |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 245 | } |
| 246 | |
| 247 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 248 | layer->getTexture(), 0); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 249 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 250 | renderState.bindFramebuffer(previousFbo); |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 251 | |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 252 | return layer; |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 253 | } |
| 254 | |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 255 | bool LayerRenderer::resizeLayer(Layer* layer, uint32_t width, uint32_t height) { |
| 256 | if (layer) { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 257 | LAYER_RENDERER_LOGD("Resizing layer fbo = %d to %dx%d", layer->getFbo(), width, height); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 258 | |
Romain Guy | 2055aba | 2013-01-18 16:42:51 -0800 | [diff] [blame] | 259 | if (layer->resize(width, height)) { |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 260 | layer->layer.set(0.0f, 0.0f, width, height); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 261 | layer->texCoords.set(0.0f, height / float(layer->getHeight()), |
| 262 | width / float(layer->getWidth()), 0.0f); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 263 | } else { |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 264 | return false; |
| 265 | } |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 266 | } |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 267 | |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 268 | return true; |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 269 | } |
| 270 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 271 | Layer* LayerRenderer::createTextureLayer(RenderState& renderState) { |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 272 | LAYER_RENDERER_LOGD("Creating new texture layer"); |
| 273 | |
Chris Craik | 8a226d2 | 2014-09-08 16:40:21 -0700 | [diff] [blame] | 274 | Layer* layer = new Layer(Layer::kType_Texture, renderState, 0, 0); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 275 | layer->setCacheable(false); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 276 | layer->setEmpty(true); |
| 277 | layer->setFbo(0); |
| 278 | layer->setAlpha(255, SkXfermode::kSrcOver_Mode); |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 279 | layer->layer.set(0.0f, 0.0f, 0.0f, 0.0f); |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 280 | layer->texCoords.set(0.0f, 1.0f, 1.0f, 0.0f); |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 281 | layer->region.clear(); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 282 | layer->setRenderTarget(GL_NONE); // see ::updateTextureLayer() |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 283 | |
Romain Guy | a1d3c91 | 2011-12-13 14:55:06 -0800 | [diff] [blame] | 284 | Caches::getInstance().activeTexture(0); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 285 | layer->generateTexture(); |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 286 | |
| 287 | return layer; |
| 288 | } |
| 289 | |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 290 | void LayerRenderer::updateTextureLayer(Layer* layer, uint32_t width, uint32_t height, |
Chris Craik | 9757ac0 | 2014-02-25 18:50:17 -0800 | [diff] [blame] | 291 | bool isOpaque, bool forceFilter, GLenum renderTarget, float* textureTransform) { |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 292 | if (layer) { |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 293 | layer->setBlend(!isOpaque); |
Chris Craik | 9757ac0 | 2014-02-25 18:50:17 -0800 | [diff] [blame] | 294 | layer->setForceFilter(forceFilter); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 295 | layer->setSize(width, height); |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 296 | layer->layer.set(0.0f, 0.0f, width, height); |
| 297 | layer->region.set(width, height); |
| 298 | layer->regionRect.set(0.0f, 0.0f, width, height); |
Chris Craik | 9757ac0 | 2014-02-25 18:50:17 -0800 | [diff] [blame] | 299 | layer->getTexTransform().load(textureTransform); |
Romain Guy | 8f0095c | 2011-05-02 17:24:22 -0700 | [diff] [blame] | 300 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 301 | if (renderTarget != layer->getRenderTarget()) { |
| 302 | layer->setRenderTarget(renderTarget); |
| 303 | layer->bindTexture(); |
Romain Guy | d21b6e1 | 2011-11-30 20:21:23 -0800 | [diff] [blame] | 304 | layer->setFilter(GL_NEAREST, false, true); |
| 305 | layer->setWrap(GL_CLAMP_TO_EDGE, false, true); |
Romain Guy | 4a5a715 | 2011-06-24 17:53:53 -0700 | [diff] [blame] | 306 | } |
Romain Guy | aa6c24c | 2011-04-28 18:40:04 -0700 | [diff] [blame] | 307 | } |
| 308 | } |
| 309 | |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 310 | void LayerRenderer::destroyLayer(Layer* layer) { |
| 311 | if (layer) { |
John Reck | ec4cefc | 2014-07-29 09:49:13 -0700 | [diff] [blame] | 312 | ATRACE_CALL(); |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 313 | LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d", |
| 314 | layer->getWidth(), layer->getHeight(), layer->getFbo()); |
Romain Guy | 1fc883b | 2011-01-12 14:30:59 -0800 | [diff] [blame] | 315 | |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 316 | if (!Caches::getInstance().layerCache.put(layer)) { |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 317 | LAYER_RENDERER_LOGD(" Destroyed!"); |
John Reck | 0e89e2b | 2014-10-31 14:49:06 -0700 | [diff] [blame] | 318 | layer->decStrong(0); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 319 | } else { |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 320 | LAYER_RENDERER_LOGD(" Cached!"); |
Romain Guy | 65b345f | 2011-07-27 18:51:50 -0700 | [diff] [blame] | 321 | #if DEBUG_LAYER_RENDERER |
Romain Guy | eea6069 | 2011-07-26 20:35:55 -0700 | [diff] [blame] | 322 | Caches::getInstance().layerCache.dump(); |
| 323 | #endif |
Chet Haase | 98d3a64 | 2012-09-26 10:27:40 -0700 | [diff] [blame] | 324 | layer->removeFbo(); |
Romain Guy | 09b7c91 | 2011-02-02 20:28:09 -0800 | [diff] [blame] | 325 | layer->region.clear(); |
| 326 | } |
Romain Guy | ada830f | 2011-01-13 12:13:20 -0800 | [diff] [blame] | 327 | } |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 328 | } |
| 329 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 330 | void LayerRenderer::flushLayer(RenderState& renderState, Layer* layer) { |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 331 | #ifdef GL_EXT_discard_framebuffer |
Digish Pandya | 1fa4cef | 2014-06-12 10:42:54 +0530 | [diff] [blame] | 332 | if (!layer) return; |
| 333 | |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 334 | GLuint fbo = layer->getFbo(); |
Digish Pandya | 1fa4cef | 2014-06-12 10:42:54 +0530 | [diff] [blame] | 335 | if (fbo) { |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 336 | // If possible, discard any enqueud operations on deferred |
| 337 | // rendering architectures |
Romain Guy | 3bbacf2 | 2013-02-06 16:51:04 -0800 | [diff] [blame] | 338 | if (Extensions::getInstance().hasDiscardFramebuffer()) { |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 339 | GLuint previousFbo = renderState.getFramebuffer(); |
| 340 | if (fbo != previousFbo) { |
| 341 | renderState.bindFramebuffer(fbo); |
| 342 | } |
Romain Guy | 45e4c3d | 2012-09-11 17:17:07 -0700 | [diff] [blame] | 343 | |
| 344 | const GLenum attachments[] = { GL_COLOR_ATTACHMENT0 }; |
| 345 | glDiscardFramebufferEXT(GL_FRAMEBUFFER, 1, attachments); |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 346 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 347 | if (fbo != previousFbo) { |
| 348 | renderState.bindFramebuffer(previousFbo); |
| 349 | } |
Romain Guy | 9c4b79a | 2011-11-10 19:23:58 -0800 | [diff] [blame] | 350 | } |
| 351 | } |
| 352 | #endif |
| 353 | } |
| 354 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 355 | bool LayerRenderer::copyLayer(RenderState& renderState, Layer* layer, SkBitmap* bitmap) { |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 356 | Caches& caches = Caches::getInstance(); |
Chris Craik | 710f46d | 2012-09-17 17:25:49 -0700 | [diff] [blame] | 357 | if (layer && bitmap->width() <= caches.maxTextureSize && |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 358 | bitmap->height() <= caches.maxTextureSize) { |
| 359 | |
| 360 | GLuint fbo = caches.fboCache.get(); |
| 361 | if (!fbo) { |
Steve Block | 8564c8d | 2012-01-05 23:22:43 +0000 | [diff] [blame] | 362 | ALOGW("Could not obtain an FBO"); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 363 | return false; |
| 364 | } |
| 365 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 366 | SkAutoLockPixels alp(*bitmap); |
| 367 | |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 368 | GLuint texture; |
| 369 | GLuint previousFbo; |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 370 | GLsizei previousViewportWidth; |
| 371 | GLsizei previousViewportHeight; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 372 | |
| 373 | GLenum format; |
| 374 | GLenum type; |
| 375 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 376 | GLenum error = GL_NO_ERROR; |
| 377 | bool status = false; |
| 378 | |
Mike Reed | 1103b32 | 2014-07-08 12:36:44 -0400 | [diff] [blame] | 379 | switch (bitmap->colorType()) { |
| 380 | case kAlpha_8_SkColorType: |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 381 | format = GL_ALPHA; |
| 382 | type = GL_UNSIGNED_BYTE; |
| 383 | break; |
Mike Reed | 1103b32 | 2014-07-08 12:36:44 -0400 | [diff] [blame] | 384 | case kRGB_565_SkColorType: |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 385 | format = GL_RGB; |
| 386 | type = GL_UNSIGNED_SHORT_5_6_5; |
| 387 | break; |
Mike Reed | 1103b32 | 2014-07-08 12:36:44 -0400 | [diff] [blame] | 388 | case kARGB_4444_SkColorType: |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 389 | format = GL_RGBA; |
| 390 | type = GL_UNSIGNED_SHORT_4_4_4_4; |
| 391 | break; |
Mike Reed | 1103b32 | 2014-07-08 12:36:44 -0400 | [diff] [blame] | 392 | case kN32_SkColorType: |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 393 | default: |
| 394 | format = GL_RGBA; |
| 395 | type = GL_UNSIGNED_BYTE; |
| 396 | break; |
| 397 | } |
| 398 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 399 | float alpha = layer->getAlpha(); |
| 400 | SkXfermode::Mode mode = layer->getMode(); |
Chris Craik | 710f46d | 2012-09-17 17:25:49 -0700 | [diff] [blame] | 401 | GLuint previousLayerFbo = layer->getFbo(); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 402 | |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 403 | layer->setAlpha(255, SkXfermode::kSrc_Mode); |
| 404 | layer->setFbo(fbo); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 405 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 406 | previousFbo = renderState.getFramebuffer(); |
| 407 | renderState.getViewport(&previousViewportWidth, &previousViewportHeight); |
| 408 | renderState.bindFramebuffer(fbo); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 409 | |
| 410 | glGenTextures(1, &texture); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 411 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 412 | |
Romain Guy | a1d3c91 | 2011-12-13 14:55:06 -0800 | [diff] [blame] | 413 | caches.activeTexture(0); |
Romain Guy | 8aa195d | 2013-06-04 18:00:09 -0700 | [diff] [blame] | 414 | caches.bindTexture(texture); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 415 | |
Romain Guy | e49d7ec | 2012-09-07 18:42:38 -0700 | [diff] [blame] | 416 | glPixelStorei(GL_PACK_ALIGNMENT, bitmap->bytesPerPixel()); |
| 417 | |
Romain Guy | ec19b4a | 2011-07-07 21:05:04 -0700 | [diff] [blame] | 418 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); |
| 419 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 420 | |
| 421 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); |
| 422 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); |
| 423 | |
| 424 | glTexImage2D(GL_TEXTURE_2D, 0, format, bitmap->width(), bitmap->height(), |
| 425 | 0, format, type, NULL); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 426 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
| 427 | |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 428 | glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 429 | GL_TEXTURE_2D, texture, 0); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 430 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 431 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 432 | { |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 433 | LayerRenderer renderer(renderState, layer); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 434 | renderer.setViewport(bitmap->width(), bitmap->height()); |
| 435 | renderer.OpenGLRenderer::prepareDirty(0.0f, 0.0f, |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 436 | bitmap->width(), bitmap->height(), !layer->isBlend()); |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 437 | |
Romain Guy | 586cae3 | 2012-07-13 15:28:31 -0700 | [diff] [blame] | 438 | caches.disableScissor(); |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 439 | renderer.translate(0.0f, bitmap->height()); |
| 440 | renderer.scale(1.0f, -1.0f); |
| 441 | |
| 442 | mat4 texTransform(layer->getTexTransform()); |
| 443 | |
| 444 | mat4 invert; |
Romain Guy | 4c2547f | 2013-06-11 16:19:24 -0700 | [diff] [blame] | 445 | invert.translate(0.0f, 1.0f); |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 446 | invert.scale(1.0f, -1.0f, 1.0f); |
| 447 | layer->getTexTransform().multiply(invert); |
| 448 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 449 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 450 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 451 | { |
| 452 | Rect bounds; |
| 453 | bounds.set(0.0f, 0.0f, bitmap->width(), bitmap->height()); |
| 454 | renderer.drawTextureLayer(layer, bounds); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 455 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 456 | glReadPixels(0, 0, bitmap->width(), bitmap->height(), format, |
| 457 | type, bitmap->getPixels()); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 458 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 459 | if ((error = glGetError()) != GL_NO_ERROR) goto error; |
| 460 | } |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 461 | |
Romain Guy | a9dc86b | 2011-10-11 14:06:21 -0700 | [diff] [blame] | 462 | layer->getTexTransform().load(texTransform); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 463 | status = true; |
| 464 | } |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 465 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 466 | error: |
| 467 | #if DEBUG_OPENGL |
| 468 | if (error != GL_NO_ERROR) { |
Steve Block | 5baa3a6 | 2011-12-20 16:23:08 +0000 | [diff] [blame] | 469 | ALOGD("GL error while copying layer into bitmap = 0x%x", error); |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 470 | } |
| 471 | #endif |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 472 | |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 473 | renderState.bindFramebuffer(previousFbo); |
Romain Guy | 9ace8f5 | 2011-07-07 20:50:11 -0700 | [diff] [blame] | 474 | layer->setAlpha(alpha, mode); |
Chris Craik | 710f46d | 2012-09-17 17:25:49 -0700 | [diff] [blame] | 475 | layer->setFbo(previousLayerFbo); |
Romain Guy | be1b127 | 2013-06-06 14:02:54 -0700 | [diff] [blame] | 476 | caches.deleteTexture(texture); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 477 | caches.fboCache.put(fbo); |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 478 | renderState.setViewport(previousViewportWidth, previousViewportHeight); |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 479 | |
Romain Guy | d6b2a00 | 2011-06-17 17:45:59 -0700 | [diff] [blame] | 480 | return status; |
Romain Guy | 77a8116 | 2011-06-14 16:45:55 -0700 | [diff] [blame] | 481 | } |
| 482 | return false; |
| 483 | } |
| 484 | |
Romain Guy | 6c319ca | 2011-01-11 14:29:25 -0800 | [diff] [blame] | 485 | }; // namespace uirenderer |
| 486 | }; // namespace android |