blob: 18d86122a1c9a38d3d299dc5bfe4d1c8bb6d1d4a [file] [log] [blame]
John Reck113e0822014-03-18 09:22:59 -07001/*
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
John Reck113e0822014-03-18 09:22:59 -070017#include "RenderNode.h"
18
John Recke45b1fd2014-04-15 09:50:16 -070019#include <algorithm>
John Reckc25e5062014-06-18 14:21:29 -070020#include <string>
John Recke45b1fd2014-04-15 09:50:16 -070021
John Reck113e0822014-03-18 09:22:59 -070022#include <SkCanvas.h>
23#include <algorithm>
24
John Reck113e0822014-03-18 09:22:59 -070025
John Recke4267ea2014-06-03 15:53:15 -070026#include "DamageAccumulator.h"
John Reck113e0822014-03-18 09:22:59 -070027#include "Debug.h"
Chris Craikb565df12015-10-05 13:00:52 -070028#if HWUI_NEW_OPS
29#include "RecordedOp.h"
30#endif
John Reck113e0822014-03-18 09:22:59 -070031#include "DisplayListOp.h"
John Reck25fbb3f2014-06-12 13:46:45 -070032#include "LayerRenderer.h"
33#include "OpenGLRenderer.h"
Tom Hudson2dc236b2014-10-15 15:46:42 -040034#include "TreeInfo.h"
Chris Craike0bb87d2014-04-22 17:55:41 -070035#include "utils/MathUtils.h"
Chris Craik70850ea2014-11-18 10:49:23 -080036#include "utils/TraceUtils.h"
John Reck998a6d82014-08-28 15:35:53 -070037#include "renderthread/CanvasContext.h"
John Reck113e0822014-03-18 09:22:59 -070038
John Recke248bd12015-08-05 13:53:53 -070039#include "protos/hwui.pb.h"
40#include "protos/ProtoHelpers.h"
41
John Reck113e0822014-03-18 09:22:59 -070042namespace android {
43namespace uirenderer {
44
John Reck443a7142014-09-04 17:40:05 -070045void RenderNode::debugDumpLayers(const char* prefix) {
46 if (mLayer) {
47 ALOGD("%sNode %p (%s) has layer %p (fbo = %u, wasBuildLayered = %s)",
48 prefix, this, getName(), mLayer, mLayer->getFbo(),
49 mLayer->wasBuildLayered ? "true" : "false");
50 }
Chris Craik003cc3d2015-10-16 10:24:55 -070051 if (mDisplayList) {
Chris Craikb36af872015-10-16 14:23:12 -070052 for (auto&& child : mDisplayList->getChildren()) {
Chris Craik10ed6922015-10-15 10:55:15 -070053 child->renderNode->debugDumpLayers(prefix);
John Reck443a7142014-09-04 17:40:05 -070054 }
55 }
56}
57
John Reck8de65a82014-04-09 15:23:38 -070058RenderNode::RenderNode()
John Reckff941dc2014-05-14 16:34:14 -070059 : mDirtyPropertyFields(0)
Chris Craik003cc3d2015-10-16 10:24:55 -070060 , mNeedsDisplayListSync(false)
61 , mDisplayList(nullptr)
62 , mStagingDisplayList(nullptr)
John Reck68bfe0a2014-06-24 15:34:58 -070063 , mAnimatorManager(*this)
Chris Craikd41c4d82015-01-05 15:51:13 -080064 , mLayer(nullptr)
John Reckdcba6722014-07-08 13:59:49 -070065 , mParentCount(0) {
John Reck113e0822014-03-18 09:22:59 -070066}
67
68RenderNode::~RenderNode() {
Chris Craik003cc3d2015-10-16 10:24:55 -070069 deleteDisplayList();
70 delete mStagingDisplayList;
John Reck0e89e2b2014-10-31 14:49:06 -070071 if (mLayer) {
72 ALOGW("Memory Warning: Layer %p missed its detachment, held on to for far too long!", mLayer);
73 mLayer->postDecStrong();
Chris Craikd41c4d82015-01-05 15:51:13 -080074 mLayer = nullptr;
John Reck0e89e2b2014-10-31 14:49:06 -070075 }
John Reck113e0822014-03-18 09:22:59 -070076}
77
Chris Craik003cc3d2015-10-16 10:24:55 -070078void RenderNode::setStagingDisplayList(DisplayList* displayList) {
79 mNeedsDisplayListSync = true;
80 delete mStagingDisplayList;
81 mStagingDisplayList = displayList;
John Reck113e0822014-03-18 09:22:59 -070082}
83
84/**
85 * This function is a simplified version of replay(), where we simply retrieve and log the
86 * display list. This function should remain in sync with the replay() function.
87 */
88void RenderNode::output(uint32_t level) {
Chris Craikbf72eb82015-06-08 11:30:44 -070089 ALOGD("%*sStart display list (%p, %s%s%s%s%s%s)", (level - 1) * 2, "", this,
Chris Craikb5a54352014-11-21 14:54:35 -080090 getName(),
Chris Craik43a1d312015-05-27 11:28:14 -070091 (MathUtils::isZero(properties().getAlpha()) ? ", zero alpha" : ""),
Chris Craikb5a54352014-11-21 14:54:35 -080092 (properties().hasShadow() ? ", casting shadow" : ""),
93 (isRenderable() ? "" : ", empty"),
Chris Craikbf72eb82015-06-08 11:30:44 -070094 (properties().getProjectBackwards() ? ", projected" : ""),
Chris Craikd41c4d82015-01-05 15:51:13 -080095 (mLayer != nullptr ? ", on HW Layer" : ""));
John Reck113e0822014-03-18 09:22:59 -070096 ALOGD("%*s%s %d", level * 2, "", "Save",
97 SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag);
98
John Reckd0a0b2a2014-03-20 16:28:56 -070099 properties().debugOutputProperties(level);
Chris Craik10ed6922015-10-15 10:55:15 -0700100
Chris Craik003cc3d2015-10-16 10:24:55 -0700101 if (mDisplayList) {
Chris Craik10ed6922015-10-15 10:55:15 -0700102#if HWUI_NEW_OPS
103 LOG_ALWAYS_FATAL("op dumping unsupported");
104#else
Chris Craik8afd0f22014-08-21 17:41:57 -0700105 // TODO: consider printing the chunk boundaries here
Chris Craik003cc3d2015-10-16 10:24:55 -0700106 for (auto&& op : mDisplayList->getOps()) {
Chris Craik10ed6922015-10-15 10:55:15 -0700107 op->output(level, DisplayListOp::kOpLogFlag_Recurse);
John Reckdc0349b2014-08-06 15:28:07 -0700108 }
Chris Craik10ed6922015-10-15 10:55:15 -0700109#endif
John Reck113e0822014-03-18 09:22:59 -0700110 }
111
Chris Craik3f0854292014-04-15 16:18:08 -0700112 ALOGD("%*sDone (%p, %s)", (level - 1) * 2, "", this, getName());
John Reck113e0822014-03-18 09:22:59 -0700113}
114
John Recke248bd12015-08-05 13:53:53 -0700115void RenderNode::copyTo(proto::RenderNode *pnode) {
116 pnode->set_id(static_cast<uint64_t>(
117 reinterpret_cast<uintptr_t>(this)));
118 pnode->set_name(mName.string(), mName.length());
119
120 proto::RenderProperties* pprops = pnode->mutable_properties();
121 pprops->set_left(properties().getLeft());
122 pprops->set_top(properties().getTop());
123 pprops->set_right(properties().getRight());
124 pprops->set_bottom(properties().getBottom());
125 pprops->set_clip_flags(properties().getClippingFlags());
126 pprops->set_alpha(properties().getAlpha());
127 pprops->set_translation_x(properties().getTranslationX());
128 pprops->set_translation_y(properties().getTranslationY());
129 pprops->set_translation_z(properties().getTranslationZ());
130 pprops->set_elevation(properties().getElevation());
131 pprops->set_rotation(properties().getRotation());
132 pprops->set_rotation_x(properties().getRotationX());
133 pprops->set_rotation_y(properties().getRotationY());
134 pprops->set_scale_x(properties().getScaleX());
135 pprops->set_scale_y(properties().getScaleY());
136 pprops->set_pivot_x(properties().getPivotX());
137 pprops->set_pivot_y(properties().getPivotY());
138 pprops->set_has_overlapping_rendering(properties().getHasOverlappingRendering());
139 pprops->set_pivot_explicitly_set(properties().isPivotExplicitlySet());
140 pprops->set_project_backwards(properties().getProjectBackwards());
141 pprops->set_projection_receiver(properties().isProjectionReceiver());
142 set(pprops->mutable_clip_bounds(), properties().getClipBounds());
143
144 const Outline& outline = properties().getOutline();
145 if (outline.getType() != Outline::Type::None) {
146 proto::Outline* poutline = pprops->mutable_outline();
147 poutline->clear_path();
148 if (outline.getType() == Outline::Type::Empty) {
149 poutline->set_type(proto::Outline_Type_Empty);
150 } else if (outline.getType() == Outline::Type::ConvexPath) {
151 poutline->set_type(proto::Outline_Type_ConvexPath);
152 if (const SkPath* path = outline.getPath()) {
153 set(poutline->mutable_path(), *path);
154 }
155 } else if (outline.getType() == Outline::Type::RoundRect) {
156 poutline->set_type(proto::Outline_Type_RoundRect);
157 } else {
158 ALOGW("Uknown outline type! %d", static_cast<int>(outline.getType()));
159 poutline->set_type(proto::Outline_Type_None);
160 }
161 poutline->set_should_clip(outline.getShouldClip());
162 poutline->set_alpha(outline.getAlpha());
163 poutline->set_radius(outline.getRadius());
164 set(poutline->mutable_bounds(), outline.getBounds());
165 } else {
166 pprops->clear_outline();
167 }
168
169 const RevealClip& revealClip = properties().getRevealClip();
170 if (revealClip.willClip()) {
171 proto::RevealClip* prevealClip = pprops->mutable_reveal_clip();
172 prevealClip->set_x(revealClip.getX());
173 prevealClip->set_y(revealClip.getY());
174 prevealClip->set_radius(revealClip.getRadius());
175 } else {
176 pprops->clear_reveal_clip();
177 }
178
179 pnode->clear_children();
Chris Craik003cc3d2015-10-16 10:24:55 -0700180 if (mDisplayList) {
Chris Craikb36af872015-10-16 14:23:12 -0700181 for (auto&& child : mDisplayList->getChildren()) {
Chris Craikb565df12015-10-05 13:00:52 -0700182 child->renderNode->copyTo(pnode->add_children());
John Recke248bd12015-08-05 13:53:53 -0700183 }
184 }
185}
186
John Reckfe5e7b72014-05-23 17:42:28 -0700187int RenderNode::getDebugSize() {
188 int size = sizeof(RenderNode);
Chris Craik003cc3d2015-10-16 10:24:55 -0700189 if (mStagingDisplayList) {
190 size += mStagingDisplayList->getUsedSize();
John Reckfe5e7b72014-05-23 17:42:28 -0700191 }
Chris Craik003cc3d2015-10-16 10:24:55 -0700192 if (mDisplayList && mDisplayList != mStagingDisplayList) {
193 size += mDisplayList->getUsedSize();
John Reckfe5e7b72014-05-23 17:42:28 -0700194 }
195 return size;
196}
197
John Reckf4198b72014-04-09 17:00:04 -0700198void RenderNode::prepareTree(TreeInfo& info) {
199 ATRACE_CALL();
Chris Craik69e5adf2014-08-14 13:34:01 -0700200 LOG_ALWAYS_FATAL_IF(!info.damageAccumulator, "DamageAccumulator missing");
John Reckf4198b72014-04-09 17:00:04 -0700201
Chris Craika766cb22015-06-08 16:49:43 -0700202 // Functors don't correctly handle stencil usage of overdraw debugging - shove 'em in a layer.
203 bool functorsNeedLayer = Properties::debugOverdraw;
204
205 prepareTreeImpl(info, functorsNeedLayer);
John Reckf4198b72014-04-09 17:00:04 -0700206}
207
John Reck68bfe0a2014-06-24 15:34:58 -0700208void RenderNode::addAnimator(const sp<BaseRenderNodeAnimator>& animator) {
209 mAnimatorManager.addAnimator(animator);
210}
211
John Recke4267ea2014-06-03 15:53:15 -0700212void RenderNode::damageSelf(TreeInfo& info) {
John Reckce9f3082014-06-17 16:18:09 -0700213 if (isRenderable()) {
John Reck293e8682014-06-17 10:34:02 -0700214 if (properties().getClipDamageToBounds()) {
John Recka447d292014-06-11 18:39:44 -0700215 info.damageAccumulator->dirty(0, 0, properties().getWidth(), properties().getHeight());
216 } else {
217 // Hope this is big enough?
218 // TODO: Get this from the display list ops or something
John Reckc1288232015-08-12 13:39:11 -0700219 info.damageAccumulator->dirty(DIRTY_MIN, DIRTY_MIN, DIRTY_MAX, DIRTY_MAX);
John Recka447d292014-06-11 18:39:44 -0700220 }
John Recke4267ea2014-06-03 15:53:15 -0700221 }
222}
223
John Recka7c2ea22014-08-08 13:21:00 -0700224void RenderNode::prepareLayer(TreeInfo& info, uint32_t dirtyMask) {
Chris Craik856f0cc2015-04-21 15:13:29 -0700225 LayerType layerType = properties().effectiveLayerType();
Chris Craik182952f2015-03-09 14:17:29 -0700226 if (CC_UNLIKELY(layerType == LayerType::RenderLayer)) {
John Recka7c2ea22014-08-08 13:21:00 -0700227 // Damage applied so far needs to affect our parent, but does not require
228 // the layer to be updated. So we pop/push here to clear out the current
229 // damage and get a clean state for display list or children updates to
230 // affect, which will require the layer to be updated
231 info.damageAccumulator->popTransform();
232 info.damageAccumulator->pushTransform(this);
233 if (dirtyMask & DISPLAY_LIST) {
234 damageSelf(info);
235 }
John Reck25fbb3f2014-06-12 13:46:45 -0700236 }
237}
238
239void RenderNode::pushLayerUpdate(TreeInfo& info) {
Chris Craik856f0cc2015-04-21 15:13:29 -0700240 LayerType layerType = properties().effectiveLayerType();
John Reck25fbb3f2014-06-12 13:46:45 -0700241 // If we are not a layer OR we cannot be rendered (eg, view was detached)
242 // we need to destroy any Layers we may have had previously
Chris Craik182952f2015-03-09 14:17:29 -0700243 if (CC_LIKELY(layerType != LayerType::RenderLayer) || CC_UNLIKELY(!isRenderable())) {
John Reck25fbb3f2014-06-12 13:46:45 -0700244 if (CC_UNLIKELY(mLayer)) {
245 LayerRenderer::destroyLayer(mLayer);
Chris Craikd41c4d82015-01-05 15:51:13 -0800246 mLayer = nullptr;
John Reck25fbb3f2014-06-12 13:46:45 -0700247 }
248 return;
249 }
250
Chris Craik69e5adf2014-08-14 13:34:01 -0700251 bool transformUpdateNeeded = false;
John Reck25fbb3f2014-06-12 13:46:45 -0700252 if (!mLayer) {
Chris Craike2e53a72015-10-28 15:55:40 -0700253 mLayer = LayerRenderer::createRenderLayer(
254 info.canvasContext.getRenderState(), getWidth(), getHeight());
John Reck25fbb3f2014-06-12 13:46:45 -0700255 applyLayerPropertiesToLayer(info);
256 damageSelf(info);
Chris Craik69e5adf2014-08-14 13:34:01 -0700257 transformUpdateNeeded = true;
John Reck25fbb3f2014-06-12 13:46:45 -0700258 } else if (mLayer->layer.getWidth() != getWidth() || mLayer->layer.getHeight() != getHeight()) {
John Reckc25e5062014-06-18 14:21:29 -0700259 if (!LayerRenderer::resizeLayer(mLayer, getWidth(), getHeight())) {
260 LayerRenderer::destroyLayer(mLayer);
Chris Craikd41c4d82015-01-05 15:51:13 -0800261 mLayer = nullptr;
John Reckc25e5062014-06-18 14:21:29 -0700262 }
John Reck25fbb3f2014-06-12 13:46:45 -0700263 damageSelf(info);
Chris Craik69e5adf2014-08-14 13:34:01 -0700264 transformUpdateNeeded = true;
265 }
266
John Reck25fbb3f2014-06-12 13:46:45 -0700267 SkRect dirty;
268 info.damageAccumulator->peekAtDirty(&dirty);
John Reck25fbb3f2014-06-12 13:46:45 -0700269
John Reckc25e5062014-06-18 14:21:29 -0700270 if (!mLayer) {
John Reck0e89e2b2014-10-31 14:49:06 -0700271 Caches::getInstance().dumpMemoryUsage();
John Reckc25e5062014-06-18 14:21:29 -0700272 if (info.errorHandler) {
273 std::string msg = "Unable to create layer for ";
274 msg += getName();
275 info.errorHandler->onError(msg);
276 }
277 return;
278 }
279
Chris Craikc71bfca2014-08-21 10:18:58 -0700280 if (transformUpdateNeeded) {
281 // update the transform in window of the layer to reset its origin wrt light source position
282 Matrix4 windowTransform;
283 info.damageAccumulator->computeCurrentTransform(&windowTransform);
284 mLayer->setWindowTransform(windowTransform);
285 }
John Reckc79eabc2014-08-05 11:03:42 -0700286
287 if (dirty.intersect(0, 0, getWidth(), getHeight())) {
Mike Reed71487eb2014-11-19 16:13:20 -0500288 dirty.roundOut(&dirty);
John Reck25fbb3f2014-06-12 13:46:45 -0700289 mLayer->updateDeferred(this, dirty.fLeft, dirty.fTop, dirty.fRight, dirty.fBottom);
290 }
291 // This is not inside the above if because we may have called
292 // updateDeferred on a previous prepare pass that didn't have a renderer
293 if (info.renderer && mLayer->deferredUpdateScheduled) {
294 info.renderer->pushLayerUpdate(mLayer);
295 }
John Reck998a6d82014-08-28 15:35:53 -0700296
Chris Craike2e53a72015-10-28 15:55:40 -0700297 // There might be prefetched layers that need to be accounted for.
298 // That might be us, so tell CanvasContext that this layer is in the
299 // tree and should not be destroyed.
300 info.canvasContext.markLayerInUse(this);
John Reck25fbb3f2014-06-12 13:46:45 -0700301}
302
Chris Craika766cb22015-06-08 16:49:43 -0700303/**
304 * Traverse down the the draw tree to prepare for a frame.
305 *
306 * MODE_FULL = UI Thread-driven (thus properties must be synced), otherwise RT driven
307 *
308 * While traversing down the tree, functorsNeedLayer flag is set to true if anything that uses the
309 * stencil buffer may be needed. Views that use a functor to draw will be forced onto a layer.
310 */
311void RenderNode::prepareTreeImpl(TreeInfo& info, bool functorsNeedLayer) {
John Recka447d292014-06-11 18:39:44 -0700312 info.damageAccumulator->pushTransform(this);
John Reckf47a5942014-06-30 16:20:04 -0700313
John Reckdcba6722014-07-08 13:59:49 -0700314 if (info.mode == TreeInfo::MODE_FULL) {
John Reck25fbb3f2014-06-12 13:46:45 -0700315 pushStagingPropertiesChanges(info);
John Recke45b1fd2014-04-15 09:50:16 -0700316 }
John Reck9eb9f6f2014-08-21 11:23:05 -0700317 uint32_t animatorDirtyMask = 0;
318 if (CC_LIKELY(info.runAnimations)) {
319 animatorDirtyMask = mAnimatorManager.animate(info);
320 }
Chris Craika766cb22015-06-08 16:49:43 -0700321
John Reck3f725f02015-06-16 10:29:31 -0700322 bool willHaveFunctor = false;
Chris Craik003cc3d2015-10-16 10:24:55 -0700323 if (info.mode == TreeInfo::MODE_FULL && mStagingDisplayList) {
Chris Craikb36af872015-10-16 14:23:12 -0700324 willHaveFunctor = !mStagingDisplayList->getFunctors().empty();
Chris Craik003cc3d2015-10-16 10:24:55 -0700325 } else if (mDisplayList) {
Chris Craikb36af872015-10-16 14:23:12 -0700326 willHaveFunctor = !mDisplayList->getFunctors().empty();
John Reck3f725f02015-06-16 10:29:31 -0700327 }
Chris Craika766cb22015-06-08 16:49:43 -0700328 bool childFunctorsNeedLayer = mProperties.prepareForFunctorPresence(
329 willHaveFunctor, functorsNeedLayer);
330
John Recka7c2ea22014-08-08 13:21:00 -0700331 prepareLayer(info, animatorDirtyMask);
John Reckdcba6722014-07-08 13:59:49 -0700332 if (info.mode == TreeInfo::MODE_FULL) {
John Reck25fbb3f2014-06-12 13:46:45 -0700333 pushStagingDisplayListChanges(info);
334 }
Chris Craik003cc3d2015-10-16 10:24:55 -0700335 prepareSubTree(info, childFunctorsNeedLayer, mDisplayList);
John Reck25fbb3f2014-06-12 13:46:45 -0700336 pushLayerUpdate(info);
337
John Recka447d292014-06-11 18:39:44 -0700338 info.damageAccumulator->popTransform();
John Reckf4198b72014-04-09 17:00:04 -0700339}
340
Chris Craikb565df12015-10-05 13:00:52 -0700341void RenderNode::syncProperties() {
342 mProperties = mStagingProperties;
343}
344
John Reck25fbb3f2014-06-12 13:46:45 -0700345void RenderNode::pushStagingPropertiesChanges(TreeInfo& info) {
John Reckff941dc2014-05-14 16:34:14 -0700346 // Push the animators first so that setupStartValueIfNecessary() is called
347 // before properties() is trampled by stagingProperties(), as they are
348 // required by some animators.
John Reck9eb9f6f2014-08-21 11:23:05 -0700349 if (CC_LIKELY(info.runAnimations)) {
John Reck119907c2014-08-14 09:02:01 -0700350 mAnimatorManager.pushStaging();
John Reck9eb9f6f2014-08-21 11:23:05 -0700351 }
John Reckff941dc2014-05-14 16:34:14 -0700352 if (mDirtyPropertyFields) {
353 mDirtyPropertyFields = 0;
John Recke4267ea2014-06-03 15:53:15 -0700354 damageSelf(info);
John Recka447d292014-06-11 18:39:44 -0700355 info.damageAccumulator->popTransform();
Chris Craikb565df12015-10-05 13:00:52 -0700356 syncProperties();
John Reck25fbb3f2014-06-12 13:46:45 -0700357 applyLayerPropertiesToLayer(info);
John Recke4267ea2014-06-03 15:53:15 -0700358 // We could try to be clever and only re-damage if the matrix changed.
359 // However, we don't need to worry about that. The cost of over-damaging
360 // here is only going to be a single additional map rect of this node
361 // plus a rect join(). The parent's transform (and up) will only be
362 // performed once.
John Recka447d292014-06-11 18:39:44 -0700363 info.damageAccumulator->pushTransform(this);
John Recke4267ea2014-06-03 15:53:15 -0700364 damageSelf(info);
John Reckff941dc2014-05-14 16:34:14 -0700365 }
John Reck25fbb3f2014-06-12 13:46:45 -0700366}
367
Andreas Gampe64bb4132014-11-22 00:35:09 +0000368void RenderNode::applyLayerPropertiesToLayer(TreeInfo& info) {
John Reck25fbb3f2014-06-12 13:46:45 -0700369 if (CC_LIKELY(!mLayer)) return;
370
371 const LayerProperties& props = properties().layerProperties();
372 mLayer->setAlpha(props.alpha(), props.xferMode());
373 mLayer->setColorFilter(props.colorFilter());
374 mLayer->setBlend(props.needsBlending());
375}
376
Chris Craikb565df12015-10-05 13:00:52 -0700377void RenderNode::syncDisplayList() {
378 // Make sure we inc first so that we don't fluctuate between 0 and 1,
379 // which would thrash the layer cache
Chris Craik003cc3d2015-10-16 10:24:55 -0700380 if (mStagingDisplayList) {
Chris Craikb36af872015-10-16 14:23:12 -0700381 for (auto&& child : mStagingDisplayList->getChildren()) {
Chris Craikb565df12015-10-05 13:00:52 -0700382 child->renderNode->incParentRefCount();
383 }
384 }
Chris Craik003cc3d2015-10-16 10:24:55 -0700385 deleteDisplayList();
386 mDisplayList = mStagingDisplayList;
387 mStagingDisplayList = nullptr;
388 if (mDisplayList) {
Chris Craikb36af872015-10-16 14:23:12 -0700389 for (size_t i = 0; i < mDisplayList->getFunctors().size(); i++) {
390 (*mDisplayList->getFunctors()[i])(DrawGlInfo::kModeSync, nullptr);
Chris Craikb565df12015-10-05 13:00:52 -0700391 }
392 }
393}
394
John Reck25fbb3f2014-06-12 13:46:45 -0700395void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) {
Chris Craik003cc3d2015-10-16 10:24:55 -0700396 if (mNeedsDisplayListSync) {
397 mNeedsDisplayListSync = false;
John Reck5c9d7172014-10-22 11:32:27 -0700398 // Damage with the old display list first then the new one to catch any
399 // changes in isRenderable or, in the future, bounds
400 damageSelf(info);
Chris Craikb565df12015-10-05 13:00:52 -0700401 syncDisplayList();
John Recke4267ea2014-06-03 15:53:15 -0700402 damageSelf(info);
John Reck8de65a82014-04-09 15:23:38 -0700403 }
John Reck8de65a82014-04-09 15:23:38 -0700404}
405
Chris Craik003cc3d2015-10-16 10:24:55 -0700406void RenderNode::deleteDisplayList() {
407 if (mDisplayList) {
Chris Craikb36af872015-10-16 14:23:12 -0700408 for (auto&& child : mDisplayList->getChildren()) {
Chris Craikb565df12015-10-05 13:00:52 -0700409 child->renderNode->decParentRefCount();
John Reckdcba6722014-07-08 13:59:49 -0700410 }
411 }
Chris Craik003cc3d2015-10-16 10:24:55 -0700412 delete mDisplayList;
413 mDisplayList = nullptr;
John Reckdcba6722014-07-08 13:59:49 -0700414}
415
Chris Craik003cc3d2015-10-16 10:24:55 -0700416void RenderNode::prepareSubTree(TreeInfo& info, bool functorsNeedLayer, DisplayList* subtree) {
John Reck8de65a82014-04-09 15:23:38 -0700417 if (subtree) {
John Reck860d1552014-04-11 19:15:05 -0700418 TextureCache& cache = Caches::getInstance().textureCache;
Chris Craikb36af872015-10-16 14:23:12 -0700419 info.out.hasFunctors |= subtree->getFunctors().size();
420 for (auto&& bitmapResource : subtree->getBitmapResources()) {
Chris Craike2e53a72015-10-28 15:55:40 -0700421 void* ownerToken = &info.canvasContext;
422 info.prepareTextures = cache.prefetchAndMarkInUse(ownerToken, bitmapResource);
John Reckf4198b72014-04-09 17:00:04 -0700423 }
Chris Craikb36af872015-10-16 14:23:12 -0700424 for (auto&& op : subtree->getChildren()) {
Chris Craikb565df12015-10-05 13:00:52 -0700425 RenderNode* childNode = op->renderNode;
426#if HWUI_NEW_OPS
427 info.damageAccumulator->pushTransform(&op->localMatrix);
428 bool childFunctorsNeedLayer = functorsNeedLayer; // TODO! || op->mRecordedWithPotentialStencilClip;
429#else
John Recka447d292014-06-11 18:39:44 -0700430 info.damageAccumulator->pushTransform(&op->mTransformFromParent);
Chris Craika766cb22015-06-08 16:49:43 -0700431 bool childFunctorsNeedLayer = functorsNeedLayer
432 // Recorded with non-rect clip, or canvas-rotated by parent
433 || op->mRecordedWithPotentialStencilClip;
Chris Craikb565df12015-10-05 13:00:52 -0700434#endif
Chris Craika766cb22015-06-08 16:49:43 -0700435 childNode->prepareTreeImpl(info, childFunctorsNeedLayer);
John Recka447d292014-06-11 18:39:44 -0700436 info.damageAccumulator->popTransform();
John Reck5bf11bb2014-03-25 10:22:09 -0700437 }
John Reck113e0822014-03-18 09:22:59 -0700438 }
439}
440
John Reckdcba6722014-07-08 13:59:49 -0700441void RenderNode::destroyHardwareResources() {
442 if (mLayer) {
443 LayerRenderer::destroyLayer(mLayer);
Chris Craikd41c4d82015-01-05 15:51:13 -0800444 mLayer = nullptr;
John Reckdcba6722014-07-08 13:59:49 -0700445 }
Chris Craik003cc3d2015-10-16 10:24:55 -0700446 if (mDisplayList) {
Chris Craikb36af872015-10-16 14:23:12 -0700447 for (auto&& child : mDisplayList->getChildren()) {
Chris Craikb565df12015-10-05 13:00:52 -0700448 child->renderNode->destroyHardwareResources();
John Reckdcba6722014-07-08 13:59:49 -0700449 }
Chris Craik003cc3d2015-10-16 10:24:55 -0700450 if (mNeedsDisplayListSync) {
John Reckdcba6722014-07-08 13:59:49 -0700451 // Next prepare tree we are going to push a new display list, so we can
452 // drop our current one now
Chris Craik003cc3d2015-10-16 10:24:55 -0700453 deleteDisplayList();
John Reckdcba6722014-07-08 13:59:49 -0700454 }
455 }
456}
457
458void RenderNode::decParentRefCount() {
459 LOG_ALWAYS_FATAL_IF(!mParentCount, "already 0!");
460 mParentCount--;
461 if (!mParentCount) {
462 // If a child of ours is being attached to our parent then this will incorrectly
463 // destroy its hardware resources. However, this situation is highly unlikely
464 // and the failure is "just" that the layer is re-created, so this should
465 // be safe enough
466 destroyHardwareResources();
467 }
468}
469
Chris Craikb565df12015-10-05 13:00:52 -0700470bool RenderNode::applyViewProperties(CanvasState& canvasState) const {
471 const Outline& outline = properties().getOutline();
472 if (properties().getAlpha() <= 0
473 || (outline.getShouldClip() && outline.isEmpty())
474 || properties().getScaleX() == 0
475 || properties().getScaleY() == 0) {
476 return false; // rejected
477 }
478
479 if (properties().getLeft() != 0 || properties().getTop() != 0) {
480 canvasState.translate(properties().getLeft(), properties().getTop());
481 }
482 if (properties().getStaticMatrix()) {
483 canvasState.concatMatrix(*properties().getStaticMatrix());
484 } else if (properties().getAnimationMatrix()) {
485 canvasState.concatMatrix(*properties().getAnimationMatrix());
486 }
487 if (properties().hasTransformMatrix()) {
488 if (properties().isTransformTranslateOnly()) {
489 canvasState.translate(properties().getTranslationX(), properties().getTranslationY());
490 } else {
491 canvasState.concatMatrix(*properties().getTransformMatrix());
492 }
493 }
494 return !canvasState.quickRejectConservative(
495 0, 0, properties().getWidth(), properties().getHeight());
496}
497
John Reck113e0822014-03-18 09:22:59 -0700498/*
499 * For property operations, we pass a savecount of 0, since the operations aren't part of the
500 * displaylist, and thus don't have to compensate for the record-time/playback-time discrepancy in
John Reckd0a0b2a2014-03-20 16:28:56 -0700501 * base saveCount (i.e., how RestoreToCount uses saveCount + properties().getCount())
John Reck113e0822014-03-18 09:22:59 -0700502 */
503#define PROPERTY_SAVECOUNT 0
504
505template <class T>
Chris Craikb265e2c2014-03-27 15:50:09 -0700506void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) {
John Reck113e0822014-03-18 09:22:59 -0700507#if DEBUG_DISPLAY_LIST
Chris Craikb265e2c2014-03-27 15:50:09 -0700508 properties().debugOutputProperties(handler.level() + 1);
John Reck113e0822014-03-18 09:22:59 -0700509#endif
John Reckd0a0b2a2014-03-20 16:28:56 -0700510 if (properties().getLeft() != 0 || properties().getTop() != 0) {
511 renderer.translate(properties().getLeft(), properties().getTop());
John Reck113e0822014-03-18 09:22:59 -0700512 }
John Reckd0a0b2a2014-03-20 16:28:56 -0700513 if (properties().getStaticMatrix()) {
Derek Sollenberger13908822013-12-10 12:28:58 -0500514 renderer.concatMatrix(*properties().getStaticMatrix());
John Reckd0a0b2a2014-03-20 16:28:56 -0700515 } else if (properties().getAnimationMatrix()) {
Derek Sollenberger13908822013-12-10 12:28:58 -0500516 renderer.concatMatrix(*properties().getAnimationMatrix());
John Reck113e0822014-03-18 09:22:59 -0700517 }
John Reckf7483e32014-04-11 08:54:47 -0700518 if (properties().hasTransformMatrix()) {
519 if (properties().isTransformTranslateOnly()) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700520 renderer.translate(properties().getTranslationX(), properties().getTranslationY());
John Reck113e0822014-03-18 09:22:59 -0700521 } else {
John Reckd0a0b2a2014-03-20 16:28:56 -0700522 renderer.concatMatrix(*properties().getTransformMatrix());
John Reck113e0822014-03-18 09:22:59 -0700523 }
524 }
Chris Craik856f0cc2015-04-21 15:13:29 -0700525 const bool isLayer = properties().effectiveLayerType() != LayerType::None;
Chris Craika753f4c2014-07-24 12:39:17 -0700526 int clipFlags = properties().getClippingFlags();
John Reckd0a0b2a2014-03-20 16:28:56 -0700527 if (properties().getAlpha() < 1) {
John Reck25fbb3f2014-06-12 13:46:45 -0700528 if (isLayer) {
Chris Craika753f4c2014-07-24 12:39:17 -0700529 clipFlags &= ~CLIP_TO_BOUNDS; // bounds clipping done by layer
John Reck113e0822014-03-18 09:22:59 -0700530 }
Chris Craik4e9d9b22015-06-12 11:07:23 -0700531 if (CC_LIKELY(isLayer || !properties().getHasOverlappingRendering())) {
532 // simply scale rendering content's alpha
533 renderer.scaleAlpha(properties().getAlpha());
534 } else {
535 // savelayer needed to create an offscreen buffer
536 Rect layerBounds(0, 0, getWidth(), getHeight());
537 if (clipFlags) {
538 properties().getClippingRectForFlags(clipFlags, &layerBounds);
539 clipFlags = 0; // all clipping done by savelayer
540 }
541 SaveLayerOp* op = new (handler.allocator()) SaveLayerOp(
542 layerBounds.left, layerBounds.top,
543 layerBounds.right, layerBounds.bottom,
544 (int) (properties().getAlpha() * 255),
545 SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kClipToLayer_SaveFlag);
546 handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds());
547 }
Chris Craik1a0808e2015-05-13 16:33:04 -0700548
549 if (CC_UNLIKELY(ATRACE_ENABLED() && properties().promotedToLayer())) {
Chris Craik4e9d9b22015-06-12 11:07:23 -0700550 // pretend alpha always causes savelayer to warn about
551 // performance problem affecting old versions
Chris Craik1a0808e2015-05-13 16:33:04 -0700552 ATRACE_FORMAT("%s alpha caused saveLayer %dx%d", getName(),
553 static_cast<int>(getWidth()),
554 static_cast<int>(getHeight()));
555 }
John Reck113e0822014-03-18 09:22:59 -0700556 }
Chris Craika753f4c2014-07-24 12:39:17 -0700557 if (clipFlags) {
558 Rect clipRect;
559 properties().getClippingRectForFlags(clipFlags, &clipRect);
Chris Craik8c271ca2014-03-25 10:33:01 -0700560 ClipRectOp* op = new (handler.allocator()) ClipRectOp(
Chris Craika753f4c2014-07-24 12:39:17 -0700561 clipRect.left, clipRect.top, clipRect.right, clipRect.bottom,
562 SkRegion::kIntersect_Op);
John Reckd0a0b2a2014-03-20 16:28:56 -0700563 handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds());
John Reck113e0822014-03-18 09:22:59 -0700564 }
Chris Craik8c271ca2014-03-25 10:33:01 -0700565
Chris Craike83cbd42014-09-03 17:52:24 -0700566 // TODO: support nesting round rect clips
Chris Craikaf4d04c2014-07-29 12:50:14 -0700567 if (mProperties.getRevealClip().willClip()) {
568 Rect bounds;
569 mProperties.getRevealClip().getBounds(&bounds);
570 renderer.setClippingRoundRect(handler.allocator(), bounds, mProperties.getRevealClip().getRadius());
571 } else if (mProperties.getOutline().willClip()) {
572 renderer.setClippingOutline(handler.allocator(), &(mProperties.getOutline()));
John Reck113e0822014-03-18 09:22:59 -0700573 }
574}
575
576/**
577 * Apply property-based transformations to input matrix
578 *
579 * If true3dTransform is set to true, the transform applied to the input matrix will use true 4x4
580 * matrix computation instead of the Skia 3x3 matrix + camera hackery.
581 */
Chris Craik69e5adf2014-08-14 13:34:01 -0700582void RenderNode::applyViewPropertyTransforms(mat4& matrix, bool true3dTransform) const {
John Reckd0a0b2a2014-03-20 16:28:56 -0700583 if (properties().getLeft() != 0 || properties().getTop() != 0) {
584 matrix.translate(properties().getLeft(), properties().getTop());
John Reck113e0822014-03-18 09:22:59 -0700585 }
John Reckd0a0b2a2014-03-20 16:28:56 -0700586 if (properties().getStaticMatrix()) {
587 mat4 stat(*properties().getStaticMatrix());
John Reck113e0822014-03-18 09:22:59 -0700588 matrix.multiply(stat);
John Reckd0a0b2a2014-03-20 16:28:56 -0700589 } else if (properties().getAnimationMatrix()) {
590 mat4 anim(*properties().getAnimationMatrix());
John Reck113e0822014-03-18 09:22:59 -0700591 matrix.multiply(anim);
592 }
Chris Craike0bb87d2014-04-22 17:55:41 -0700593
Chris Craikcc39e162014-04-25 18:34:11 -0700594 bool applyTranslationZ = true3dTransform && !MathUtils::isZero(properties().getZ());
Chris Craike0bb87d2014-04-22 17:55:41 -0700595 if (properties().hasTransformMatrix() || applyTranslationZ) {
John Reckf7483e32014-04-11 08:54:47 -0700596 if (properties().isTransformTranslateOnly()) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700597 matrix.translate(properties().getTranslationX(), properties().getTranslationY(),
Chris Craikcc39e162014-04-25 18:34:11 -0700598 true3dTransform ? properties().getZ() : 0.0f);
John Reck113e0822014-03-18 09:22:59 -0700599 } else {
600 if (!true3dTransform) {
John Reckd0a0b2a2014-03-20 16:28:56 -0700601 matrix.multiply(*properties().getTransformMatrix());
John Reck113e0822014-03-18 09:22:59 -0700602 } else {
603 mat4 true3dMat;
604 true3dMat.loadTranslate(
John Reckd0a0b2a2014-03-20 16:28:56 -0700605 properties().getPivotX() + properties().getTranslationX(),
606 properties().getPivotY() + properties().getTranslationY(),
Chris Craikcc39e162014-04-25 18:34:11 -0700607 properties().getZ());
John Reckd0a0b2a2014-03-20 16:28:56 -0700608 true3dMat.rotate(properties().getRotationX(), 1, 0, 0);
609 true3dMat.rotate(properties().getRotationY(), 0, 1, 0);
610 true3dMat.rotate(properties().getRotation(), 0, 0, 1);
611 true3dMat.scale(properties().getScaleX(), properties().getScaleY(), 1);
612 true3dMat.translate(-properties().getPivotX(), -properties().getPivotY());
John Reck113e0822014-03-18 09:22:59 -0700613
614 matrix.multiply(true3dMat);
615 }
616 }
617 }
618}
619
620/**
621 * Organizes the DisplayList hierarchy to prepare for background projection reordering.
622 *
623 * This should be called before a call to defer() or drawDisplayList()
624 *
625 * Each DisplayList that serves as a 3d root builds its list of composited children,
626 * which are flagged to not draw in the standard draw loop.
627 */
628void RenderNode::computeOrdering() {
Chris Craikb565df12015-10-05 13:00:52 -0700629#if !HWUI_NEW_OPS
John Reck113e0822014-03-18 09:22:59 -0700630 ATRACE_CALL();
631 mProjectedNodes.clear();
632
633 // TODO: create temporary DDLOp and call computeOrderingImpl on top DisplayList so that
634 // transform properties are applied correctly to top level children
Chris Craik003cc3d2015-10-16 10:24:55 -0700635 if (mDisplayList == nullptr) return;
Chris Craikb36af872015-10-16 14:23:12 -0700636 for (unsigned int i = 0; i < mDisplayList->getChildren().size(); i++) {
637 DrawRenderNodeOp* childOp = mDisplayList->getChildren()[i];
Chris Craikb565df12015-10-05 13:00:52 -0700638 childOp->renderNode->computeOrderingImpl(childOp, &mProjectedNodes, &mat4::identity());
John Reck113e0822014-03-18 09:22:59 -0700639 }
Chris Craikb565df12015-10-05 13:00:52 -0700640#endif
John Reck113e0822014-03-18 09:22:59 -0700641}
642
643void RenderNode::computeOrderingImpl(
Chris Craika7090e02014-06-20 16:01:00 -0700644 DrawRenderNodeOp* opState,
John Reck272a6852015-07-29 16:48:58 -0700645 std::vector<DrawRenderNodeOp*>* compositedChildrenOfProjectionSurface,
John Reck113e0822014-03-18 09:22:59 -0700646 const mat4* transformFromProjectionSurface) {
Chris Craikb565df12015-10-05 13:00:52 -0700647#if !HWUI_NEW_OPS
John Reck113e0822014-03-18 09:22:59 -0700648 mProjectedNodes.clear();
Chris Craik003cc3d2015-10-16 10:24:55 -0700649 if (mDisplayList == nullptr || mDisplayList->isEmpty()) return;
John Reck113e0822014-03-18 09:22:59 -0700650
651 // TODO: should avoid this calculation in most cases
652 // TODO: just calculate single matrix, down to all leaf composited elements
653 Matrix4 localTransformFromProjectionSurface(*transformFromProjectionSurface);
654 localTransformFromProjectionSurface.multiply(opState->mTransformFromParent);
655
John Reckd0a0b2a2014-03-20 16:28:56 -0700656 if (properties().getProjectBackwards()) {
John Reck113e0822014-03-18 09:22:59 -0700657 // composited projectee, flag for out of order draw, save matrix, and store in proj surface
658 opState->mSkipInOrderDraw = true;
Chris Craik7c85c542015-08-19 15:10:24 -0700659 opState->mTransformFromCompositingAncestor = localTransformFromProjectionSurface;
John Reck272a6852015-07-29 16:48:58 -0700660 compositedChildrenOfProjectionSurface->push_back(opState);
John Reck113e0822014-03-18 09:22:59 -0700661 } else {
662 // standard in order draw
663 opState->mSkipInOrderDraw = false;
664 }
665
Chris Craikb36af872015-10-16 14:23:12 -0700666 if (mDisplayList->getChildren().size() > 0) {
Chris Craik003cc3d2015-10-16 10:24:55 -0700667 const bool isProjectionReceiver = mDisplayList->projectionReceiveIndex >= 0;
John Reck113e0822014-03-18 09:22:59 -0700668 bool haveAppliedPropertiesToProjection = false;
Chris Craikb36af872015-10-16 14:23:12 -0700669 for (unsigned int i = 0; i < mDisplayList->getChildren().size(); i++) {
670 DrawRenderNodeOp* childOp = mDisplayList->getChildren()[i];
Chris Craikb565df12015-10-05 13:00:52 -0700671 RenderNode* child = childOp->renderNode;
John Reck113e0822014-03-18 09:22:59 -0700672
John Reck272a6852015-07-29 16:48:58 -0700673 std::vector<DrawRenderNodeOp*>* projectionChildren = nullptr;
Chris Craikd41c4d82015-01-05 15:51:13 -0800674 const mat4* projectionTransform = nullptr;
John Reckd0a0b2a2014-03-20 16:28:56 -0700675 if (isProjectionReceiver && !child->properties().getProjectBackwards()) {
Chris Craikbf72eb82015-06-08 11:30:44 -0700676 // if receiving projections, collect projecting descendant
John Reck113e0822014-03-18 09:22:59 -0700677
Chris Craikbf72eb82015-06-08 11:30:44 -0700678 // Note that if a direct descendant is projecting backwards, we pass its
679 // grandparent projection collection, since it shouldn't project onto its
John Reck113e0822014-03-18 09:22:59 -0700680 // parent, where it will already be drawing.
681 projectionChildren = &mProjectedNodes;
682 projectionTransform = &mat4::identity();
683 } else {
684 if (!haveAppliedPropertiesToProjection) {
685 applyViewPropertyTransforms(localTransformFromProjectionSurface);
686 haveAppliedPropertiesToProjection = true;
687 }
688 projectionChildren = compositedChildrenOfProjectionSurface;
689 projectionTransform = &localTransformFromProjectionSurface;
690 }
Derek Sollenbergerf2932592015-08-13 14:59:33 -0400691 child->computeOrderingImpl(childOp, projectionChildren, projectionTransform);
John Reck113e0822014-03-18 09:22:59 -0700692 }
693 }
Chris Craikb565df12015-10-05 13:00:52 -0700694#endif
John Reck113e0822014-03-18 09:22:59 -0700695}
696
697class DeferOperationHandler {
698public:
699 DeferOperationHandler(DeferStateStruct& deferStruct, int level)
700 : mDeferStruct(deferStruct), mLevel(level) {}
701 inline void operator()(DisplayListOp* operation, int saveCount, bool clipToBounds) {
702 operation->defer(mDeferStruct, saveCount, mLevel, clipToBounds);
703 }
704 inline LinearAllocator& allocator() { return *(mDeferStruct.mAllocator); }
Andreas Gampe64bb4132014-11-22 00:35:09 +0000705 inline void startMark(const char* name) {} // do nothing
Chris Craikb265e2c2014-03-27 15:50:09 -0700706 inline void endMark() {}
707 inline int level() { return mLevel; }
708 inline int replayFlags() { return mDeferStruct.mReplayFlags; }
Chris Craik74669862014-08-07 17:27:30 -0700709 inline SkPath* allocPathForFrame() { return mDeferStruct.allocPathForFrame(); }
John Reck113e0822014-03-18 09:22:59 -0700710
711private:
712 DeferStateStruct& mDeferStruct;
713 const int mLevel;
714};
715
Chris Craik80d49022014-06-20 15:03:43 -0700716void RenderNode::defer(DeferStateStruct& deferStruct, const int level) {
John Reck113e0822014-03-18 09:22:59 -0700717 DeferOperationHandler handler(deferStruct, level);
Chris Craikb265e2c2014-03-27 15:50:09 -0700718 issueOperations<DeferOperationHandler>(deferStruct.mRenderer, handler);
John Reck113e0822014-03-18 09:22:59 -0700719}
720
721class ReplayOperationHandler {
722public:
723 ReplayOperationHandler(ReplayStateStruct& replayStruct, int level)
724 : mReplayStruct(replayStruct), mLevel(level) {}
725 inline void operator()(DisplayListOp* operation, int saveCount, bool clipToBounds) {
726#if DEBUG_DISPLAY_LIST_OPS_AS_EVENTS
Chris Craik3f0854292014-04-15 16:18:08 -0700727 mReplayStruct.mRenderer.eventMark(operation->name());
John Reck113e0822014-03-18 09:22:59 -0700728#endif
729 operation->replay(mReplayStruct, saveCount, mLevel, clipToBounds);
730 }
731 inline LinearAllocator& allocator() { return *(mReplayStruct.mAllocator); }
Chris Craikb265e2c2014-03-27 15:50:09 -0700732 inline void startMark(const char* name) {
733 mReplayStruct.mRenderer.startMark(name);
734 }
735 inline void endMark() {
736 mReplayStruct.mRenderer.endMark();
Chris Craikb265e2c2014-03-27 15:50:09 -0700737 }
738 inline int level() { return mLevel; }
739 inline int replayFlags() { return mReplayStruct.mReplayFlags; }
Chris Craik74669862014-08-07 17:27:30 -0700740 inline SkPath* allocPathForFrame() { return mReplayStruct.allocPathForFrame(); }
John Reck113e0822014-03-18 09:22:59 -0700741
742private:
743 ReplayStateStruct& mReplayStruct;
744 const int mLevel;
745};
746
Chris Craik80d49022014-06-20 15:03:43 -0700747void RenderNode::replay(ReplayStateStruct& replayStruct, const int level) {
John Reck113e0822014-03-18 09:22:59 -0700748 ReplayOperationHandler handler(replayStruct, level);
Chris Craikb265e2c2014-03-27 15:50:09 -0700749 issueOperations<ReplayOperationHandler>(replayStruct.mRenderer, handler);
John Reck113e0822014-03-18 09:22:59 -0700750}
751
Chris Craik003cc3d2015-10-16 10:24:55 -0700752void RenderNode::buildZSortedChildList(const DisplayList::Chunk& chunk,
John Reck272a6852015-07-29 16:48:58 -0700753 std::vector<ZDrawRenderNodeOpPair>& zTranslatedNodes) {
Chris Craikb565df12015-10-05 13:00:52 -0700754#if !HWUI_NEW_OPS
Chris Craik8afd0f22014-08-21 17:41:57 -0700755 if (chunk.beginChildIndex == chunk.endChildIndex) return;
John Reck113e0822014-03-18 09:22:59 -0700756
Chris Craik8afd0f22014-08-21 17:41:57 -0700757 for (unsigned int i = chunk.beginChildIndex; i < chunk.endChildIndex; i++) {
Chris Craikb36af872015-10-16 14:23:12 -0700758 DrawRenderNodeOp* childOp = mDisplayList->getChildren()[i];
Chris Craikb565df12015-10-05 13:00:52 -0700759 RenderNode* child = childOp->renderNode;
Chris Craikcc39e162014-04-25 18:34:11 -0700760 float childZ = child->properties().getZ();
John Reck113e0822014-03-18 09:22:59 -0700761
Chris Craik8afd0f22014-08-21 17:41:57 -0700762 if (!MathUtils::isZero(childZ) && chunk.reorderChildren) {
John Reck272a6852015-07-29 16:48:58 -0700763 zTranslatedNodes.push_back(ZDrawRenderNodeOpPair(childZ, childOp));
John Reck113e0822014-03-18 09:22:59 -0700764 childOp->mSkipInOrderDraw = true;
John Reckd0a0b2a2014-03-20 16:28:56 -0700765 } else if (!child->properties().getProjectBackwards()) {
John Reck113e0822014-03-18 09:22:59 -0700766 // regular, in order drawing DisplayList
767 childOp->mSkipInOrderDraw = false;
768 }
769 }
770
Chris Craik8afd0f22014-08-21 17:41:57 -0700771 // Z sort any 3d children (stable-ness makes z compare fall back to standard drawing order)
John Reck113e0822014-03-18 09:22:59 -0700772 std::stable_sort(zTranslatedNodes.begin(), zTranslatedNodes.end());
Chris Craikb565df12015-10-05 13:00:52 -0700773#endif
John Reck113e0822014-03-18 09:22:59 -0700774}
775
Chris Craikb265e2c2014-03-27 15:50:09 -0700776template <class T>
777void RenderNode::issueDrawShadowOperation(const Matrix4& transformFromParent, T& handler) {
Chris Craik77b5cad2014-07-30 18:23:07 -0700778 if (properties().getAlpha() <= 0.0f
779 || properties().getOutline().getAlpha() <= 0.0f
Teng-Hui Zhu8d0ec382015-10-01 16:49:16 -0700780 || !properties().getOutline().getPath()
781 || properties().getScaleX() == 0
782 || properties().getScaleY() == 0) {
Chris Craik77b5cad2014-07-30 18:23:07 -0700783 // no shadow to draw
784 return;
785 }
Chris Craikb265e2c2014-03-27 15:50:09 -0700786
787 mat4 shadowMatrixXY(transformFromParent);
788 applyViewPropertyTransforms(shadowMatrixXY);
789
790 // Z matrix needs actual 3d transformation, so mapped z values will be correct
791 mat4 shadowMatrixZ(transformFromParent);
792 applyViewPropertyTransforms(shadowMatrixZ, true);
793
Chris Craik74669862014-08-07 17:27:30 -0700794 const SkPath* casterOutlinePath = properties().getOutline().getPath();
Chris Craikaf4d04c2014-07-29 12:50:14 -0700795 const SkPath* revealClipPath = properties().getRevealClip().getPath();
Chris Craik61317322014-05-21 13:03:52 -0700796 if (revealClipPath && revealClipPath->isEmpty()) return;
797
Chris Craik77b5cad2014-07-30 18:23:07 -0700798 float casterAlpha = properties().getAlpha() * properties().getOutline().getAlpha();
Chris Craik74669862014-08-07 17:27:30 -0700799
Chris Craik74669862014-08-07 17:27:30 -0700800
Chris Craikfaa79ff2014-12-01 13:44:21 -0800801 // holds temporary SkPath to store the result of intersections
Chris Craikd41c4d82015-01-05 15:51:13 -0800802 SkPath* frameAllocatedPath = nullptr;
Chris Craikfaa79ff2014-12-01 13:44:21 -0800803 const SkPath* outlinePath = casterOutlinePath;
804
805 // intersect the outline with the reveal clip, if present
806 if (revealClipPath) {
807 frameAllocatedPath = handler.allocPathForFrame();
808
Tom Hudson02a26302015-06-24 11:32:42 -0400809 Op(*outlinePath, *revealClipPath, kIntersect_SkPathOp, frameAllocatedPath);
Chris Craikfaa79ff2014-12-01 13:44:21 -0800810 outlinePath = frameAllocatedPath;
811 }
812
813 // intersect the outline with the clipBounds, if present
814 if (properties().getClippingFlags() & CLIP_TO_CLIP_BOUNDS) {
815 if (!frameAllocatedPath) {
816 frameAllocatedPath = handler.allocPathForFrame();
817 }
818
819 Rect clipBounds;
820 properties().getClippingRectForFlags(CLIP_TO_CLIP_BOUNDS, &clipBounds);
821 SkPath clipBoundsPath;
822 clipBoundsPath.addRect(clipBounds.left, clipBounds.top,
823 clipBounds.right, clipBounds.bottom);
824
Tom Hudson02a26302015-06-24 11:32:42 -0400825 Op(*outlinePath, clipBoundsPath, kIntersect_SkPathOp, frameAllocatedPath);
Chris Craik74669862014-08-07 17:27:30 -0700826 outlinePath = frameAllocatedPath;
827 }
828
Chris Craikb265e2c2014-03-27 15:50:09 -0700829 DisplayListOp* shadowOp = new (handler.allocator()) DrawShadowOp(
Chris Craik74669862014-08-07 17:27:30 -0700830 shadowMatrixXY, shadowMatrixZ, casterAlpha, outlinePath);
Chris Craikb265e2c2014-03-27 15:50:09 -0700831 handler(shadowOp, PROPERTY_SAVECOUNT, properties().getClipToBounds());
832}
833
John Reck113e0822014-03-18 09:22:59 -0700834#define SHADOW_DELTA 0.1f
835
836template <class T>
Chris Craikc3e75f92014-08-27 15:34:52 -0700837void RenderNode::issueOperationsOf3dChildren(ChildrenSelectMode mode,
John Reck272a6852015-07-29 16:48:58 -0700838 const Matrix4& initialTransform, const std::vector<ZDrawRenderNodeOpPair>& zTranslatedNodes,
Chris Craikc3e75f92014-08-27 15:34:52 -0700839 OpenGLRenderer& renderer, T& handler) {
John Reck113e0822014-03-18 09:22:59 -0700840 const int size = zTranslatedNodes.size();
841 if (size == 0
Chris Craikb9ce116d2015-08-20 15:14:06 -0700842 || (mode == ChildrenSelectMode::NegativeZChildren && zTranslatedNodes[0].key > 0.0f)
843 || (mode == ChildrenSelectMode::PositiveZChildren && zTranslatedNodes[size - 1].key < 0.0f)) {
John Reck113e0822014-03-18 09:22:59 -0700844 // no 3d children to draw
845 return;
846 }
847
Chris Craikc3e75f92014-08-27 15:34:52 -0700848 // Apply the base transform of the parent of the 3d children. This isolates
849 // 3d children of the current chunk from transformations made in previous chunks.
850 int rootRestoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag);
Chris Craik6daa13c2015-08-19 13:32:12 -0700851 renderer.setGlobalMatrix(initialTransform);
Chris Craikc3e75f92014-08-27 15:34:52 -0700852
John Reck113e0822014-03-18 09:22:59 -0700853 /**
854 * Draw shadows and (potential) casters mostly in order, but allow the shadows of casters
855 * with very similar Z heights to draw together.
856 *
857 * This way, if Views A & B have the same Z height and are both casting shadows, the shadows are
858 * underneath both, and neither's shadow is drawn on top of the other.
859 */
860 const size_t nonNegativeIndex = findNonNegativeIndex(zTranslatedNodes);
861 size_t drawIndex, shadowIndex, endIndex;
Chris Craikb9ce116d2015-08-20 15:14:06 -0700862 if (mode == ChildrenSelectMode::NegativeZChildren) {
John Reck113e0822014-03-18 09:22:59 -0700863 drawIndex = 0;
864 endIndex = nonNegativeIndex;
865 shadowIndex = endIndex; // draw no shadows
866 } else {
867 drawIndex = nonNegativeIndex;
868 endIndex = size;
869 shadowIndex = drawIndex; // potentially draw shadow for each pos Z child
870 }
Chris Craik3f0854292014-04-15 16:18:08 -0700871
872 DISPLAY_LIST_LOGD("%*s%d %s 3d children:", (handler.level() + 1) * 2, "",
873 endIndex - drawIndex, mode == kNegativeZChildren ? "negative" : "positive");
874
John Reck113e0822014-03-18 09:22:59 -0700875 float lastCasterZ = 0.0f;
876 while (shadowIndex < endIndex || drawIndex < endIndex) {
877 if (shadowIndex < endIndex) {
Chris Craika7090e02014-06-20 16:01:00 -0700878 DrawRenderNodeOp* casterOp = zTranslatedNodes[shadowIndex].value;
Chris Craikb565df12015-10-05 13:00:52 -0700879 RenderNode* caster = casterOp->renderNode;
John Reck113e0822014-03-18 09:22:59 -0700880 const float casterZ = zTranslatedNodes[shadowIndex].key;
881 // attempt to render the shadow if the caster about to be drawn is its caster,
882 // OR if its caster's Z value is similar to the previous potential caster
883 if (shadowIndex == drawIndex || casterZ - lastCasterZ < SHADOW_DELTA) {
Chris Craikb265e2c2014-03-27 15:50:09 -0700884 caster->issueDrawShadowOperation(casterOp->mTransformFromParent, handler);
John Reck113e0822014-03-18 09:22:59 -0700885
886 lastCasterZ = casterZ; // must do this even if current caster not casting a shadow
887 shadowIndex++;
888 continue;
889 }
890 }
891
892 // only the actual child DL draw needs to be in save/restore,
893 // since it modifies the renderer's matrix
894 int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag);
895
Chris Craika7090e02014-06-20 16:01:00 -0700896 DrawRenderNodeOp* childOp = zTranslatedNodes[drawIndex].value;
John Reck113e0822014-03-18 09:22:59 -0700897
898 renderer.concatMatrix(childOp->mTransformFromParent);
899 childOp->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone
John Reckd0a0b2a2014-03-20 16:28:56 -0700900 handler(childOp, renderer.getSaveCount() - 1, properties().getClipToBounds());
John Reck113e0822014-03-18 09:22:59 -0700901 childOp->mSkipInOrderDraw = true;
902
903 renderer.restoreToCount(restoreTo);
904 drawIndex++;
905 }
Chris Craikc3e75f92014-08-27 15:34:52 -0700906 renderer.restoreToCount(rootRestoreTo);
John Reck113e0822014-03-18 09:22:59 -0700907}
908
909template <class T>
Chris Craikb265e2c2014-03-27 15:50:09 -0700910void RenderNode::issueOperationsOfProjectedChildren(OpenGLRenderer& renderer, T& handler) {
Chris Craik3f0854292014-04-15 16:18:08 -0700911 DISPLAY_LIST_LOGD("%*s%d projected children:", (handler.level() + 1) * 2, "", mProjectedNodes.size());
912 const SkPath* projectionReceiverOutline = properties().getOutline().getPath();
Chris Craik3f0854292014-04-15 16:18:08 -0700913 int restoreTo = renderer.getSaveCount();
914
Chris Craikb3cca872014-08-08 18:42:51 -0700915 LinearAllocator& alloc = handler.allocator();
916 handler(new (alloc) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag),
917 PROPERTY_SAVECOUNT, properties().getClipToBounds());
918
919 // Transform renderer to match background we're projecting onto
920 // (by offsetting canvas by translationX/Y of background rendernode, since only those are set)
921 const DisplayListOp* op =
Chris Craik10ed6922015-10-15 10:55:15 -0700922#if HWUI_NEW_OPS
923 nullptr;
924 LOG_ALWAYS_FATAL("unsupported");
925#else
Chris Craik003cc3d2015-10-16 10:24:55 -0700926 (mDisplayList->getOps()[mDisplayList->projectionReceiveIndex]);
Chris Craik10ed6922015-10-15 10:55:15 -0700927#endif
Chris Craikb3cca872014-08-08 18:42:51 -0700928 const DrawRenderNodeOp* backgroundOp = reinterpret_cast<const DrawRenderNodeOp*>(op);
Chris Craikb565df12015-10-05 13:00:52 -0700929 const RenderProperties& backgroundProps = backgroundOp->renderNode->properties();
Chris Craikb3cca872014-08-08 18:42:51 -0700930 renderer.translate(backgroundProps.getTranslationX(), backgroundProps.getTranslationY());
931
Chris Craik6fe991e52015-10-20 09:39:42 -0700932 // If the projection receiver has an outline, we mask projected content to it
Chris Craikfca52b752015-04-28 11:45:59 -0700933 // (which we know, apriori, are all tessellated paths)
934 renderer.setProjectionPathMask(alloc, projectionReceiverOutline);
Chris Craik3f0854292014-04-15 16:18:08 -0700935
936 // draw projected nodes
John Reck113e0822014-03-18 09:22:59 -0700937 for (size_t i = 0; i < mProjectedNodes.size(); i++) {
Chris Craika7090e02014-06-20 16:01:00 -0700938 DrawRenderNodeOp* childOp = mProjectedNodes[i];
John Reck113e0822014-03-18 09:22:59 -0700939
940 // matrix save, concat, and restore can be done safely without allocating operations
941 int restoreTo = renderer.save(SkCanvas::kMatrix_SaveFlag);
942 renderer.concatMatrix(childOp->mTransformFromCompositingAncestor);
943 childOp->mSkipInOrderDraw = false; // this is horrible, I'm so sorry everyone
John Reckd0a0b2a2014-03-20 16:28:56 -0700944 handler(childOp, renderer.getSaveCount() - 1, properties().getClipToBounds());
John Reck113e0822014-03-18 09:22:59 -0700945 childOp->mSkipInOrderDraw = true;
946 renderer.restoreToCount(restoreTo);
947 }
Chris Craik3f0854292014-04-15 16:18:08 -0700948
Chris Craikfca52b752015-04-28 11:45:59 -0700949 handler(new (alloc) RestoreToCountOp(restoreTo),
950 PROPERTY_SAVECOUNT, properties().getClipToBounds());
John Reck113e0822014-03-18 09:22:59 -0700951}
952
953/**
954 * This function serves both defer and replay modes, and will organize the displayList's component
955 * operations for a single frame:
956 *
957 * Every 'simple' state operation that affects just the matrix and alpha (or other factors of
958 * DeferredDisplayState) may be issued directly to the renderer, but complex operations (with custom
959 * defer logic) and operations in displayListOps are issued through the 'handler' which handles the
960 * defer vs replay logic, per operation
961 */
962template <class T>
Chris Craikb265e2c2014-03-27 15:50:09 -0700963void RenderNode::issueOperations(OpenGLRenderer& renderer, T& handler) {
Chris Craik003cc3d2015-10-16 10:24:55 -0700964 if (mDisplayList->isEmpty()) {
Chris Craikbf72eb82015-06-08 11:30:44 -0700965 DISPLAY_LIST_LOGD("%*sEmpty display list (%p, %s)", handler.level() * 2, "",
966 this, getName());
Chris Craik06451282014-07-21 10:25:54 -0700967 return;
968 }
969
Chris Craik51d6a3d2014-12-22 17:16:56 -0800970 const bool drawLayer = (mLayer && (&renderer != mLayer->renderer.get()));
John Reck25fbb3f2014-06-12 13:46:45 -0700971 // If we are updating the contents of mLayer, we don't want to apply any of
972 // the RenderNode's properties to this issueOperations pass. Those will all
973 // be applied when the layer is drawn, aka when this is true.
974 const bool useViewProperties = (!mLayer || drawLayer);
Chris Craik06451282014-07-21 10:25:54 -0700975 if (useViewProperties) {
976 const Outline& outline = properties().getOutline();
Teng-Hui Zhu8d0ec382015-10-01 16:49:16 -0700977 if (properties().getAlpha() <= 0
978 || (outline.getShouldClip() && outline.isEmpty())
979 || properties().getScaleX() == 0
980 || properties().getScaleY() == 0) {
Chris Craikbf72eb82015-06-08 11:30:44 -0700981 DISPLAY_LIST_LOGD("%*sRejected display list (%p, %s)", handler.level() * 2, "",
982 this, getName());
Chris Craik06451282014-07-21 10:25:54 -0700983 return;
984 }
John Reck113e0822014-03-18 09:22:59 -0700985 }
986
Chris Craik3f0854292014-04-15 16:18:08 -0700987 handler.startMark(getName());
Chris Craikb265e2c2014-03-27 15:50:09 -0700988
John Reck113e0822014-03-18 09:22:59 -0700989#if DEBUG_DISPLAY_LIST
Chris Craik3f0854292014-04-15 16:18:08 -0700990 const Rect& clipRect = renderer.getLocalClipBounds();
991 DISPLAY_LIST_LOGD("%*sStart display list (%p, %s), localClipBounds: %.0f, %.0f, %.0f, %.0f",
Chris Craik03188872015-02-02 18:39:33 -0800992 handler.level() * 2, "", this, getName(),
Chris Craik3f0854292014-04-15 16:18:08 -0700993 clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
John Reck113e0822014-03-18 09:22:59 -0700994#endif
995
996 LinearAllocator& alloc = handler.allocator();
997 int restoreTo = renderer.getSaveCount();
998 handler(new (alloc) SaveOp(SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag),
John Reckd0a0b2a2014-03-20 16:28:56 -0700999 PROPERTY_SAVECOUNT, properties().getClipToBounds());
John Reck113e0822014-03-18 09:22:59 -07001000
Chris Craikbf72eb82015-06-08 11:30:44 -07001001 DISPLAY_LIST_LOGD("%*sSave %d %d", (handler.level() + 1) * 2, "",
John Reck113e0822014-03-18 09:22:59 -07001002 SkCanvas::kMatrix_SaveFlag | SkCanvas::kClip_SaveFlag, restoreTo);
1003
John Reck25fbb3f2014-06-12 13:46:45 -07001004 if (useViewProperties) {
1005 setViewProperties<T>(renderer, handler);
1006 }
John Reck113e0822014-03-18 09:22:59 -07001007
Chris Craik10ed6922015-10-15 10:55:15 -07001008#if HWUI_NEW_OPS
1009 LOG_ALWAYS_FATAL("legacy op traversal not supported");
1010#else
Chris Craik8c271ca2014-03-25 10:33:01 -07001011 bool quickRejected = properties().getClipToBounds()
1012 && renderer.quickRejectConservative(0, 0, properties().getWidth(), properties().getHeight());
John Reck113e0822014-03-18 09:22:59 -07001013 if (!quickRejected) {
Chris Craikc3e75f92014-08-27 15:34:52 -07001014 Matrix4 initialTransform(*(renderer.currentTransform()));
Tom Hudsonac7b6d32015-06-30 11:26:13 -04001015 renderer.setBaseTransform(initialTransform);
Chris Craikc3e75f92014-08-27 15:34:52 -07001016
John Reck25fbb3f2014-06-12 13:46:45 -07001017 if (drawLayer) {
Chris Craik3aadd602015-08-20 12:41:40 -07001018 handler(new (alloc) DrawLayerOp(mLayer),
John Reck25fbb3f2014-06-12 13:46:45 -07001019 renderer.getSaveCount() - 1, properties().getClipToBounds());
1020 } else {
Chris Craikc166b6c2014-09-05 19:55:30 -07001021 const int saveCountOffset = renderer.getSaveCount() - 1;
Chris Craik003cc3d2015-10-16 10:24:55 -07001022 const int projectionReceiveIndex = mDisplayList->projectionReceiveIndex;
1023 for (size_t chunkIndex = 0; chunkIndex < mDisplayList->getChunks().size(); chunkIndex++) {
1024 const DisplayList::Chunk& chunk = mDisplayList->getChunks()[chunkIndex];
John Reck113e0822014-03-18 09:22:59 -07001025
John Reck272a6852015-07-29 16:48:58 -07001026 std::vector<ZDrawRenderNodeOpPair> zTranslatedNodes;
Chris Craik8afd0f22014-08-21 17:41:57 -07001027 buildZSortedChildList(chunk, zTranslatedNodes);
1028
Chris Craikb9ce116d2015-08-20 15:14:06 -07001029 issueOperationsOf3dChildren(ChildrenSelectMode::NegativeZChildren,
Chris Craikc3e75f92014-08-27 15:34:52 -07001030 initialTransform, zTranslatedNodes, renderer, handler);
1031
Andreas Gampeedaecc12014-11-10 20:54:07 -08001032 for (size_t opIndex = chunk.beginOpIndex; opIndex < chunk.endOpIndex; opIndex++) {
Chris Craik003cc3d2015-10-16 10:24:55 -07001033 DisplayListOp *op = mDisplayList->getOps()[opIndex];
Chris Craik80d49022014-06-20 15:03:43 -07001034#if DEBUG_DISPLAY_LIST
Chris Craik03188872015-02-02 18:39:33 -08001035 op->output(handler.level() + 1);
Chris Craik80d49022014-06-20 15:03:43 -07001036#endif
Chris Craik8afd0f22014-08-21 17:41:57 -07001037 handler(op, saveCountOffset, properties().getClipToBounds());
John Reck113e0822014-03-18 09:22:59 -07001038
John Reck272a6852015-07-29 16:48:58 -07001039 if (CC_UNLIKELY(!mProjectedNodes.empty() && projectionReceiveIndex >= 0 &&
Andreas Gampeedaecc12014-11-10 20:54:07 -08001040 opIndex == static_cast<size_t>(projectionReceiveIndex))) {
Chris Craik8afd0f22014-08-21 17:41:57 -07001041 issueOperationsOfProjectedChildren(renderer, handler);
1042 }
John Reck25fbb3f2014-06-12 13:46:45 -07001043 }
John Reck113e0822014-03-18 09:22:59 -07001044
Chris Craikb9ce116d2015-08-20 15:14:06 -07001045 issueOperationsOf3dChildren(ChildrenSelectMode::PositiveZChildren,
Chris Craikc3e75f92014-08-27 15:34:52 -07001046 initialTransform, zTranslatedNodes, renderer, handler);
Chris Craik8afd0f22014-08-21 17:41:57 -07001047 }
John Reck25fbb3f2014-06-12 13:46:45 -07001048 }
John Reck113e0822014-03-18 09:22:59 -07001049 }
Chris Craik10ed6922015-10-15 10:55:15 -07001050#endif
John Reck113e0822014-03-18 09:22:59 -07001051
Chris Craikbf72eb82015-06-08 11:30:44 -07001052 DISPLAY_LIST_LOGD("%*sRestoreToCount %d", (handler.level() + 1) * 2, "", restoreTo);
John Reck113e0822014-03-18 09:22:59 -07001053 handler(new (alloc) RestoreToCountOp(restoreTo),
John Reckd0a0b2a2014-03-20 16:28:56 -07001054 PROPERTY_SAVECOUNT, properties().getClipToBounds());
Chris Craikb265e2c2014-03-27 15:50:09 -07001055
Chris Craikbf72eb82015-06-08 11:30:44 -07001056 DISPLAY_LIST_LOGD("%*sDone (%p, %s)", handler.level() * 2, "", this, getName());
Chris Craikb265e2c2014-03-27 15:50:09 -07001057 handler.endMark();
John Reck113e0822014-03-18 09:22:59 -07001058}
1059
1060} /* namespace uirenderer */
1061} /* namespace android */