本文整理汇总了C++中nsRect::Intersect方法的典型用法代码示例。如果您正苦于以下问题:C++ nsRect::Intersect方法的具体用法?C++ nsRect::Intersect怎么用?C++ nsRect::Intersect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsRect
的用法示例。
在下文中一共展示了nsRect::Intersect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetOpaqueRegion
virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
bool* aSnap) override {
*aSnap = false;
nsHTMLCanvasFrame* f = static_cast<nsHTMLCanvasFrame*>(Frame());
HTMLCanvasElement* canvas =
HTMLCanvasElement::FromContent(f->GetContent());
nsRegion result;
if (canvas->GetIsOpaque()) {
// OK, the entire region painted by the canvas is opaque. But what is
// that region? It's the canvas's "dest rect" (controlled by the
// object-fit/object-position CSS properties), clipped to the container's
// content box (which is what GetBounds() returns). So, we grab those
// rects and intersect them.
nsRect constraintRect = GetBounds(aBuilder, aSnap);
// Need intrinsic size & ratio, for ComputeObjectDestRect:
nsIntSize canvasSize = f->GetCanvasSize();
IntrinsicSize intrinsicSize = IntrinsicSizeFromCanvasSize(canvasSize);
nsSize intrinsicRatio = IntrinsicRatioFromCanvasSize(canvasSize);
const nsRect destRect =
nsLayoutUtils::ComputeObjectDestRect(constraintRect,
intrinsicSize, intrinsicRatio,
f->StylePosition());
return nsRegion(destRect.Intersect(constraintRect));
}
return result;
}
示例2:
nsRect
DisplayItemClip::ApplyNonRoundedIntersection(const nsRect& aRect) const
{
if (!mHaveClipRect) {
return aRect;
}
nsRect result = aRect.Intersect(mClipRect);
for (uint32_t i = 0, iEnd = mRoundedClipRects.Length();
i < iEnd; ++i) {
result = result.Intersect(mRoundedClipRects[i].mRect);
}
return result;
}
示例3:
void
nsSVGForeignObjectFrame::InvalidateDirtyRect(const nsRect& aRect,
PRUint32 aFlags,
bool aDuringReflowSVG)
{
if (aRect.IsEmpty())
return;
// Don't invalidate areas outside our bounds:
nsRect rect = aRect.Intersect(nsRect(nsPoint(0,0), mRect.Size()));
if (rect.IsEmpty())
return;
nsSVGUtils::InvalidateBounds(this, aDuringReflowSVG, &rect, aFlags);
}
示例4:
void
DisplayListClipState::ClipContentDescendants(const nsRect& aRect,
const nsRect& aRoundedRect,
const nscoord* aRadii,
DisplayItemClip& aClipOnStack)
{
if (aRadii) {
aClipOnStack.SetTo(aRect, aRoundedRect, aRadii);
} else {
nsRect intersect = aRect.Intersect(aRoundedRect);
aClipOnStack.SetTo(intersect);
}
if (mClipContentDescendants) {
aClipOnStack.IntersectWith(*mClipContentDescendants);
}
mClipContentDescendants = &aClipOnStack;
mCurrentCombinedClip = nullptr;
}
示例5: GetSize
void
nsRootBoxFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists)
{
if (mContent && mContent->GetProperty(nsGkAtoms::DisplayPortMargins)) {
// The XUL document's root element may have displayport margins set in
// ChromeProcessController::InitializeRoot, and we should to supply the
// base rect.
nsRect displayPortBase = aDirtyRect.Intersect(nsRect(nsPoint(0, 0), GetSize()));
nsLayoutUtils::SetDisplayPortBase(mContent, displayPortBase);
}
// root boxes don't need a debug border/outline or a selection overlay...
// They *may* have a background propagated to them, so force creation
// of a background display list element.
DisplayBorderBackgroundOutline(aBuilder, aLists, true);
BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
}
示例6: r
void
nsSVGForeignObjectFrame::InvalidateDirtyRect(nsSVGOuterSVGFrame* aOuter,
const nsRect& aRect, PRUint32 aFlags)
{
if (aRect.IsEmpty())
return;
// Don't invalidate areas outside our bounds:
nsRect rect = aRect.Intersect(mRect);
if (rect.IsEmpty())
return;
// The areas dirtied by children are in app units, relative to this frame.
// We need to convert the rect from app units in our userspace to app units
// relative to our nsSVGOuterSVGFrame's content rect.
gfxRect r(aRect.x, aRect.y, aRect.width, aRect.height);
r.Scale(1.0 / nsPresContext::AppUnitsPerCSSPixel());
rect = ToCanvasBounds(r, GetCanvasTM(), PresContext());
rect = nsSVGUtils::FindFilterInvalidation(this, rect);
aOuter->InvalidateWithFlags(rect, aFlags);
}