本文整理汇总了C++中LayerMetricsWrapper::GetParent方法的典型用法代码示例。如果您正苦于以下问题:C++ LayerMetricsWrapper::GetParent方法的具体用法?C++ LayerMetricsWrapper::GetParent怎么用?C++ LayerMetricsWrapper::GetParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LayerMetricsWrapper
的用法示例。
在下文中一共展示了LayerMetricsWrapper::GetParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static gfx::Matrix4x4
GetTransformToAncestorsParentLayer(Layer* aStart, const LayerMetricsWrapper& aAncestor)
{
gfx::Matrix4x4 transform;
const LayerMetricsWrapper& ancestorParent = aAncestor.GetParent();
for (LayerMetricsWrapper iter(aStart, LayerMetricsWrapper::StartAt::BOTTOM);
ancestorParent ? iter != ancestorParent : iter.IsValid();
iter = iter.GetParent()) {
transform = transform * iter.GetTransform();
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
// When scrolling containers, layout adds a post-scale into the transform
// of the displayport-ancestor (which we pick up in GetTransform() above)
// to cancel out the pres shell resolution (for historical reasons). The
// compositor in turn cancels out this post-scale (i.e., scales by the
// pres shell resolution), and to get correct calculations, we need to do
// so here, too.
//
// With containerless scrolling, the offending post-scale is on the
// parent layer of the displayport-ancestor, which we don't reach in this
// loop, so we don't need to worry about it.
const FrameMetrics& metrics = iter.Metrics();
transform.PostScale(metrics.GetPresShellResolution(), metrics.GetPresShellResolution(), 1.f);
}
}
return transform;
}
示例2:
static gfx::Matrix4x4
GetTransformToAncestorsParentLayer(Layer* aStart, const LayerMetricsWrapper& aAncestor)
{
gfx::Matrix4x4 transform;
const LayerMetricsWrapper& ancestorParent = aAncestor.GetParent();
for (LayerMetricsWrapper iter(aStart, LayerMetricsWrapper::StartAt::BOTTOM);
ancestorParent ? iter != ancestorParent : iter.IsValid();
iter = iter.GetParent()) {
transform = transform * iter.GetTransform();
// If the layer has a non-transient async transform then we need to apply it here
// because it will get applied by the APZ in the compositor as well
const FrameMetrics& metrics = iter.Metrics();
transform.PostScale(metrics.mPresShellResolution, metrics.mPresShellResolution, 1.f);
}
return transform;
}