本文整理汇总了C++中ShadowLayer::GetShadowTransform方法的典型用法代码示例。如果您正苦于以下问题:C++ ShadowLayer::GetShadowTransform方法的具体用法?C++ ShadowLayer::GetShadowTransform怎么用?C++ ShadowLayer::GetShadowTransform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShadowLayer
的用法示例。
在下文中一共展示了ShadowLayer::GetShadowTransform方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: contentVis
static void
BuildBackgroundPatternFor(ContainerLayer* aContainer,
ContainerLayer* aShadowRoot,
const ViewConfig& aConfig,
const gfxRGBA& aColor,
LayerManager* aManager,
nsIFrame* aFrame)
{
ShadowLayer* shadowRoot = aShadowRoot->AsShadowLayer();
gfxMatrix t;
if (!shadowRoot->GetShadowTransform().Is2D(&t)) {
return;
}
// Get the rect bounding the shadow content, transformed into the
// same space as |aFrame|
nsIntRect contentBounds = shadowRoot->GetShadowVisibleRegion().GetBounds();
gfxRect contentVis(contentBounds.x, contentBounds.y,
contentBounds.width, contentBounds.height);
gfxRect localContentVis(t.Transform(contentVis));
// Round *in* here because this area is punched out of the background
localContentVis.RoundIn();
nsIntRect localIntContentVis(localContentVis.X(), localContentVis.Y(),
localContentVis.Width(), localContentVis.Height());
// Get the frame's rect
nscoord auPerDevPixel = aFrame->PresContext()->AppUnitsPerDevPixel();
nsIntRect frameRect = aFrame->GetRect().ToOutsidePixels(auPerDevPixel);
// If the shadow tree covers the frame rect, don't bother building
// the background, it wouldn't be visible
if (localIntContentVis.Contains(frameRect)) {
return;
}
nsRefPtr<ColorLayer> layer = aManager->CreateColorLayer();
layer->SetColor(aColor);
// The visible area of the background is the frame's area minus the
// content area
nsIntRegion bgRgn(frameRect);
bgRgn.Sub(bgRgn, localIntContentVis);
bgRgn.MoveBy(-frameRect.TopLeft());
layer->SetVisibleRegion(bgRgn);
aContainer->InsertAfter(layer, nullptr);
}