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 #include "RenderNode.h"
18
19 #include "DamageAccumulator.h"
20 #include "Debug.h"
21 #include "Properties.h"
22 #include "TreeInfo.h"
23 #include "VectorDrawable.h"
24 #include "private/hwui/WebViewFunctor.h"
25 #ifdef __ANDROID__
26 #include "renderthread/CanvasContext.h"
27 #else
28 #include "DamageAccumulator.h"
29 #include "pipeline/skia/SkiaDisplayList.h"
30 #endif
31 #include <gui/TraceUtils.h>
32 #include "utils/MathUtils.h"
33 #include "utils/StringUtils.h"
34
35 #include <SkPathOps.h>
36 #include <algorithm>
37 #include <atomic>
38 #include <sstream>
39 #include <string>
40 #include <ui/FatVector.h>
41
42 namespace android {
43 namespace uirenderer {
44
45 // Used for tree mutations that are purely destructive.
46 // Generic tree mutations should use MarkAndSweepObserver instead
47 class ImmediateRemoved : public TreeObserver {
48 public:
ImmediateRemoved(TreeInfo * info)49 explicit ImmediateRemoved(TreeInfo* info) : mTreeInfo(info) {}
50
onMaybeRemovedFromTree(RenderNode * node)51 void onMaybeRemovedFromTree(RenderNode* node) override { node->onRemovedFromTree(mTreeInfo); }
52
53 private:
54 TreeInfo* mTreeInfo;
55 };
56
generateId()57 static int64_t generateId() {
58 static std::atomic<int64_t> sNextId{1};
59 return sNextId++;
60 }
61
RenderNode()62 RenderNode::RenderNode()
63 : mUniqueId(generateId())
64 , mDirtyPropertyFields(0)
65 , mNeedsDisplayListSync(false)
66 , mDisplayList(nullptr)
67 , mStagingDisplayList(nullptr)
68 , mAnimatorManager(*this)
69 , mParentCount(0) {}
70
~RenderNode()71 RenderNode::~RenderNode() {
72 ImmediateRemoved observer(nullptr);
73 deleteDisplayList(observer);
74 LOG_ALWAYS_FATAL_IF(hasLayer(), "layer missed detachment!");
75 }
76
setStagingDisplayList(DisplayList && newData)77 void RenderNode::setStagingDisplayList(DisplayList&& newData) {
78 mValid = newData.isValid();
79 mNeedsDisplayListSync = true;
80 mStagingDisplayList = std::move(newData);
81 }
82
discardStagingDisplayList()83 void RenderNode::discardStagingDisplayList() {
84 setStagingDisplayList(DisplayList());
85 }
86
87 /**
88 * This function is a simplified version of replay(), where we simply retrieve and log the
89 * display list. This function should remain in sync with the replay() function.
90 */
output()91 void RenderNode::output() {
92 LogcatStream strout;
93 strout << "Root";
94 output(strout, 0);
95 }
96
output(std::ostream & output,uint32_t level)97 void RenderNode::output(std::ostream& output, uint32_t level) {
98 output << " (" << getName() << " " << this
99 << (MathUtils::isZero(properties().getAlpha()) ? ", zero alpha" : "")
100 << (properties().hasShadow() ? ", casting shadow" : "")
101 << (isRenderable() ? "" : ", empty")
102 << (properties().getProjectBackwards() ? ", projected" : "")
103 << (hasLayer() ? ", on HW Layer" : "") << ")" << std::endl;
104
105 properties().debugOutputProperties(output, level + 1);
106
107 mDisplayList.output(output, level);
108 output << std::string(level * 2, ' ') << "/RenderNode(" << getName() << " " << this << ")";
109 output << std::endl;
110 }
111
getUsageSize()112 int RenderNode::getUsageSize() {
113 int size = sizeof(RenderNode);
114 size += mStagingDisplayList.getUsedSize();
115 size += mDisplayList.getUsedSize();
116 return size;
117 }
118
getAllocatedSize()119 int RenderNode::getAllocatedSize() {
120 int size = sizeof(RenderNode);
121 size += mStagingDisplayList.getAllocatedSize();
122 size += mDisplayList.getAllocatedSize();
123 return size;
124 }
125
126
prepareTree(TreeInfo & info)127 void RenderNode::prepareTree(TreeInfo& info) {
128 ATRACE_CALL();
129 LOG_ALWAYS_FATAL_IF(!info.damageAccumulator, "DamageAccumulator missing");
130 MarkAndSweepRemoved observer(&info);
131
132 const int before = info.disableForceDark;
133 prepareTreeImpl(observer, info, false);
134 LOG_ALWAYS_FATAL_IF(before != info.disableForceDark, "Mis-matched force dark");
135 }
136
addAnimator(const sp<BaseRenderNodeAnimator> & animator)137 void RenderNode::addAnimator(const sp<BaseRenderNodeAnimator>& animator) {
138 mAnimatorManager.addAnimator(animator);
139 }
140
removeAnimator(const sp<BaseRenderNodeAnimator> & animator)141 void RenderNode::removeAnimator(const sp<BaseRenderNodeAnimator>& animator) {
142 mAnimatorManager.removeAnimator(animator);
143 }
144
damageSelf(TreeInfo & info)145 void RenderNode::damageSelf(TreeInfo& info) {
146 if (isRenderable()) {
147 mDamageGenerationId = info.damageGenerationId;
148 if (properties().getClipDamageToBounds()) {
149 info.damageAccumulator->dirty(0, 0, properties().getWidth(), properties().getHeight());
150 } else {
151 // Hope this is big enough?
152 // TODO: Get this from the display list ops or something
153 info.damageAccumulator->dirty(DIRTY_MIN, DIRTY_MIN, DIRTY_MAX, DIRTY_MAX);
154 }
155 }
156 }
157
prepareLayer(TreeInfo & info,uint32_t dirtyMask)158 void RenderNode::prepareLayer(TreeInfo& info, uint32_t dirtyMask) {
159 LayerType layerType = properties().effectiveLayerType();
160 if (CC_UNLIKELY(layerType == LayerType::RenderLayer)) {
161 // Damage applied so far needs to affect our parent, but does not require
162 // the layer to be updated. So we pop/push here to clear out the current
163 // damage and get a clean state for display list or children updates to
164 // affect, which will require the layer to be updated
165 info.damageAccumulator->popTransform();
166 info.damageAccumulator->pushTransform(this);
167 if (dirtyMask & DISPLAY_LIST) {
168 damageSelf(info);
169 }
170 }
171 }
172
pushLayerUpdate(TreeInfo & info)173 void RenderNode::pushLayerUpdate(TreeInfo& info) {
174 #ifdef __ANDROID__ // Layoutlib does not support CanvasContext and Layers
175 LayerType layerType = properties().effectiveLayerType();
176 // If we are not a layer OR we cannot be rendered (eg, view was detached)
177 // we need to destroy any Layers we may have had previously
178 if (CC_LIKELY(layerType != LayerType::RenderLayer) || CC_UNLIKELY(!isRenderable()) ||
179 CC_UNLIKELY(properties().getWidth() == 0) || CC_UNLIKELY(properties().getHeight() == 0) ||
180 CC_UNLIKELY(!properties().fitsOnLayer())) {
181 if (CC_UNLIKELY(hasLayer())) {
182 this->setLayerSurface(nullptr);
183 }
184 return;
185 }
186
187 if (info.canvasContext.createOrUpdateLayer(this, *info.damageAccumulator, info.errorHandler)) {
188 damageSelf(info);
189 }
190
191 if (!hasLayer()) {
192 return;
193 }
194
195 SkRect dirty;
196 info.damageAccumulator->peekAtDirty(&dirty);
197 info.layerUpdateQueue->enqueueLayerWithDamage(this, dirty);
198 if (!dirty.isEmpty()) {
199 mStretchMask.markDirty();
200 }
201
202 // There might be prefetched layers that need to be accounted for.
203 // That might be us, so tell CanvasContext that this layer is in the
204 // tree and should not be destroyed.
205 info.canvasContext.markLayerInUse(this);
206 #endif
207 }
208
209 /**
210 * Traverse down the the draw tree to prepare for a frame.
211 *
212 * MODE_FULL = UI Thread-driven (thus properties must be synced), otherwise RT driven
213 *
214 * While traversing down the tree, functorsNeedLayer flag is set to true if anything that uses the
215 * stencil buffer may be needed. Views that use a functor to draw will be forced onto a layer.
216 */
prepareTreeImpl(TreeObserver & observer,TreeInfo & info,bool functorsNeedLayer)217 void RenderNode::prepareTreeImpl(TreeObserver& observer, TreeInfo& info, bool functorsNeedLayer) {
218 if (mDamageGenerationId == info.damageGenerationId) {
219 // We hit the same node a second time in the same tree. We don't know the minimal
220 // damage rect anymore, so just push the biggest we can onto our parent's transform
221 // We push directly onto parent in case we are clipped to bounds but have moved position.
222 info.damageAccumulator->dirty(DIRTY_MIN, DIRTY_MIN, DIRTY_MAX, DIRTY_MAX);
223 }
224 info.damageAccumulator->pushTransform(this);
225
226 if (info.mode == TreeInfo::MODE_FULL) {
227 pushStagingPropertiesChanges(info);
228 }
229
230 if (!mProperties.getAllowForceDark()) {
231 info.disableForceDark++;
232 }
233 if (!mProperties.layerProperties().getStretchEffect().isEmpty()) {
234 info.stretchEffectCount++;
235 }
236
237 uint32_t animatorDirtyMask = 0;
238 if (CC_LIKELY(info.runAnimations)) {
239 animatorDirtyMask = mAnimatorManager.animate(info);
240 }
241
242 bool willHaveFunctor = false;
243 if (info.mode == TreeInfo::MODE_FULL && mStagingDisplayList) {
244 willHaveFunctor = mStagingDisplayList.hasFunctor();
245 } else if (mDisplayList) {
246 willHaveFunctor = mDisplayList.hasFunctor();
247 }
248 bool childFunctorsNeedLayer =
249 mProperties.prepareForFunctorPresence(willHaveFunctor, functorsNeedLayer);
250
251 if (CC_UNLIKELY(mPositionListener.get())) {
252 mPositionListener->onPositionUpdated(*this, info);
253 }
254
255 prepareLayer(info, animatorDirtyMask);
256 if (info.mode == TreeInfo::MODE_FULL) {
257 pushStagingDisplayListChanges(observer, info);
258 }
259
260 if (mDisplayList) {
261 info.out.hasFunctors |= mDisplayList.hasFunctor();
262 mHasHolePunches = mDisplayList.hasHolePunches();
263 bool isDirty = mDisplayList.prepareListAndChildren(
264 observer, info, childFunctorsNeedLayer,
265 [this](RenderNode* child, TreeObserver& observer, TreeInfo& info,
266 bool functorsNeedLayer) {
267 child->prepareTreeImpl(observer, info, functorsNeedLayer);
268 mHasHolePunches |= child->hasHolePunches();
269 });
270 if (isDirty) {
271 damageSelf(info);
272 }
273 } else {
274 mHasHolePunches = false;
275 }
276 pushLayerUpdate(info);
277
278 if (!mProperties.getAllowForceDark()) {
279 info.disableForceDark--;
280 }
281 if (!mProperties.layerProperties().getStretchEffect().isEmpty()) {
282 info.stretchEffectCount--;
283 }
284 info.damageAccumulator->popTransform();
285 }
286
syncProperties()287 void RenderNode::syncProperties() {
288 mProperties = mStagingProperties;
289 }
290
pushStagingPropertiesChanges(TreeInfo & info)291 void RenderNode::pushStagingPropertiesChanges(TreeInfo& info) {
292 if (mPositionListenerDirty) {
293 mPositionListener = std::move(mStagingPositionListener);
294 mStagingPositionListener = nullptr;
295 mPositionListenerDirty = false;
296 }
297
298 // Push the animators first so that setupStartValueIfNecessary() is called
299 // before properties() is trampled by stagingProperties(), as they are
300 // required by some animators.
301 if (CC_LIKELY(info.runAnimations)) {
302 mAnimatorManager.pushStaging();
303 }
304 if (mDirtyPropertyFields) {
305 mDirtyPropertyFields = 0;
306 damageSelf(info);
307 info.damageAccumulator->popTransform();
308 syncProperties();
309
310 auto& layerProperties = mProperties.layerProperties();
311 const StretchEffect& stagingStretch = layerProperties.getStretchEffect();
312 if (stagingStretch.isEmpty()) {
313 mStretchMask.clear();
314 }
315
316 if (layerProperties.getImageFilter() == nullptr) {
317 mSnapshotResult.snapshot = nullptr;
318 mTargetImageFilter = nullptr;
319 }
320
321 // We could try to be clever and only re-damage if the matrix changed.
322 // However, we don't need to worry about that. The cost of over-damaging
323 // here is only going to be a single additional map rect of this node
324 // plus a rect join(). The parent's transform (and up) will only be
325 // performed once.
326 info.damageAccumulator->pushTransform(this);
327 damageSelf(info);
328 }
329 }
330
updateSnapshotIfRequired(GrRecordingContext * context,const SkImageFilter * imageFilter,const SkIRect & clipBounds)331 std::optional<RenderNode::SnapshotResult> RenderNode::updateSnapshotIfRequired(
332 GrRecordingContext* context,
333 const SkImageFilter* imageFilter,
334 const SkIRect& clipBounds
335 ) {
336 auto* layerSurface = getLayerSurface();
337 if (layerSurface == nullptr) {
338 return std::nullopt;
339 }
340
341 sk_sp<SkImage> snapshot = layerSurface->makeImageSnapshot();
342 const auto subset = SkIRect::MakeWH(properties().getWidth(),
343 properties().getHeight());
344 uint32_t layerSurfaceGenerationId = layerSurface->generationID();
345 // If we don't have an ImageFilter just return the snapshot
346 if (imageFilter == nullptr) {
347 mSnapshotResult.snapshot = snapshot;
348 mSnapshotResult.outSubset = subset;
349 mSnapshotResult.outOffset = SkIPoint::Make(0.0f, 0.0f);
350 mImageFilterClipBounds = clipBounds;
351 mTargetImageFilter = nullptr;
352 mTargetImageFilterLayerSurfaceGenerationId = 0;
353 } else if (mSnapshotResult.snapshot == nullptr || imageFilter != mTargetImageFilter.get() ||
354 mImageFilterClipBounds != clipBounds ||
355 mTargetImageFilterLayerSurfaceGenerationId != layerSurfaceGenerationId) {
356 // Otherwise create a new snapshot with the given filter and snapshot
357 mSnapshotResult.snapshot =
358 snapshot->makeWithFilter(context,
359 imageFilter,
360 subset,
361 clipBounds,
362 &mSnapshotResult.outSubset,
363 &mSnapshotResult.outOffset);
364 mTargetImageFilter = sk_ref_sp(imageFilter);
365 mImageFilterClipBounds = clipBounds;
366 mTargetImageFilterLayerSurfaceGenerationId = layerSurfaceGenerationId;
367 }
368
369 return mSnapshotResult;
370 }
371
syncDisplayList(TreeObserver & observer,TreeInfo * info)372 void RenderNode::syncDisplayList(TreeObserver& observer, TreeInfo* info) {
373 // Make sure we inc first so that we don't fluctuate between 0 and 1,
374 // which would thrash the layer cache
375 if (mStagingDisplayList) {
376 mStagingDisplayList.updateChildren([](RenderNode* child) { child->incParentRefCount(); });
377 }
378 deleteDisplayList(observer, info);
379 mDisplayList = std::move(mStagingDisplayList);
380 if (mDisplayList) {
381 WebViewSyncData syncData {
382 .applyForceDark = info && !info->disableForceDark
383 };
384 mDisplayList.syncContents(syncData);
385 handleForceDark(info);
386 }
387 }
388
handleForceDark(android::uirenderer::TreeInfo * info)389 void RenderNode::handleForceDark(android::uirenderer::TreeInfo *info) {
390 if (CC_LIKELY(!info || info->disableForceDark)) {
391 return;
392 }
393 auto usage = usageHint();
394 FatVector<RenderNode*, 6> children;
395 mDisplayList.updateChildren([&children](RenderNode* node) {
396 children.push_back(node);
397 });
398 if (mDisplayList.hasText()) {
399 usage = UsageHint::Foreground;
400 }
401 if (usage == UsageHint::Unknown) {
402 if (children.size() > 1) {
403 usage = UsageHint::Background;
404 } else if (children.size() == 1 &&
405 children.front()->usageHint() !=
406 UsageHint::Background) {
407 usage = UsageHint::Background;
408 }
409 }
410 if (children.size() > 1) {
411 // Crude overlap check
412 SkRect drawn = SkRect::MakeEmpty();
413 for (auto iter = children.rbegin(); iter != children.rend(); ++iter) {
414 const auto& child = *iter;
415 // We use stagingProperties here because we haven't yet sync'd the children
416 SkRect bounds = SkRect::MakeXYWH(child->stagingProperties().getX(), child->stagingProperties().getY(),
417 child->stagingProperties().getWidth(), child->stagingProperties().getHeight());
418 if (bounds.contains(drawn)) {
419 // This contains everything drawn after it, so make it a background
420 child->setUsageHint(UsageHint::Background);
421 }
422 drawn.join(bounds);
423 }
424 }
425 mDisplayList.applyColorTransform(
426 usage == UsageHint::Background ? ColorTransform::Dark : ColorTransform::Light);
427 }
428
pushStagingDisplayListChanges(TreeObserver & observer,TreeInfo & info)429 void RenderNode::pushStagingDisplayListChanges(TreeObserver& observer, TreeInfo& info) {
430 if (mNeedsDisplayListSync) {
431 mNeedsDisplayListSync = false;
432 // Damage with the old display list first then the new one to catch any
433 // changes in isRenderable or, in the future, bounds
434 damageSelf(info);
435 syncDisplayList(observer, &info);
436 damageSelf(info);
437 }
438 }
439
deleteDisplayList(TreeObserver & observer,TreeInfo * info)440 void RenderNode::deleteDisplayList(TreeObserver& observer, TreeInfo* info) {
441 if (mDisplayList) {
442 mDisplayList.updateChildren(
443 [&observer, info](RenderNode* child) { child->decParentRefCount(observer, info); });
444 mDisplayList.clear(this);
445 }
446 }
447
destroyHardwareResources(TreeInfo * info)448 void RenderNode::destroyHardwareResources(TreeInfo* info) {
449 if (hasLayer()) {
450 this->setLayerSurface(nullptr);
451 }
452 discardStagingDisplayList();
453
454 ImmediateRemoved observer(info);
455 deleteDisplayList(observer, info);
456 }
457
destroyLayers()458 void RenderNode::destroyLayers() {
459 if (hasLayer()) {
460 this->setLayerSurface(nullptr);
461 }
462
463 if (mDisplayList) {
464 mDisplayList.updateChildren([](RenderNode* child) { child->destroyLayers(); });
465 }
466 }
467
decParentRefCount(TreeObserver & observer,TreeInfo * info)468 void RenderNode::decParentRefCount(TreeObserver& observer, TreeInfo* info) {
469 LOG_ALWAYS_FATAL_IF(!mParentCount, "already 0!");
470 mParentCount--;
471 if (!mParentCount) {
472 observer.onMaybeRemovedFromTree(this);
473 if (CC_UNLIKELY(mPositionListener.get())) {
474 mPositionListener->onPositionLost(*this, info);
475 }
476 }
477 }
478
onRemovedFromTree(TreeInfo * info)479 void RenderNode::onRemovedFromTree(TreeInfo* info) {
480 if (Properties::enableWebViewOverlays && mDisplayList) {
481 mDisplayList.onRemovedFromTree();
482 }
483 destroyHardwareResources(info);
484 }
485
clearRoot()486 void RenderNode::clearRoot() {
487 ImmediateRemoved observer(nullptr);
488 decParentRefCount(observer);
489 }
490
491 /**
492 * Apply property-based transformations to input matrix
493 *
494 * If true3dTransform is set to true, the transform applied to the input matrix will use true 4x4
495 * matrix computation instead of the Skia 3x3 matrix + camera hackery.
496 */
applyViewPropertyTransforms(mat4 & matrix,bool true3dTransform) const497 void RenderNode::applyViewPropertyTransforms(mat4& matrix, bool true3dTransform) const {
498 if (properties().getLeft() != 0 || properties().getTop() != 0) {
499 matrix.translate(properties().getLeft(), properties().getTop());
500 }
501 if (properties().getStaticMatrix()) {
502 mat4 stat(*properties().getStaticMatrix());
503 matrix.multiply(stat);
504 } else if (properties().getAnimationMatrix()) {
505 mat4 anim(*properties().getAnimationMatrix());
506 matrix.multiply(anim);
507 }
508
509 bool applyTranslationZ = true3dTransform && !MathUtils::isZero(properties().getZ());
510 if (properties().hasTransformMatrix() || applyTranslationZ) {
511 if (properties().isTransformTranslateOnly()) {
512 matrix.translate(properties().getTranslationX(), properties().getTranslationY(),
513 true3dTransform ? properties().getZ() : 0.0f);
514 } else {
515 if (!true3dTransform) {
516 matrix.multiply(*properties().getTransformMatrix());
517 } else {
518 mat4 true3dMat;
519 true3dMat.loadTranslate(properties().getPivotX() + properties().getTranslationX(),
520 properties().getPivotY() + properties().getTranslationY(),
521 properties().getZ());
522 true3dMat.rotate(properties().getRotationX(), 1, 0, 0);
523 true3dMat.rotate(properties().getRotationY(), 0, 1, 0);
524 true3dMat.rotate(properties().getRotation(), 0, 0, 1);
525 true3dMat.scale(properties().getScaleX(), properties().getScaleY(), 1);
526 true3dMat.translate(-properties().getPivotX(), -properties().getPivotY());
527
528 matrix.multiply(true3dMat);
529 }
530 }
531 }
532
533 if (Properties::getStretchEffectBehavior() == StretchEffectBehavior::UniformScale) {
534 const StretchEffect& stretch = properties().layerProperties().getStretchEffect();
535 if (!stretch.isEmpty()) {
536 matrix.multiply(
537 stretch.makeLinearStretch(properties().getWidth(), properties().getHeight()));
538 }
539 }
540 }
541
getClippedOutline(const SkRect & clipRect) const542 const SkPath* RenderNode::getClippedOutline(const SkRect& clipRect) const {
543 const SkPath* outlinePath = properties().getOutline().getPath();
544 const uint32_t outlineID = outlinePath->getGenerationID();
545
546 if (outlineID != mClippedOutlineCache.outlineID || clipRect != mClippedOutlineCache.clipRect) {
547 // update the cache keys
548 mClippedOutlineCache.outlineID = outlineID;
549 mClippedOutlineCache.clipRect = clipRect;
550
551 // update the cache value by recomputing a new path
552 SkPath clipPath;
553 clipPath.addRect(clipRect);
554 Op(*outlinePath, clipPath, kIntersect_SkPathOp, &mClippedOutlineCache.clippedOutline);
555 }
556 return &mClippedOutlineCache.clippedOutline;
557 }
558
559 using StringBuffer = FatVector<char, 128>;
560
561 template <typename... T>
562 // TODO:__printflike(2, 3)
563 // Doesn't work because the warning doesn't understand string_view and doesn't like that
564 // it's not a C-style variadic function.
format(StringBuffer & buffer,const std::string_view & format,T...args)565 static void format(StringBuffer& buffer, const std::string_view& format, T... args) {
566 buffer.resize(buffer.capacity());
567 while (1) {
568 int needed = snprintf(buffer.data(), buffer.size(),
569 format.data(), std::forward<T>(args)...);
570 if (needed < 0) {
571 buffer[0] = '\0';
572 buffer.resize(1);
573 return;
574 }
575 if (needed < buffer.size()) {
576 buffer.resize(needed + 1);
577 return;
578 }
579 // If we're doing a heap alloc anyway might as well give it some slop
580 buffer.resize(needed + 100);
581 }
582 }
583
markDrawStart(SkCanvas & canvas)584 void RenderNode::markDrawStart(SkCanvas& canvas) {
585 StringBuffer buffer;
586 format(buffer, "RenderNode(id=%" PRId64 ", name='%s')", uniqueId(), getName());
587 canvas.drawAnnotation(SkRect::MakeWH(getWidth(), getHeight()), buffer.data(), nullptr);
588 }
589
markDrawEnd(SkCanvas & canvas)590 void RenderNode::markDrawEnd(SkCanvas& canvas) {
591 StringBuffer buffer;
592 format(buffer, "/RenderNode(id=%" PRId64 ", name='%s')", uniqueId(), getName());
593 canvas.drawAnnotation(SkRect::MakeWH(getWidth(), getHeight()), buffer.data(), nullptr);
594 }
595
596 } /* namespace uirenderer */
597 } /* namespace android */
598