John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2014 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 ATRACE_TAG ATRACE_TAG_VIEW |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 18 | #define LOG_TAG "OpenGLRenderer" |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 19 | |
| 20 | #include "RenderNode.h" |
| 21 | |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 22 | #include <algorithm> |
John Reck | c25e506 | 2014-06-18 14:21:29 -0700 | [diff] [blame] | 23 | #include <string> |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 24 | |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 25 | #include <SkCanvas.h> |
| 26 | #include <algorithm> |
| 27 | |
| 28 | #include <utils/Trace.h> |
| 29 | |
John Reck | e4267ea | 2014-06-03 15:53:15 -0700 | [diff] [blame] | 30 | #include "DamageAccumulator.h" |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 31 | #include "Debug.h" |
| 32 | #include "DisplayListOp.h" |
| 33 | #include "DisplayListLogBuffer.h" |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 34 | #include "LayerRenderer.h" |
| 35 | #include "OpenGLRenderer.h" |
Chris Craik | e0bb87d | 2014-04-22 17:55:41 -0700 | [diff] [blame] | 36 | #include "utils/MathUtils.h" |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 37 | |
| 38 | namespace android { |
| 39 | namespace uirenderer { |
| 40 | |
| 41 | void RenderNode::outputLogBuffer(int fd) { |
| 42 | DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); |
| 43 | if (logBuffer.isEmpty()) { |
| 44 | return; |
| 45 | } |
| 46 | |
| 47 | FILE *file = fdopen(fd, "a"); |
| 48 | |
| 49 | fprintf(file, "\nRecent DisplayList operations\n"); |
| 50 | logBuffer.outputCommands(file); |
| 51 | |
| 52 | String8 cachesLog; |
| 53 | Caches::getInstance().dumpMemoryUsage(cachesLog); |
| 54 | fprintf(file, "\nCaches:\n%s", cachesLog.string()); |
| 55 | fprintf(file, "\n"); |
| 56 | |
| 57 | fflush(file); |
| 58 | } |
| 59 | |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 60 | RenderNode::RenderNode() |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 61 | : mDirtyPropertyFields(0) |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 62 | , mNeedsDisplayListDataSync(false) |
| 63 | , mDisplayListData(0) |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 64 | , mStagingDisplayListData(0) |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 65 | , mAnimatorManager(*this) |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 66 | , mLayer(0) |
| 67 | , mParentCount(0) { |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 68 | } |
| 69 | |
| 70 | RenderNode::~RenderNode() { |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 71 | deleteDisplayListData(); |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 72 | delete mStagingDisplayListData; |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 73 | LayerRenderer::destroyLayerDeferred(mLayer); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 74 | } |
| 75 | |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 76 | void RenderNode::setStagingDisplayList(DisplayListData* data) { |
| 77 | mNeedsDisplayListDataSync = true; |
| 78 | delete mStagingDisplayListData; |
| 79 | mStagingDisplayListData = data; |
| 80 | if (mStagingDisplayListData) { |
John Reck | 09d5cdd | 2014-07-24 10:36:08 -0700 | [diff] [blame^] | 81 | Caches::getInstance().registerFunctors(mStagingDisplayListData->functors.size()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 82 | } |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * This function is a simplified version of replay(), where we simply retrieve and log the |
| 87 | * display list. This function should remain in sync with the replay() function. |
| 88 | */ |
| 89 | void RenderNode::output(uint32_t level) { |
| 90 | ALOGD("%*sStart display list (%p, %s, render=%d)", (level - 1) * 2, "", this, |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 91 | getName(), isRenderable()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 92 | ALOGD("%*s%s %d", level * 2, "", "Save", |
| 93 | SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); |
| 94 | |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 95 | properties().debugOutputProperties(level); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 96 | int flags = DisplayListOp::kOpLogFlag_Recurse; |
| 97 | for (unsigned int i = 0; i < mDisplayListData->displayListOps.size(); i++) { |
| 98 | mDisplayListData->displayListOps[i]->output(level, flags); |
| 99 | } |
| 100 | |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 101 | ALOGD("%*sDone (%p, %s)", (level - 1) * 2, "", this, getName()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 102 | } |
| 103 | |
John Reck | fe5e7b7 | 2014-05-23 17:42:28 -0700 | [diff] [blame] | 104 | int RenderNode::getDebugSize() { |
| 105 | int size = sizeof(RenderNode); |
| 106 | if (mStagingDisplayListData) { |
| 107 | size += mStagingDisplayListData->allocator.usedSize(); |
| 108 | } |
| 109 | if (mDisplayListData && mDisplayListData != mStagingDisplayListData) { |
| 110 | size += mDisplayListData->allocator.usedSize(); |
| 111 | } |
| 112 | return size; |
| 113 | } |
| 114 | |
John Reck | f4198b7 | 2014-04-09 17:00:04 -0700 | [diff] [blame] | 115 | void RenderNode::prepareTree(TreeInfo& info) { |
| 116 | ATRACE_CALL(); |
| 117 | |
| 118 | prepareTreeImpl(info); |
| 119 | } |
| 120 | |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 121 | void RenderNode::addAnimator(const sp<BaseRenderNodeAnimator>& animator) { |
| 122 | mAnimatorManager.addAnimator(animator); |
| 123 | } |
| 124 | |
John Reck | e4267ea | 2014-06-03 15:53:15 -0700 | [diff] [blame] | 125 | void RenderNode::damageSelf(TreeInfo& info) { |
John Reck | ce9f308 | 2014-06-17 16:18:09 -0700 | [diff] [blame] | 126 | if (isRenderable()) { |
John Reck | 293e868 | 2014-06-17 10:34:02 -0700 | [diff] [blame] | 127 | if (properties().getClipDamageToBounds()) { |
John Reck | a447d29 | 2014-06-11 18:39:44 -0700 | [diff] [blame] | 128 | info.damageAccumulator->dirty(0, 0, properties().getWidth(), properties().getHeight()); |
| 129 | } else { |
| 130 | // Hope this is big enough? |
| 131 | // TODO: Get this from the display list ops or something |
| 132 | info.damageAccumulator->dirty(INT_MIN, INT_MIN, INT_MAX, INT_MAX); |
| 133 | } |
John Reck | e4267ea | 2014-06-03 15:53:15 -0700 | [diff] [blame] | 134 | } |
| 135 | } |
| 136 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 137 | void RenderNode::prepareLayer(TreeInfo& info) { |
| 138 | LayerType layerType = properties().layerProperties().type(); |
| 139 | if (CC_UNLIKELY(layerType == kLayerTypeRenderLayer)) { |
| 140 | // We push a null transform here as we don't care what the existing dirty |
| 141 | // area is, only what our display list dirty is as well as our children's |
| 142 | // dirty area |
| 143 | info.damageAccumulator->pushNullTransform(); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | void RenderNode::pushLayerUpdate(TreeInfo& info) { |
| 148 | LayerType layerType = properties().layerProperties().type(); |
| 149 | // If we are not a layer OR we cannot be rendered (eg, view was detached) |
| 150 | // we need to destroy any Layers we may have had previously |
| 151 | if (CC_LIKELY(layerType != kLayerTypeRenderLayer) || CC_UNLIKELY(!isRenderable())) { |
| 152 | if (layerType == kLayerTypeRenderLayer) { |
| 153 | info.damageAccumulator->popTransform(); |
| 154 | } |
| 155 | if (CC_UNLIKELY(mLayer)) { |
| 156 | LayerRenderer::destroyLayer(mLayer); |
| 157 | mLayer = NULL; |
| 158 | } |
| 159 | return; |
| 160 | } |
| 161 | |
| 162 | if (!mLayer) { |
John Reck | 3b20251 | 2014-06-23 13:13:08 -0700 | [diff] [blame] | 163 | mLayer = LayerRenderer::createRenderLayer(info.renderState, getWidth(), getHeight()); |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 164 | applyLayerPropertiesToLayer(info); |
| 165 | damageSelf(info); |
| 166 | } else if (mLayer->layer.getWidth() != getWidth() || mLayer->layer.getHeight() != getHeight()) { |
John Reck | c25e506 | 2014-06-18 14:21:29 -0700 | [diff] [blame] | 167 | if (!LayerRenderer::resizeLayer(mLayer, getWidth(), getHeight())) { |
| 168 | LayerRenderer::destroyLayer(mLayer); |
| 169 | mLayer = 0; |
| 170 | } |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 171 | damageSelf(info); |
| 172 | } |
| 173 | |
| 174 | SkRect dirty; |
| 175 | info.damageAccumulator->peekAtDirty(&dirty); |
| 176 | info.damageAccumulator->popTransform(); |
| 177 | |
John Reck | c25e506 | 2014-06-18 14:21:29 -0700 | [diff] [blame] | 178 | if (!mLayer) { |
| 179 | if (info.errorHandler) { |
| 180 | std::string msg = "Unable to create layer for "; |
| 181 | msg += getName(); |
| 182 | info.errorHandler->onError(msg); |
| 183 | } |
| 184 | return; |
| 185 | } |
| 186 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 187 | if (!dirty.isEmpty()) { |
| 188 | mLayer->updateDeferred(this, dirty.fLeft, dirty.fTop, dirty.fRight, dirty.fBottom); |
| 189 | } |
| 190 | // This is not inside the above if because we may have called |
| 191 | // updateDeferred on a previous prepare pass that didn't have a renderer |
| 192 | if (info.renderer && mLayer->deferredUpdateScheduled) { |
| 193 | info.renderer->pushLayerUpdate(mLayer); |
| 194 | } |
| 195 | } |
| 196 | |
John Reck | e4267ea | 2014-06-03 15:53:15 -0700 | [diff] [blame] | 197 | void RenderNode::prepareTreeImpl(TreeInfo& info) { |
John Reck | a447d29 | 2014-06-11 18:39:44 -0700 | [diff] [blame] | 198 | info.damageAccumulator->pushTransform(this); |
John Reck | f47a594 | 2014-06-30 16:20:04 -0700 | [diff] [blame] | 199 | |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 200 | if (info.mode == TreeInfo::MODE_FULL) { |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 201 | pushStagingPropertiesChanges(info); |
John Reck | e45b1fd | 2014-04-15 09:50:16 -0700 | [diff] [blame] | 202 | } |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 203 | mAnimatorManager.animate(info); |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 204 | prepareLayer(info); |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 205 | if (info.mode == TreeInfo::MODE_FULL) { |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 206 | pushStagingDisplayListChanges(info); |
| 207 | } |
John Reck | f4198b7 | 2014-04-09 17:00:04 -0700 | [diff] [blame] | 208 | prepareSubTree(info, mDisplayListData); |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 209 | pushLayerUpdate(info); |
| 210 | |
John Reck | a447d29 | 2014-06-11 18:39:44 -0700 | [diff] [blame] | 211 | info.damageAccumulator->popTransform(); |
John Reck | f4198b7 | 2014-04-09 17:00:04 -0700 | [diff] [blame] | 212 | } |
| 213 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 214 | void RenderNode::pushStagingPropertiesChanges(TreeInfo& info) { |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 215 | // Push the animators first so that setupStartValueIfNecessary() is called |
| 216 | // before properties() is trampled by stagingProperties(), as they are |
| 217 | // required by some animators. |
John Reck | 68bfe0a | 2014-06-24 15:34:58 -0700 | [diff] [blame] | 218 | mAnimatorManager.pushStaging(info); |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 219 | if (mDirtyPropertyFields) { |
| 220 | mDirtyPropertyFields = 0; |
John Reck | e4267ea | 2014-06-03 15:53:15 -0700 | [diff] [blame] | 221 | damageSelf(info); |
John Reck | a447d29 | 2014-06-11 18:39:44 -0700 | [diff] [blame] | 222 | info.damageAccumulator->popTransform(); |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 223 | mProperties = mStagingProperties; |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 224 | applyLayerPropertiesToLayer(info); |
John Reck | e4267ea | 2014-06-03 15:53:15 -0700 | [diff] [blame] | 225 | // We could try to be clever and only re-damage if the matrix changed. |
| 226 | // However, we don't need to worry about that. The cost of over-damaging |
| 227 | // here is only going to be a single additional map rect of this node |
| 228 | // plus a rect join(). The parent's transform (and up) will only be |
| 229 | // performed once. |
John Reck | a447d29 | 2014-06-11 18:39:44 -0700 | [diff] [blame] | 230 | info.damageAccumulator->pushTransform(this); |
John Reck | e4267ea | 2014-06-03 15:53:15 -0700 | [diff] [blame] | 231 | damageSelf(info); |
John Reck | ff941dc | 2014-05-14 16:34:14 -0700 | [diff] [blame] | 232 | } |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 233 | } |
| 234 | |
| 235 | void RenderNode::applyLayerPropertiesToLayer(TreeInfo& info) { |
| 236 | if (CC_LIKELY(!mLayer)) return; |
| 237 | |
| 238 | const LayerProperties& props = properties().layerProperties(); |
| 239 | mLayer->setAlpha(props.alpha(), props.xferMode()); |
| 240 | mLayer->setColorFilter(props.colorFilter()); |
| 241 | mLayer->setBlend(props.needsBlending()); |
| 242 | } |
| 243 | |
| 244 | void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) { |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 245 | if (mNeedsDisplayListDataSync) { |
| 246 | mNeedsDisplayListDataSync = false; |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 247 | // Make sure we inc first so that we don't fluctuate between 0 and 1, |
| 248 | // which would thrash the layer cache |
| 249 | if (mStagingDisplayListData) { |
| 250 | for (size_t i = 0; i < mStagingDisplayListData->children().size(); i++) { |
| 251 | mStagingDisplayListData->children()[i]->mRenderNode->incParentRefCount(); |
| 252 | } |
| 253 | } |
| 254 | deleteDisplayListData(); |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 255 | mDisplayListData = mStagingDisplayListData; |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 256 | mStagingDisplayListData = NULL; |
John Reck | 09d5cdd | 2014-07-24 10:36:08 -0700 | [diff] [blame^] | 257 | if (mDisplayListData) { |
| 258 | for (size_t i = 0; i < mDisplayListData->functors.size(); i++) { |
| 259 | (*mDisplayListData->functors[i])(DrawGlInfo::kModeSync, NULL); |
| 260 | } |
| 261 | } |
John Reck | e4267ea | 2014-06-03 15:53:15 -0700 | [diff] [blame] | 262 | damageSelf(info); |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 263 | } |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 264 | } |
| 265 | |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 266 | void RenderNode::deleteDisplayListData() { |
| 267 | if (mDisplayListData) { |
| 268 | for (size_t i = 0; i < mDisplayListData->children().size(); i++) { |
| 269 | mDisplayListData->children()[i]->mRenderNode->decParentRefCount(); |
| 270 | } |
| 271 | } |
| 272 | delete mDisplayListData; |
| 273 | mDisplayListData = NULL; |
| 274 | } |
| 275 | |
John Reck | f4198b7 | 2014-04-09 17:00:04 -0700 | [diff] [blame] | 276 | void RenderNode::prepareSubTree(TreeInfo& info, DisplayListData* subtree) { |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 277 | if (subtree) { |
John Reck | 860d155 | 2014-04-11 19:15:05 -0700 | [diff] [blame] | 278 | TextureCache& cache = Caches::getInstance().textureCache; |
John Reck | 09d5cdd | 2014-07-24 10:36:08 -0700 | [diff] [blame^] | 279 | info.out.hasFunctors |= subtree->functors.size(); |
John Reck | 860d155 | 2014-04-11 19:15:05 -0700 | [diff] [blame] | 280 | // TODO: Fix ownedBitmapResources to not require disabling prepareTextures |
| 281 | // and thus falling out of async drawing path. |
| 282 | if (subtree->ownedBitmapResources.size()) { |
| 283 | info.prepareTextures = false; |
| 284 | } |
| 285 | for (size_t i = 0; info.prepareTextures && i < subtree->bitmapResources.size(); i++) { |
| 286 | info.prepareTextures = cache.prefetchAndMarkInUse(subtree->bitmapResources[i]); |
John Reck | f4198b7 | 2014-04-09 17:00:04 -0700 | [diff] [blame] | 287 | } |
John Reck | 8de65a8 | 2014-04-09 15:23:38 -0700 | [diff] [blame] | 288 | for (size_t i = 0; i < subtree->children().size(); i++) { |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 289 | DrawRenderNodeOp* op = subtree->children()[i]; |
| 290 | RenderNode* childNode = op->mRenderNode; |
John Reck | a447d29 | 2014-06-11 18:39:44 -0700 | [diff] [blame] | 291 | info.damageAccumulator->pushTransform(&op->mTransformFromParent); |
John Reck | f4198b7 | 2014-04-09 17:00:04 -0700 | [diff] [blame] | 292 | childNode->prepareTreeImpl(info); |
John Reck | a447d29 | 2014-06-11 18:39:44 -0700 | [diff] [blame] | 293 | info.damageAccumulator->popTransform(); |
John Reck | 5bf11bb | 2014-03-25 10:22:09 -0700 | [diff] [blame] | 294 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 295 | } |
| 296 | } |
| 297 | |
John Reck | dcba672 | 2014-07-08 13:59:49 -0700 | [diff] [blame] | 298 | void RenderNode::destroyHardwareResources() { |
| 299 | if (mLayer) { |
| 300 | LayerRenderer::destroyLayer(mLayer); |
| 301 | mLayer = NULL; |
| 302 | } |
| 303 | if (mDisplayListData) { |
| 304 | for (size_t i = 0; i < mDisplayListData->children().size(); i++) { |
| 305 | mDisplayListData->children()[i]->mRenderNode->destroyHardwareResources(); |
| 306 | } |
| 307 | if (mNeedsDisplayListDataSync) { |
| 308 | // Next prepare tree we are going to push a new display list, so we can |
| 309 | // drop our current one now |
| 310 | deleteDisplayListData(); |
| 311 | } |
| 312 | } |
| 313 | } |
| 314 | |
| 315 | void RenderNode::decParentRefCount() { |
| 316 | LOG_ALWAYS_FATAL_IF(!mParentCount, "already 0!"); |
| 317 | mParentCount--; |
| 318 | if (!mParentCount) { |
| 319 | // If a child of ours is being attached to our parent then this will incorrectly |
| 320 | // destroy its hardware resources. However, this situation is highly unlikely |
| 321 | // and the failure is "just" that the layer is re-created, so this should |
| 322 | // be safe enough |
| 323 | destroyHardwareResources(); |
| 324 | } |
| 325 | } |
| 326 | |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 327 | /* |
| 328 | * For property operations, we pass a savecount of 0, since the operations aren't part of the |
| 329 | * displaylist, and thus don't have to compensate for the record-time/playback-time discrepancy in |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 330 | * base saveCount (i.e., how RestoreToCount uses saveCount + properties().getCount()) |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 331 | */ |
| 332 | #define PROPERTY_SAVECOUNT 0 |
| 333 | |
| 334 | template <class T> |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 335 | void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) { |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 336 | #if DEBUG_DISPLAY_LIST |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 337 | properties().debugOutputProperties(handler.level() + 1); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 338 | #endif |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 339 | if (properties().getLeft() != 0 || properties().getTop() != 0) { |
| 340 | renderer.translate(properties().getLeft(), properties().getTop()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 341 | } |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 342 | if (properties().getStaticMatrix()) { |
Derek Sollenberger | 1390882 | 2013-12-10 12:28:58 -0500 | [diff] [blame] | 343 | renderer.concatMatrix(*properties().getStaticMatrix()); |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 344 | } else if (properties().getAnimationMatrix()) { |
Derek Sollenberger | 1390882 | 2013-12-10 12:28:58 -0500 | [diff] [blame] | 345 | renderer.concatMatrix(*properties().getAnimationMatrix()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 346 | } |
John Reck | f7483e3 | 2014-04-11 08:54:47 -0700 | [diff] [blame] | 347 | if (properties().hasTransformMatrix()) { |
| 348 | if (properties().isTransformTranslateOnly()) { |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 349 | renderer.translate(properties().getTranslationX(), properties().getTranslationY()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 350 | } else { |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 351 | renderer.concatMatrix(*properties().getTransformMatrix()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 352 | } |
| 353 | } |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 354 | const bool isLayer = properties().layerProperties().type() != kLayerTypeNone; |
| 355 | bool clipToBoundsNeeded = isLayer ? false : properties().getClipToBounds(); |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 356 | if (properties().getAlpha() < 1) { |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 357 | if (isLayer) { |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 358 | renderer.setOverrideLayerAlpha(properties().getAlpha()); |
| 359 | } else if (!properties().getHasOverlappingRendering()) { |
| 360 | renderer.scaleAlpha(properties().getAlpha()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 361 | } else { |
| 362 | // TODO: should be able to store the size of a DL at record time and not |
| 363 | // have to pass it into this call. In fact, this information might be in the |
| 364 | // location/size info that we store with the new native transform data. |
| 365 | int saveFlags = SkCanvas::kHasAlphaLayer_SaveFlag; |
| 366 | if (clipToBoundsNeeded) { |
| 367 | saveFlags |= SkCanvas::kClipToLayer_SaveFlag; |
| 368 | clipToBoundsNeeded = false; // clipping done by saveLayer |
| 369 | } |
| 370 | |
| 371 | SaveLayerOp* op = new (handler.allocator()) SaveLayerOp( |
Chris Craik | 8c271ca | 2014-03-25 10:33:01 -0700 | [diff] [blame] | 372 | 0, 0, properties().getWidth(), properties().getHeight(), |
| 373 | properties().getAlpha() * 255, saveFlags); |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 374 | handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 375 | } |
| 376 | } |
| 377 | if (clipToBoundsNeeded) { |
Chris Craik | 8c271ca | 2014-03-25 10:33:01 -0700 | [diff] [blame] | 378 | ClipRectOp* op = new (handler.allocator()) ClipRectOp( |
| 379 | 0, 0, properties().getWidth(), properties().getHeight(), SkRegion::kIntersect_Op); |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 380 | handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 381 | } |
Chris Craik | 8c271ca | 2014-03-25 10:33:01 -0700 | [diff] [blame] | 382 | |
| 383 | if (CC_UNLIKELY(properties().hasClippingPath())) { |
Chris Craik | 2bcad17 | 2014-05-14 18:11:23 -0700 | [diff] [blame] | 384 | ClipPathOp* op = new (handler.allocator()) ClipPathOp( |
| 385 | properties().getClippingPath(), properties().getClippingPathOp()); |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 386 | handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 387 | } |
| 388 | } |
| 389 | |
| 390 | /** |
| 391 | * Apply property-based transformations to input matrix |
| 392 | * |
| 393 | * If true3dTransform is set to true, the transform applied to the input matrix will use true 4x4 |
| 394 | * matrix computation instead of the Skia 3x3 matrix + camera hackery. |
| 395 | */ |
| 396 | void RenderNode::applyViewPropertyTransforms(mat4& matrix, bool true3dTransform) { |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 397 | if (properties().getLeft() != 0 || properties().getTop() != 0) { |
| 398 | matrix.translate(properties().getLeft(), properties().getTop()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 399 | } |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 400 | if (properties().getStaticMatrix()) { |
| 401 | mat4 stat(*properties().getStaticMatrix()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 402 | matrix.multiply(stat); |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 403 | } else if (properties().getAnimationMatrix()) { |
| 404 | mat4 anim(*properties().getAnimationMatrix()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 405 | matrix.multiply(anim); |
| 406 | } |
Chris Craik | e0bb87d | 2014-04-22 17:55:41 -0700 | [diff] [blame] | 407 | |
Chris Craik | cc39e16 | 2014-04-25 18:34:11 -0700 | [diff] [blame] | 408 | bool applyTranslationZ = true3dTransform && !MathUtils::isZero(properties().getZ()); |
Chris Craik | e0bb87d | 2014-04-22 17:55:41 -0700 | [diff] [blame] | 409 | if (properties().hasTransformMatrix() || applyTranslationZ) { |
John Reck | f7483e3 | 2014-04-11 08:54:47 -0700 | [diff] [blame] | 410 | if (properties().isTransformTranslateOnly()) { |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 411 | matrix.translate(properties().getTranslationX(), properties().getTranslationY(), |
Chris Craik | cc39e16 | 2014-04-25 18:34:11 -0700 | [diff] [blame] | 412 | true3dTransform ? properties().getZ() : 0.0f); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 413 | } else { |
| 414 | if (!true3dTransform) { |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 415 | matrix.multiply(*properties().getTransformMatrix()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 416 | } else { |
| 417 | mat4 true3dMat; |
| 418 | true3dMat.loadTranslate( |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 419 | properties().getPivotX() + properties().getTranslationX(), |
| 420 | properties().getPivotY() + properties().getTranslationY(), |
Chris Craik | cc39e16 | 2014-04-25 18:34:11 -0700 | [diff] [blame] | 421 | properties().getZ()); |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 422 | true3dMat.rotate(properties().getRotationX(), 1, 0, 0); |
| 423 | true3dMat.rotate(properties().getRotationY(), 0, 1, 0); |
| 424 | true3dMat.rotate(properties().getRotation(), 0, 0, 1); |
| 425 | true3dMat.scale(properties().getScaleX(), properties().getScaleY(), 1); |
| 426 | true3dMat.translate(-properties().getPivotX(), -properties().getPivotY()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 427 | |
| 428 | matrix.multiply(true3dMat); |
| 429 | } |
| 430 | } |
| 431 | } |
| 432 | } |
| 433 | |
| 434 | /** |
| 435 | * Organizes the DisplayList hierarchy to prepare for background projection reordering. |
| 436 | * |
| 437 | * This should be called before a call to defer() or drawDisplayList() |
| 438 | * |
| 439 | * Each DisplayList that serves as a 3d root builds its list of composited children, |
| 440 | * which are flagged to not draw in the standard draw loop. |
| 441 | */ |
| 442 | void RenderNode::computeOrdering() { |
| 443 | ATRACE_CALL(); |
| 444 | mProjectedNodes.clear(); |
| 445 | |
| 446 | // TODO: create temporary DDLOp and call computeOrderingImpl on top DisplayList so that |
| 447 | // transform properties are applied correctly to top level children |
| 448 | if (mDisplayListData == NULL) return; |
John Reck | 087bc0c | 2014-04-04 16:20:08 -0700 | [diff] [blame] | 449 | for (unsigned int i = 0; i < mDisplayListData->children().size(); i++) { |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 450 | DrawRenderNodeOp* childOp = mDisplayListData->children()[i]; |
| 451 | childOp->mRenderNode->computeOrderingImpl(childOp, |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 452 | properties().getOutline().getPath(), &mProjectedNodes, &mat4::identity()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 453 | } |
| 454 | } |
| 455 | |
| 456 | void RenderNode::computeOrderingImpl( |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 457 | DrawRenderNodeOp* opState, |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 458 | const SkPath* outlineOfProjectionSurface, |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 459 | Vector<DrawRenderNodeOp*>* compositedChildrenOfProjectionSurface, |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 460 | const mat4* transformFromProjectionSurface) { |
| 461 | mProjectedNodes.clear(); |
| 462 | if (mDisplayListData == NULL || mDisplayListData->isEmpty()) return; |
| 463 | |
| 464 | // TODO: should avoid this calculation in most cases |
| 465 | // TODO: just calculate single matrix, down to all leaf composited elements |
| 466 | Matrix4 localTransformFromProjectionSurface(*transformFromProjectionSurface); |
| 467 | localTransformFromProjectionSurface.multiply(opState->mTransformFromParent); |
| 468 | |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 469 | if (properties().getProjectBackwards()) { |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 470 | // composited projectee, flag for out of order draw, save matrix, and store in proj surface |
| 471 | opState->mSkipInOrderDraw = true; |
| 472 | opState->mTransformFromCompositingAncestor.load(localTransformFromProjectionSurface); |
| 473 | compositedChildrenOfProjectionSurface->add(opState); |
| 474 | } else { |
| 475 | // standard in order draw |
| 476 | opState->mSkipInOrderDraw = false; |
| 477 | } |
| 478 | |
John Reck | 087bc0c | 2014-04-04 16:20:08 -0700 | [diff] [blame] | 479 | if (mDisplayListData->children().size() > 0) { |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 480 | const bool isProjectionReceiver = mDisplayListData->projectionReceiveIndex >= 0; |
| 481 | bool haveAppliedPropertiesToProjection = false; |
John Reck | 087bc0c | 2014-04-04 16:20:08 -0700 | [diff] [blame] | 482 | for (unsigned int i = 0; i < mDisplayListData->children().size(); i++) { |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 483 | DrawRenderNodeOp* childOp = mDisplayListData->children()[i]; |
| 484 | RenderNode* child = childOp->mRenderNode; |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 485 | |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 486 | const SkPath* projectionOutline = NULL; |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 487 | Vector<DrawRenderNodeOp*>* projectionChildren = NULL; |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 488 | const mat4* projectionTransform = NULL; |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 489 | if (isProjectionReceiver && !child->properties().getProjectBackwards()) { |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 490 | // if receiving projections, collect projecting descendent |
| 491 | |
| 492 | // Note that if a direct descendent is projecting backwards, we pass it's |
| 493 | // grandparent projection collection, since it shouldn't project onto it's |
| 494 | // parent, where it will already be drawing. |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 495 | projectionOutline = properties().getOutline().getPath(); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 496 | projectionChildren = &mProjectedNodes; |
| 497 | projectionTransform = &mat4::identity(); |
| 498 | } else { |
| 499 | if (!haveAppliedPropertiesToProjection) { |
| 500 | applyViewPropertyTransforms(localTransformFromProjectionSurface); |
| 501 | haveAppliedPropertiesToProjection = true; |
| 502 | } |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 503 | projectionOutline = outlineOfProjectionSurface; |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 504 | projectionChildren = compositedChildrenOfProjectionSurface; |
| 505 | projectionTransform = &localTransformFromProjectionSurface; |
| 506 | } |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 507 | child->computeOrderingImpl(childOp, |
| 508 | projectionOutline, projectionChildren, projectionTransform); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 509 | } |
| 510 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 511 | } |
| 512 | |
| 513 | class DeferOperationHandler { |
| 514 | public: |
| 515 | DeferOperationHandler(DeferStateStruct& deferStruct, int level) |
| 516 | : mDeferStruct(deferStruct), mLevel(level) {} |
| 517 | inline void operator()(DisplayListOp* operation, int saveCount, bool clipToBounds) { |
| 518 | operation->defer(mDeferStruct, saveCount, mLevel, clipToBounds); |
| 519 | } |
| 520 | inline LinearAllocator& allocator() { return *(mDeferStruct.mAllocator); } |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 521 | inline void startMark(const char* name) {} // do nothing |
| 522 | inline void endMark() {} |
| 523 | inline int level() { return mLevel; } |
| 524 | inline int replayFlags() { return mDeferStruct.mReplayFlags; } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 525 | |
| 526 | private: |
| 527 | DeferStateStruct& mDeferStruct; |
| 528 | const int mLevel; |
| 529 | }; |
| 530 | |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 531 | void RenderNode::defer(DeferStateStruct& deferStruct, const int level) { |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 532 | DeferOperationHandler handler(deferStruct, level); |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 533 | issueOperations<DeferOperationHandler>(deferStruct.mRenderer, handler); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 534 | } |
| 535 | |
| 536 | class ReplayOperationHandler { |
| 537 | public: |
| 538 | ReplayOperationHandler(ReplayStateStruct& replayStruct, int level) |
| 539 | : mReplayStruct(replayStruct), mLevel(level) {} |
| 540 | inline void operator()(DisplayListOp* operation, int saveCount, bool clipToBounds) { |
| 541 | #if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 542 | mReplayStruct.mRenderer.eventMark(operation->name()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 543 | #endif |
| 544 | operation->replay(mReplayStruct, saveCount, mLevel, clipToBounds); |
| 545 | } |
| 546 | inline LinearAllocator& allocator() { return *(mReplayStruct.mAllocator); } |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 547 | inline void startMark(const char* name) { |
| 548 | mReplayStruct.mRenderer.startMark(name); |
| 549 | } |
| 550 | inline void endMark() { |
| 551 | mReplayStruct.mRenderer.endMark(); |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 552 | } |
| 553 | inline int level() { return mLevel; } |
| 554 | inline int replayFlags() { return mReplayStruct.mReplayFlags; } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 555 | |
| 556 | private: |
| 557 | ReplayStateStruct& mReplayStruct; |
| 558 | const int mLevel; |
| 559 | }; |
| 560 | |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 561 | void RenderNode::replay(ReplayStateStruct& replayStruct, const int level) { |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 562 | ReplayOperationHandler handler(replayStruct, level); |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 563 | issueOperations<ReplayOperationHandler>(replayStruct.mRenderer, handler); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 564 | } |
| 565 | |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 566 | void RenderNode::buildZSortedChildList(Vector<ZDrawRenderNodeOpPair>& zTranslatedNodes) { |
John Reck | 087bc0c | 2014-04-04 16:20:08 -0700 | [diff] [blame] | 567 | if (mDisplayListData == NULL || mDisplayListData->children().size() == 0) return; |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 568 | |
John Reck | 087bc0c | 2014-04-04 16:20:08 -0700 | [diff] [blame] | 569 | for (unsigned int i = 0; i < mDisplayListData->children().size(); i++) { |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 570 | DrawRenderNodeOp* childOp = mDisplayListData->children()[i]; |
| 571 | RenderNode* child = childOp->mRenderNode; |
Chris Craik | cc39e16 | 2014-04-25 18:34:11 -0700 | [diff] [blame] | 572 | float childZ = child->properties().getZ(); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 573 | |
Chris Craik | e0bb87d | 2014-04-22 17:55:41 -0700 | [diff] [blame] | 574 | if (!MathUtils::isZero(childZ)) { |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 575 | zTranslatedNodes.add(ZDrawRenderNodeOpPair(childZ, childOp)); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 576 | childOp->mSkipInOrderDraw = true; |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 577 | } else if (!child->properties().getProjectBackwards()) { |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 578 | // regular, in order drawing DisplayList |
| 579 | childOp->mSkipInOrderDraw = false; |
| 580 | } |
| 581 | } |
| 582 | |
| 583 | // Z sort 3d children (stable-ness makes z compare fall back to standard drawing order) |
| 584 | std::stable_sort(zTranslatedNodes.begin(), zTranslatedNodes.end()); |
| 585 | } |
| 586 | |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 587 | template <class T> |
| 588 | void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& handler) { |
Chris Craik | 0645128 | 2014-07-21 10:25:54 -0700 | [diff] [blame] | 589 | if (properties().getAlpha() <= 0.0f || !properties().getOutline().getPath()) return; |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 590 | |
| 591 | mat4 shadowMatrixXY(transformFromParent); |
| 592 | applyViewPropertyTransforms(shadowMatrixXY); |
| 593 | |
| 594 | // Z matrix needs actual 3d transformation, so mapped z values will be correct |
| 595 | mat4 shadowMatrixZ(transformFromParent); |
| 596 | applyViewPropertyTransforms(shadowMatrixZ, true); |
| 597 | |
| 598 | const SkPath* outlinePath = properties().getOutline().getPath(); |
| 599 | const RevealClip& revealClip = properties().getRevealClip(); |
| 600 | const SkPath* revealClipPath = revealClip.hasConvexClip() |
| 601 | ? revealClip.getPath() : NULL; // only pass the reveal clip's path if it's convex |
| 602 | |
Chris Craik | 6131732 | 2014-05-21 13:03:52 -0700 | [diff] [blame] | 603 | if (revealClipPath && revealClipPath->isEmpty()) return; |
| 604 | |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 605 | /** |
| 606 | * The drawing area of the caster is always the same as the its perimeter (which |
| 607 | * the shadow system uses) *except* in the inverse clip case. Inform the shadow |
| 608 | * system that the caster's drawing area (as opposed to its perimeter) has been |
| 609 | * clipped, so that it knows the caster can't be opaque. |
| 610 | */ |
| 611 | bool casterUnclipped = !revealClip.willClip() || revealClip.hasConvexClip(); |
| 612 | |
| 613 | DisplayListOp* shadowOp = new (handler.allocator()) DrawShadowOp( |
| 614 | shadowMatrixXY, shadowMatrixZ, |
| 615 | properties().getAlpha(), casterUnclipped, |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 616 | outlinePath, revealClipPath); |
| 617 | handler(shadowOp, PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
| 618 | } |
| 619 | |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 620 | template <class T> |
| 621 | int RenderNode::issueOperationsOfNegZChildren( |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 622 | const Vector<ZDrawRenderNodeOpPair>& zTranslatedNodes, |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 623 | OpenGLRenderer& renderer, T& handler) { |
| 624 | if (zTranslatedNodes.isEmpty()) return -1; |
| 625 | |
| 626 | // create a save around the body of the ViewGroup's draw method, so that |
| 627 | // matrix/clip methods don't affect composited children |
| 628 | int shadowSaveCount = renderer.getSaveCount(); |
| 629 | handler(new (handler.allocator()) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag), |
| 630 | PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
| 631 | |
| 632 | issueOperationsOf3dChildren(zTranslatedNodes, kNegativeZChildren, renderer, handler); |
| 633 | return shadowSaveCount; |
| 634 | } |
| 635 | |
| 636 | template <class T> |
| 637 | void RenderNode::issueOperationsOfPosZChildren(int shadowRestoreTo, |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 638 | const Vector<ZDrawRenderNodeOpPair>& zTranslatedNodes, |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 639 | OpenGLRenderer& renderer, T& handler) { |
| 640 | if (zTranslatedNodes.isEmpty()) return; |
| 641 | |
| 642 | LOG_ALWAYS_FATAL_IF(shadowRestoreTo < 0, "invalid save to restore to"); |
| 643 | handler(new (handler.allocator()) RestoreToCountOp(shadowRestoreTo), |
| 644 | PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
| 645 | renderer.setOverrideLayerAlpha(1.0f); |
| 646 | |
| 647 | issueOperationsOf3dChildren(zTranslatedNodes, kPositiveZChildren, renderer, handler); |
| 648 | } |
| 649 | |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 650 | #define SHADOW_DELTA 0.1f |
| 651 | |
| 652 | template <class T> |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 653 | void RenderNode::issueOperationsOf3dChildren(const Vector<ZDrawRenderNodeOpPair>& zTranslatedNodes, |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 654 | ChildrenSelectMode mode, OpenGLRenderer& renderer, T& handler) { |
| 655 | const int size = zTranslatedNodes.size(); |
| 656 | if (size == 0 |
| 657 | || (mode == kNegativeZChildren && zTranslatedNodes[0].key > 0.0f) |
| 658 | || (mode == kPositiveZChildren && zTranslatedNodes[size - 1].key < 0.0f)) { |
| 659 | // no 3d children to draw |
| 660 | return; |
| 661 | } |
| 662 | |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 663 | /** |
| 664 | * Draw shadows and (potential) casters mostly in order, but allow the shadows of casters |
| 665 | * with very similar Z heights to draw together. |
| 666 | * |
| 667 | * This way, if Views A & B have the same Z height and are both casting shadows, the shadows are |
| 668 | * underneath both, and neither's shadow is drawn on top of the other. |
| 669 | */ |
| 670 | const size_t nonNegativeIndex = findNonNegativeIndex(zTranslatedNodes); |
| 671 | size_t drawIndex, shadowIndex, endIndex; |
| 672 | if (mode == kNegativeZChildren) { |
| 673 | drawIndex = 0; |
| 674 | endIndex = nonNegativeIndex; |
| 675 | shadowIndex = endIndex; // draw no shadows |
| 676 | } else { |
| 677 | drawIndex = nonNegativeIndex; |
| 678 | endIndex = size; |
| 679 | shadowIndex = drawIndex; // potentially draw shadow for each pos Z child |
| 680 | } |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 681 | |
| 682 | DISPLAY_LIST_LOGD("%*s%d %s 3d children:", (handler.level() + 1) * 2, "", |
| 683 | endIndex - drawIndex, mode == kNegativeZChildren ? "negative" : "positive"); |
| 684 | |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 685 | float lastCasterZ = 0.0f; |
| 686 | while (shadowIndex < endIndex || drawIndex < endIndex) { |
| 687 | if (shadowIndex < endIndex) { |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 688 | DrawRenderNodeOp* casterOp = zTranslatedNodes[shadowIndex].value; |
| 689 | RenderNode* caster = casterOp->mRenderNode; |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 690 | const float casterZ = zTranslatedNodes[shadowIndex].key; |
| 691 | // attempt to render the shadow if the caster about to be drawn is its caster, |
| 692 | // OR if its caster's Z value is similar to the previous potential caster |
| 693 | if (shadowIndex == drawIndex || casterZ - lastCasterZ < SHADOW_DELTA) { |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 694 | caster->issueDrawShadowOperation(casterOp->mTransformFromParent, handler); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 695 | |
| 696 | lastCasterZ = casterZ; // must do this even if current caster not casting a shadow |
| 697 | shadowIndex++; |
| 698 | continue; |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | // only the actual child DL draw needs to be in save/restore, |
| 703 | // since it modifies the renderer's matrix |
| 704 | int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag); |
| 705 | |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 706 | DrawRenderNodeOp* childOp = zTranslatedNodes[drawIndex].value; |
| 707 | RenderNode* child = childOp->mRenderNode; |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 708 | |
| 709 | renderer.concatMatrix(childOp->mTransformFromParent); |
| 710 | childOp->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 711 | handler(childOp, renderer.getSaveCount() - 1, properties().getClipToBounds()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 712 | childOp->mSkipInOrderDraw = true; |
| 713 | |
| 714 | renderer.restoreToCount(restoreTo); |
| 715 | drawIndex++; |
| 716 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 717 | } |
| 718 | |
| 719 | template <class T> |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 720 | void RenderNode::issueOperationsOfProjectedChildren(OpenGLRenderer& renderer, T& handler) { |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 721 | DISPLAY_LIST_LOGD("%*s%d projected children:", (handler.level() + 1) * 2, "", mProjectedNodes.size()); |
| 722 | const SkPath* projectionReceiverOutline = properties().getOutline().getPath(); |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 723 | int restoreTo = renderer.getSaveCount(); |
| 724 | |
| 725 | // If the projection reciever has an outline, we mask each of the projected rendernodes to it |
| 726 | // Either with clipRect, or special saveLayer masking |
| 727 | LinearAllocator& alloc = handler.allocator(); |
| 728 | if (projectionReceiverOutline != NULL) { |
| 729 | const SkRect& outlineBounds = projectionReceiverOutline->getBounds(); |
| 730 | if (projectionReceiverOutline->isRect(NULL)) { |
| 731 | // mask to the rect outline simply with clipRect |
| 732 | handler(new (alloc) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag), |
| 733 | PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
| 734 | ClipRectOp* clipOp = new (alloc) ClipRectOp( |
| 735 | outlineBounds.left(), outlineBounds.top(), |
| 736 | outlineBounds.right(), outlineBounds.bottom(), SkRegion::kIntersect_Op); |
| 737 | handler(clipOp, PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
| 738 | } else { |
| 739 | // wrap the projected RenderNodes with a SaveLayer that will mask to the outline |
| 740 | SaveLayerOp* op = new (alloc) SaveLayerOp( |
| 741 | outlineBounds.left(), outlineBounds.top(), |
| 742 | outlineBounds.right(), outlineBounds.bottom(), |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 743 | 255, SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag | SkCanvas::kARGB_ClipLayer_SaveFlag); |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 744 | op->setMask(projectionReceiverOutline); |
| 745 | handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
| 746 | |
| 747 | /* TODO: add optimizations here to take advantage of placement/size of projected |
| 748 | * children (which may shrink saveLayer area significantly). This is dependent on |
| 749 | * passing actual drawing/dirtying bounds of projected content down to native. |
| 750 | */ |
| 751 | } |
| 752 | } |
| 753 | |
| 754 | // draw projected nodes |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 755 | for (size_t i = 0; i < mProjectedNodes.size(); i++) { |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 756 | DrawRenderNodeOp* childOp = mProjectedNodes[i]; |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 757 | |
| 758 | // matrix save, concat, and restore can be done safely without allocating operations |
| 759 | int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag); |
| 760 | renderer.concatMatrix(childOp->mTransformFromCompositingAncestor); |
| 761 | childOp->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 762 | handler(childOp, renderer.getSaveCount() - 1, properties().getClipToBounds()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 763 | childOp->mSkipInOrderDraw = true; |
| 764 | renderer.restoreToCount(restoreTo); |
| 765 | } |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 766 | |
| 767 | if (projectionReceiverOutline != NULL) { |
| 768 | handler(new (alloc) RestoreToCountOp(restoreTo), |
| 769 | PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
| 770 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 771 | } |
| 772 | |
| 773 | /** |
| 774 | * This function serves both defer and replay modes, and will organize the displayList's component |
| 775 | * operations for a single frame: |
| 776 | * |
| 777 | * Every 'simple' state operation that affects just the matrix and alpha (or other factors of |
| 778 | * DeferredDisplayState) may be issued directly to the renderer, but complex operations (with custom |
| 779 | * defer logic) and operations in displayListOps are issued through the 'handler' which handles the |
| 780 | * defer vs replay logic, per operation |
| 781 | */ |
| 782 | template <class T> |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 783 | void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) { |
Chris Craik | 0645128 | 2014-07-21 10:25:54 -0700 | [diff] [blame] | 784 | const int level = handler.level(); |
| 785 | if (mDisplayListData->isEmpty()) { |
| 786 | DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", level * 2, "", this, getName()); |
| 787 | return; |
| 788 | } |
| 789 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 790 | const bool drawLayer = (mLayer && (&renderer != mLayer->renderer)); |
| 791 | // If we are updating the contents of mLayer, we don't want to apply any of |
| 792 | // the RenderNode's properties to this issueOperations pass. Those will all |
| 793 | // be applied when the layer is drawn, aka when this is true. |
| 794 | const bool useViewProperties = (!mLayer || drawLayer); |
Chris Craik | 0645128 | 2014-07-21 10:25:54 -0700 | [diff] [blame] | 795 | if (useViewProperties) { |
| 796 | const Outline& outline = properties().getOutline(); |
| 797 | if (properties().getAlpha() <= 0 || (outline.getShouldClip() && outline.isEmpty())) { |
| 798 | DISPLAY_LIST_LOGD("%*sRejected display list (%p, %s)", level * 2, "", this, getName()); |
| 799 | return; |
| 800 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 801 | } |
| 802 | |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 803 | handler.startMark(getName()); |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 804 | |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 805 | #if DEBUG_DISPLAY_LIST |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 806 | const Rect& clipRect = renderer.getLocalClipBounds(); |
| 807 | DISPLAY_LIST_LOGD("%*sStart display list (%p, %s), localClipBounds: %.0f, %.0f, %.0f, %.0f", |
| 808 | level * 2, "", this, getName(), |
| 809 | clipRect.left, clipRect.top, clipRect.right, clipRect.bottom); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 810 | #endif |
| 811 | |
| 812 | LinearAllocator& alloc = handler.allocator(); |
| 813 | int restoreTo = renderer.getSaveCount(); |
| 814 | handler(new (alloc) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag), |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 815 | PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 816 | |
| 817 | DISPLAY_LIST_LOGD("%*sSave %d %d", (level + 1) * 2, "", |
| 818 | SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag, restoreTo); |
| 819 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 820 | if (useViewProperties) { |
| 821 | setViewProperties<T>(renderer, handler); |
| 822 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 823 | |
Chris Craik | 8c271ca | 2014-03-25 10:33:01 -0700 | [diff] [blame] | 824 | bool quickRejected = properties().getClipToBounds() |
| 825 | && renderer.quickRejectConservative(0, 0, properties().getWidth(), properties().getHeight()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 826 | if (!quickRejected) { |
Chris Craik | deeda3d | 2014-05-05 19:09:33 -0700 | [diff] [blame] | 827 | if (mProperties.getOutline().willClip()) { |
| 828 | renderer.setClippingOutline(alloc, &(mProperties.getOutline())); |
| 829 | } |
| 830 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 831 | if (drawLayer) { |
| 832 | handler(new (alloc) DrawLayerOp(mLayer, 0, 0), |
| 833 | renderer.getSaveCount() - 1, properties().getClipToBounds()); |
| 834 | } else { |
Chris Craik | a7090e0 | 2014-06-20 16:01:00 -0700 | [diff] [blame] | 835 | Vector<ZDrawRenderNodeOpPair> zTranslatedNodes; |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 836 | buildZSortedChildList(zTranslatedNodes); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 837 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 838 | // for 3d root, draw children with negative z values |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 839 | int shadowRestoreTo = issueOperationsOfNegZChildren(zTranslatedNodes, renderer, handler); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 840 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 841 | DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); |
| 842 | const int saveCountOffset = renderer.getSaveCount() - 1; |
| 843 | const int projectionReceiveIndex = mDisplayListData->projectionReceiveIndex; |
| 844 | for (unsigned int i = 0; i < mDisplayListData->displayListOps.size(); i++) { |
| 845 | DisplayListOp *op = mDisplayListData->displayListOps[i]; |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 846 | |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 847 | #if DEBUG_DISPLAY_LIST |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 848 | op->output(level + 1); |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 849 | #endif |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 850 | logBuffer.writeCommand(level, op->name()); |
| 851 | handler(op, saveCountOffset, properties().getClipToBounds()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 852 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 853 | if (CC_UNLIKELY(i == projectionReceiveIndex && mProjectedNodes.size() > 0)) { |
| 854 | issueOperationsOfProjectedChildren(renderer, handler); |
| 855 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 856 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 857 | |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 858 | // for 3d root, draw children with positive z values |
Chris Craik | 80d4902 | 2014-06-20 15:03:43 -0700 | [diff] [blame] | 859 | issueOperationsOfPosZChildren(shadowRestoreTo, zTranslatedNodes, renderer, handler); |
John Reck | 25fbb3f | 2014-06-12 13:46:45 -0700 | [diff] [blame] | 860 | } |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 861 | } |
| 862 | |
| 863 | DISPLAY_LIST_LOGD("%*sRestoreToCount %d", (level + 1) * 2, "", restoreTo); |
| 864 | handler(new (alloc) RestoreToCountOp(restoreTo), |
John Reck | d0a0b2a | 2014-03-20 16:28:56 -0700 | [diff] [blame] | 865 | PROPERTY_SAVECOUNT, properties().getClipToBounds()); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 866 | renderer.setOverrideLayerAlpha(1.0f); |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 867 | |
Chris Craik | 3f085429 | 2014-04-15 16:18:08 -0700 | [diff] [blame] | 868 | DISPLAY_LIST_LOGD("%*sDone (%p, %s)", level * 2, "", this, getName()); |
Chris Craik | b265e2c | 2014-03-27 15:50:09 -0700 | [diff] [blame] | 869 | handler.endMark(); |
John Reck | 113e082 | 2014-03-18 09:22:59 -0700 | [diff] [blame] | 870 | } |
| 871 | |
| 872 | } /* namespace uirenderer */ |
| 873 | } /* namespace android */ |