RenderNode.cpp revision 024433f89684e1f9cb7b15ade7c480c9346fbe4d
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 18 19#include "RenderNode.h" 20 21#include <SkCanvas.h> 22#include <algorithm> 23 24#include <utils/Trace.h> 25 26#include "Debug.h" 27#include "DisplayListOp.h" 28#include "DisplayListLogBuffer.h" 29 30namespace android { 31namespace uirenderer { 32 33void RenderNode::outputLogBuffer(int fd) { 34 DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); 35 if (logBuffer.isEmpty()) { 36 return; 37 } 38 39 FILE *file = fdopen(fd, "a"); 40 41 fprintf(file, "\nRecent DisplayList operations\n"); 42 logBuffer.outputCommands(file); 43 44 String8 cachesLog; 45 Caches::getInstance().dumpMemoryUsage(cachesLog); 46 fprintf(file, "\nCaches:\n%s", cachesLog.string()); 47 fprintf(file, "\n"); 48 49 fflush(file); 50} 51 52RenderNode::RenderNode() : mDestroyed(false), mNeedsPropertiesSync(false), mDisplayListData(0) { 53} 54 55RenderNode::~RenderNode() { 56 LOG_ALWAYS_FATAL_IF(mDestroyed, "Double destroyed DisplayList %p", this); 57 58 mDestroyed = true; 59 delete mDisplayListData; 60} 61 62void RenderNode::destroyDisplayListDeferred(RenderNode* displayList) { 63 if (displayList) { 64 DISPLAY_LIST_LOGD("Deferring display list destruction"); 65 Caches::getInstance().deleteDisplayListDeferred(displayList); 66 } 67} 68 69void RenderNode::setData(DisplayListData* data) { 70 delete mDisplayListData; 71 mDisplayListData = data; 72 if (mDisplayListData) { 73 Caches::getInstance().registerFunctors(mDisplayListData->functorCount); 74 } 75} 76 77/** 78 * This function is a simplified version of replay(), where we simply retrieve and log the 79 * display list. This function should remain in sync with the replay() function. 80 */ 81void RenderNode::output(uint32_t level) { 82 ALOGD("%*sStart display list (%p, %s, render=%d)", (level - 1) * 2, "", this, 83 mName.string(), isRenderable()); 84 ALOGD("%*s%s %d", level * 2, "", "Save", 85 SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); 86 87 properties().debugOutputProperties(level); 88 int flags = DisplayListOp::kOpLogFlag_Recurse; 89 for (unsigned int i = 0; i < mDisplayListData->displayListOps.size(); i++) { 90 mDisplayListData->displayListOps[i]->output(level, flags); 91 } 92 93 ALOGD("%*sDone (%p, %s)", (level - 1) * 2, "", this, mName.string()); 94} 95 96void RenderNode::updateProperties() { 97 if (mNeedsPropertiesSync) { 98 mNeedsPropertiesSync = false; 99 mProperties = mStagingProperties; 100 } 101 102 if (mDisplayListData) { 103 for (size_t i = 0; i < mDisplayListData->children.size(); i++) { 104 RenderNode* childNode = mDisplayListData->children[i]->mDisplayList; 105 childNode->updateProperties(); 106 } 107 } 108} 109 110/* 111 * For property operations, we pass a savecount of 0, since the operations aren't part of the 112 * displaylist, and thus don't have to compensate for the record-time/playback-time discrepancy in 113 * base saveCount (i.e., how RestoreToCount uses saveCount + properties().getCount()) 114 */ 115#define PROPERTY_SAVECOUNT 0 116 117template <class T> 118void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler, 119 const int level) { 120#if DEBUG_DISPLAY_LIST 121 properties().debugOutputProperties(level); 122#endif 123 if (properties().getLeft() != 0 || properties().getTop() != 0) { 124 renderer.translate(properties().getLeft(), properties().getTop()); 125 } 126 if (properties().getStaticMatrix()) { 127 renderer.concatMatrix(properties().getStaticMatrix()); 128 } else if (properties().getAnimationMatrix()) { 129 renderer.concatMatrix(properties().getAnimationMatrix()); 130 } 131 if (properties().getMatrixFlags() != 0) { 132 if (properties().getMatrixFlags() == TRANSLATION) { 133 renderer.translate(properties().getTranslationX(), properties().getTranslationY()); 134 } else { 135 renderer.concatMatrix(*properties().getTransformMatrix()); 136 } 137 } 138 bool clipToBoundsNeeded = properties().getCaching() ? false : properties().getClipToBounds(); 139 if (properties().getAlpha() < 1) { 140 if (properties().getCaching()) { 141 renderer.setOverrideLayerAlpha(properties().getAlpha()); 142 } else if (!properties().getHasOverlappingRendering()) { 143 renderer.scaleAlpha(properties().getAlpha()); 144 } else { 145 // TODO: should be able to store the size of a DL at record time and not 146 // have to pass it into this call. In fact, this information might be in the 147 // location/size info that we store with the new native transform data. 148 int saveFlags = SkCanvas::kHasAlphaLayer_SaveFlag; 149 if (clipToBoundsNeeded) { 150 saveFlags |= SkCanvas::kClipToLayer_SaveFlag; 151 clipToBoundsNeeded = false; // clipping done by saveLayer 152 } 153 154 SaveLayerOp* op = new (handler.allocator()) SaveLayerOp( 155 0, 0, properties().getWidth(), properties().getHeight(), 156 properties().getAlpha() * 255, saveFlags); 157 handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); 158 } 159 } 160 if (clipToBoundsNeeded) { 161 ClipRectOp* op = new (handler.allocator()) ClipRectOp( 162 0, 0, properties().getWidth(), properties().getHeight(), SkRegion::kIntersect_Op); 163 handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); 164 } 165 166 if (CC_UNLIKELY(properties().hasClippingPath())) { 167 // TODO: optimize for round rect/circle clipping 168 const SkPath* path = properties().getClippingPath(); 169 ClipPathOp* op = new (handler.allocator()) ClipPathOp(path, SkRegion::kIntersect_Op); 170 handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); 171 } 172} 173 174/** 175 * Apply property-based transformations to input matrix 176 * 177 * If true3dTransform is set to true, the transform applied to the input matrix will use true 4x4 178 * matrix computation instead of the Skia 3x3 matrix + camera hackery. 179 */ 180void RenderNode::applyViewPropertyTransforms(mat4& matrix, bool true3dTransform) { 181 if (properties().getLeft() != 0 || properties().getTop() != 0) { 182 matrix.translate(properties().getLeft(), properties().getTop()); 183 } 184 if (properties().getStaticMatrix()) { 185 mat4 stat(*properties().getStaticMatrix()); 186 matrix.multiply(stat); 187 } else if (properties().getAnimationMatrix()) { 188 mat4 anim(*properties().getAnimationMatrix()); 189 matrix.multiply(anim); 190 } 191 if (properties().getMatrixFlags() != 0) { 192 if (properties().getMatrixFlags() == TRANSLATION) { 193 matrix.translate(properties().getTranslationX(), properties().getTranslationY(), 194 true3dTransform ? properties().getTranslationZ() : 0.0f); 195 } else { 196 if (!true3dTransform) { 197 matrix.multiply(*properties().getTransformMatrix()); 198 } else { 199 mat4 true3dMat; 200 true3dMat.loadTranslate( 201 properties().getPivotX() + properties().getTranslationX(), 202 properties().getPivotY() + properties().getTranslationY(), 203 properties().getTranslationZ()); 204 true3dMat.rotate(properties().getRotationX(), 1, 0, 0); 205 true3dMat.rotate(properties().getRotationY(), 0, 1, 0); 206 true3dMat.rotate(properties().getRotation(), 0, 0, 1); 207 true3dMat.scale(properties().getScaleX(), properties().getScaleY(), 1); 208 true3dMat.translate(-properties().getPivotX(), -properties().getPivotY()); 209 210 matrix.multiply(true3dMat); 211 } 212 } 213 } 214} 215 216/** 217 * Organizes the DisplayList hierarchy to prepare for background projection reordering. 218 * 219 * This should be called before a call to defer() or drawDisplayList() 220 * 221 * Each DisplayList that serves as a 3d root builds its list of composited children, 222 * which are flagged to not draw in the standard draw loop. 223 */ 224void RenderNode::computeOrdering() { 225 ATRACE_CALL(); 226 mProjectedNodes.clear(); 227 228 // TODO: create temporary DDLOp and call computeOrderingImpl on top DisplayList so that 229 // transform properties are applied correctly to top level children 230 if (mDisplayListData == NULL) return; 231 for (unsigned int i = 0; i < mDisplayListData->children.size(); i++) { 232 DrawDisplayListOp* childOp = mDisplayListData->children[i]; 233 childOp->mDisplayList->computeOrderingImpl(childOp, 234 &mProjectedNodes, &mat4::identity()); 235 } 236} 237 238void RenderNode::computeOrderingImpl( 239 DrawDisplayListOp* opState, 240 Vector<DrawDisplayListOp*>* compositedChildrenOfProjectionSurface, 241 const mat4* transformFromProjectionSurface) { 242 mProjectedNodes.clear(); 243 if (mDisplayListData == NULL || mDisplayListData->isEmpty()) return; 244 245 // TODO: should avoid this calculation in most cases 246 // TODO: just calculate single matrix, down to all leaf composited elements 247 Matrix4 localTransformFromProjectionSurface(*transformFromProjectionSurface); 248 localTransformFromProjectionSurface.multiply(opState->mTransformFromParent); 249 250 if (properties().getProjectBackwards()) { 251 // composited projectee, flag for out of order draw, save matrix, and store in proj surface 252 opState->mSkipInOrderDraw = true; 253 opState->mTransformFromCompositingAncestor.load(localTransformFromProjectionSurface); 254 compositedChildrenOfProjectionSurface->add(opState); 255 } else { 256 // standard in order draw 257 opState->mSkipInOrderDraw = false; 258 } 259 260 if (mDisplayListData->children.size() > 0) { 261 const bool isProjectionReceiver = mDisplayListData->projectionReceiveIndex >= 0; 262 bool haveAppliedPropertiesToProjection = false; 263 for (unsigned int i = 0; i < mDisplayListData->children.size(); i++) { 264 DrawDisplayListOp* childOp = mDisplayListData->children[i]; 265 RenderNode* child = childOp->mDisplayList; 266 267 Vector<DrawDisplayListOp*>* projectionChildren = NULL; 268 const mat4* projectionTransform = NULL; 269 if (isProjectionReceiver && !child->properties().getProjectBackwards()) { 270 // if receiving projections, collect projecting descendent 271 272 // Note that if a direct descendent is projecting backwards, we pass it's 273 // grandparent projection collection, since it shouldn't project onto it's 274 // parent, where it will already be drawing. 275 projectionChildren = &mProjectedNodes; 276 projectionTransform = &mat4::identity(); 277 } else { 278 if (!haveAppliedPropertiesToProjection) { 279 applyViewPropertyTransforms(localTransformFromProjectionSurface); 280 haveAppliedPropertiesToProjection = true; 281 } 282 projectionChildren = compositedChildrenOfProjectionSurface; 283 projectionTransform = &localTransformFromProjectionSurface; 284 } 285 child->computeOrderingImpl(childOp, projectionChildren, projectionTransform); 286 } 287 } 288 289} 290 291class DeferOperationHandler { 292public: 293 DeferOperationHandler(DeferStateStruct& deferStruct, int level) 294 : mDeferStruct(deferStruct), mLevel(level) {} 295 inline void operator()(DisplayListOp* operation, int saveCount, bool clipToBounds) { 296 operation->defer(mDeferStruct, saveCount, mLevel, clipToBounds); 297 } 298 inline LinearAllocator& allocator() { return *(mDeferStruct.mAllocator); } 299 300private: 301 DeferStateStruct& mDeferStruct; 302 const int mLevel; 303}; 304 305void RenderNode::defer(DeferStateStruct& deferStruct, const int level) { 306 DeferOperationHandler handler(deferStruct, level); 307 iterate<DeferOperationHandler>(deferStruct.mRenderer, handler, level); 308} 309 310class ReplayOperationHandler { 311public: 312 ReplayOperationHandler(ReplayStateStruct& replayStruct, int level) 313 : mReplayStruct(replayStruct), mLevel(level) {} 314 inline void operator()(DisplayListOp* operation, int saveCount, bool clipToBounds) { 315#if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS 316 properties().getReplayStruct().mRenderer.eventMark(operation->name()); 317#endif 318 operation->replay(mReplayStruct, saveCount, mLevel, clipToBounds); 319 } 320 inline LinearAllocator& allocator() { return *(mReplayStruct.mAllocator); } 321 322private: 323 ReplayStateStruct& mReplayStruct; 324 const int mLevel; 325}; 326 327void RenderNode::replay(ReplayStateStruct& replayStruct, const int level) { 328 ReplayOperationHandler handler(replayStruct, level); 329 330 replayStruct.mRenderer.startMark(mName.string()); 331 iterate<ReplayOperationHandler>(replayStruct.mRenderer, handler, level); 332 replayStruct.mRenderer.endMark(); 333 334 DISPLAY_LIST_LOGD("%*sDone (%p, %s), returning %d", level * 2, "", this, mName.string(), 335 replayStruct.mDrawGlStatus); 336} 337 338void RenderNode::buildZSortedChildList(Vector<ZDrawDisplayListOpPair>& zTranslatedNodes) { 339 if (mDisplayListData == NULL || mDisplayListData->children.size() == 0) return; 340 341 for (unsigned int i = 0; i < mDisplayListData->children.size(); i++) { 342 DrawDisplayListOp* childOp = mDisplayListData->children[i]; 343 RenderNode* child = childOp->mDisplayList; 344 float childZ = child->properties().getTranslationZ(); 345 346 if (childZ != 0.0f) { 347 zTranslatedNodes.add(ZDrawDisplayListOpPair(childZ, childOp)); 348 childOp->mSkipInOrderDraw = true; 349 } else if (!child->properties().getProjectBackwards()) { 350 // regular, in order drawing DisplayList 351 childOp->mSkipInOrderDraw = false; 352 } 353 } 354 355 // Z sort 3d children (stable-ness makes z compare fall back to standard drawing order) 356 std::stable_sort(zTranslatedNodes.begin(), zTranslatedNodes.end()); 357} 358 359#define SHADOW_DELTA 0.1f 360 361template <class T> 362void RenderNode::iterate3dChildren(const Vector<ZDrawDisplayListOpPair>& zTranslatedNodes, 363 ChildrenSelectMode mode, OpenGLRenderer& renderer, T& handler) { 364 const int size = zTranslatedNodes.size(); 365 if (size == 0 366 || (mode == kNegativeZChildren && zTranslatedNodes[0].key > 0.0f) 367 || (mode == kPositiveZChildren && zTranslatedNodes[size - 1].key < 0.0f)) { 368 // no 3d children to draw 369 return; 370 } 371 372 int rootRestoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); 373 LinearAllocator& alloc = handler.allocator(); 374 ClipRectOp* clipOp = new (alloc) ClipRectOp(0, 0, properties().getWidth(), properties().getHeight(), 375 SkRegion::kIntersect_Op); // clip to 3d root bounds 376 handler(clipOp, PROPERTY_SAVECOUNT, properties().getClipToBounds()); 377 378 /** 379 * Draw shadows and (potential) casters mostly in order, but allow the shadows of casters 380 * with very similar Z heights to draw together. 381 * 382 * This way, if Views A & B have the same Z height and are both casting shadows, the shadows are 383 * underneath both, and neither's shadow is drawn on top of the other. 384 */ 385 const size_t nonNegativeIndex = findNonNegativeIndex(zTranslatedNodes); 386 size_t drawIndex, shadowIndex, endIndex; 387 if (mode == kNegativeZChildren) { 388 drawIndex = 0; 389 endIndex = nonNegativeIndex; 390 shadowIndex = endIndex; // draw no shadows 391 } else { 392 drawIndex = nonNegativeIndex; 393 endIndex = size; 394 shadowIndex = drawIndex; // potentially draw shadow for each pos Z child 395 } 396 float lastCasterZ = 0.0f; 397 while (shadowIndex < endIndex || drawIndex < endIndex) { 398 if (shadowIndex < endIndex) { 399 DrawDisplayListOp* casterOp = zTranslatedNodes[shadowIndex].value; 400 RenderNode* caster = casterOp->mDisplayList; 401 const float casterZ = zTranslatedNodes[shadowIndex].key; 402 // attempt to render the shadow if the caster about to be drawn is its caster, 403 // OR if its caster's Z value is similar to the previous potential caster 404 if (shadowIndex == drawIndex || casterZ - lastCasterZ < SHADOW_DELTA) { 405 406 if (caster->properties().getAlpha() > 0.0f) { 407 mat4 shadowMatrixXY(casterOp->mTransformFromParent); 408 caster->applyViewPropertyTransforms(shadowMatrixXY); 409 410 // Z matrix needs actual 3d transformation, so mapped z values will be correct 411 mat4 shadowMatrixZ(casterOp->mTransformFromParent); 412 caster->applyViewPropertyTransforms(shadowMatrixZ, true); 413 414 const SkPath* outlinePath = caster->properties().getOutline().getPath(); 415 const RevealClip& revealClip = caster->properties().getRevealClip(); 416 const SkPath* revealClipPath = revealClip.hasConvexClip() 417 ? revealClip.getPath() : NULL; // only pass the reveal clip's path if it's convex 418 419 /** 420 * The drawing area of the caster is always the same as the its perimeter (which 421 * the shadow system uses) *except* in the inverse clip case. Inform the shadow 422 * system that the caster's drawing area (as opposed to its perimeter) has been 423 * clipped, so that it knows the caster can't be opaque. 424 */ 425 bool casterUnclipped = !revealClip.willClip() || revealClip.hasConvexClip(); 426 427 DisplayListOp* shadowOp = new (alloc) DrawShadowOp( 428 shadowMatrixXY, shadowMatrixZ, 429 caster->properties().getAlpha(), casterUnclipped, 430 caster->properties().getWidth(), caster->properties().getHeight(), 431 outlinePath, revealClipPath); 432 handler(shadowOp, PROPERTY_SAVECOUNT, properties().getClipToBounds()); 433 } 434 435 lastCasterZ = casterZ; // must do this even if current caster not casting a shadow 436 shadowIndex++; 437 continue; 438 } 439 } 440 441 // only the actual child DL draw needs to be in save/restore, 442 // since it modifies the renderer's matrix 443 int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag); 444 445 DrawDisplayListOp* childOp = zTranslatedNodes[drawIndex].value; 446 RenderNode* child = childOp->mDisplayList; 447 448 renderer.concatMatrix(childOp->mTransformFromParent); 449 childOp->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone 450 handler(childOp, renderer.getSaveCount() - 1, properties().getClipToBounds()); 451 childOp->mSkipInOrderDraw = true; 452 453 renderer.restoreToCount(restoreTo); 454 drawIndex++; 455 } 456 handler(new (alloc) RestoreToCountOp(rootRestoreTo), PROPERTY_SAVECOUNT, properties().getClipToBounds()); 457} 458 459template <class T> 460void RenderNode::iterateProjectedChildren(OpenGLRenderer& renderer, T& handler, const int level) { 461 int rootRestoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag); 462 LinearAllocator& alloc = handler.allocator(); 463 ClipRectOp* clipOp = new (alloc) ClipRectOp(0, 0, properties().getWidth(), properties().getHeight(), 464 SkRegion::kReplace_Op); // clip to projection surface root bounds 465 handler(clipOp, PROPERTY_SAVECOUNT, properties().getClipToBounds()); 466 467 for (size_t i = 0; i < mProjectedNodes.size(); i++) { 468 DrawDisplayListOp* childOp = mProjectedNodes[i]; 469 470 // matrix save, concat, and restore can be done safely without allocating operations 471 int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag); 472 renderer.concatMatrix(childOp->mTransformFromCompositingAncestor); 473 childOp->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone 474 handler(childOp, renderer.getSaveCount() - 1, properties().getClipToBounds()); 475 childOp->mSkipInOrderDraw = true; 476 renderer.restoreToCount(restoreTo); 477 } 478 handler(new (alloc) RestoreToCountOp(rootRestoreTo), PROPERTY_SAVECOUNT, properties().getClipToBounds()); 479} 480 481/** 482 * This function serves both defer and replay modes, and will organize the displayList's component 483 * operations for a single frame: 484 * 485 * Every 'simple' state operation that affects just the matrix and alpha (or other factors of 486 * DeferredDisplayState) may be issued directly to the renderer, but complex operations (with custom 487 * defer logic) and operations in displayListOps are issued through the 'handler' which handles the 488 * defer vs replay logic, per operation 489 */ 490template <class T> 491void RenderNode::iterate(OpenGLRenderer& renderer, T& handler, const int level) { 492 if (CC_UNLIKELY(mDestroyed)) { // temporary debug logging 493 ALOGW("Error: %s is drawing after destruction", mName.string()); 494 CRASH(); 495 } 496 if (mDisplayListData->isEmpty() || properties().getAlpha() <= 0) { 497 DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", level * 2, "", this, mName.string()); 498 return; 499 } 500 501#if DEBUG_DISPLAY_LIST 502 Rect* clipRect = renderer.getClipRect(); 503 DISPLAY_LIST_LOGD("%*sStart display list (%p, %s), clipRect: %.0f, %.0f, %.0f, %.0f", 504 level * 2, "", this, mName.string(), clipRect->left, clipRect->top, 505 clipRect->right, clipRect->bottom); 506#endif 507 508 LinearAllocator& alloc = handler.allocator(); 509 int restoreTo = renderer.getSaveCount(); 510 handler(new (alloc) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag), 511 PROPERTY_SAVECOUNT, properties().getClipToBounds()); 512 513 DISPLAY_LIST_LOGD("%*sSave %d %d", (level + 1) * 2, "", 514 SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag, restoreTo); 515 516 setViewProperties<T>(renderer, handler, level + 1); 517 518 bool quickRejected = properties().getClipToBounds() 519 && renderer.quickRejectConservative(0, 0, properties().getWidth(), properties().getHeight()); 520 if (!quickRejected) { 521 Vector<ZDrawDisplayListOpPair> zTranslatedNodes; 522 buildZSortedChildList(zTranslatedNodes); 523 524 // for 3d root, draw children with negative z values 525 iterate3dChildren(zTranslatedNodes, kNegativeZChildren, renderer, handler); 526 527 DisplayListLogBuffer& logBuffer = DisplayListLogBuffer::getInstance(); 528 const int saveCountOffset = renderer.getSaveCount() - 1; 529 const int projectionReceiveIndex = mDisplayListData->projectionReceiveIndex; 530 for (unsigned int i = 0; i < mDisplayListData->displayListOps.size(); i++) { 531 DisplayListOp *op = mDisplayListData->displayListOps[i]; 532 533#if DEBUG_DISPLAY_LIST 534 op->output(level + 1); 535#endif 536 537 logBuffer.writeCommand(level, op->name()); 538 handler(op, saveCountOffset, properties().getClipToBounds()); 539 540 if (CC_UNLIKELY(i == projectionReceiveIndex && mProjectedNodes.size() > 0)) { 541 iterateProjectedChildren(renderer, handler, level); 542 } 543 } 544 545 // for 3d root, draw children with positive z values 546 iterate3dChildren(zTranslatedNodes, kPositiveZChildren, renderer, handler); 547 } 548 549 DISPLAY_LIST_LOGD("%*sRestoreToCount %d", (level + 1) * 2, "", restoreTo); 550 handler(new (alloc) RestoreToCountOp(restoreTo), 551 PROPERTY_SAVECOUNT, properties().getClipToBounds()); 552 renderer.setOverrideLayerAlpha(1.0f); 553} 554 555} /* namespace uirenderer */ 556} /* namespace android */ 557