本文整理汇总了C++中nsRegion::IsEmpty方法的典型用法代码示例。如果您正苦于以下问题:C++ nsRegion::IsEmpty方法的具体用法?C++ nsRegion::IsEmpty怎么用?C++ nsRegion::IsEmpty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsRegion
的用法示例。
在下文中一共展示了nsRegion::IsEmpty方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ComputeDistanceFromRect
static float
ComputeDistanceFromRegion(const nsPoint& aPoint, const nsRegion& aRegion)
{
MOZ_ASSERT(!aRegion.IsEmpty(), "can't compute distance between point and empty region");
float minDist = -1;
for (auto iter = aRegion.RectIter(); !iter.Done(); iter.Next()) {
float dist = ComputeDistanceFromRect(aPoint, iter.Get());
if (dist < minDist || minDist < 0) {
minDist = dist;
}
}
return minDist;
}
示例2:
// Subtract aRegion from aExposedRegion as long as that doesn't make the
// exposed region get too complex or removes a big chunk of the exposed region.
static void
SubtractFromExposedRegion(nsRegion* aExposedRegion, const nsRegion& aRegion)
{
if (aRegion.IsEmpty())
return;
nsRegion tmp;
tmp.Sub(*aExposedRegion, aRegion);
// Don't let *aExposedRegion get too complex, but don't let it fluff out to
// its bounds either. Do let aExposedRegion get more complex if by doing so
// we reduce its area by at least half.
if (tmp.GetNumRects() <= 15 || tmp.Area() <= aExposedRegion->Area()/2) {
*aExposedRegion = tmp;
}
}
示例3: iter
static float
ComputeDistanceFromRegion(const nsPoint& aPoint, const nsRegion& aRegion)
{
MOZ_ASSERT(!aRegion.IsEmpty(), "can't compute distance between point and empty region");
nsRegionRectIterator iter(aRegion);
const nsRect* r;
float minDist = -1;
while ((r = iter.Next()) != nullptr) {
float dist = ComputeDistanceFromRect(aPoint, *r);
if (dist < minDist || minDist < 0) {
minDist = dist;
}
}
return minDist;
}
示例4: nsRegion
nsRegion
nsFilterInstance::GetPostFilterDirtyArea(nsIFrame *aFilteredFrame,
const nsRegion& aPreFilterDirtyRegion)
{
if (aPreFilterDirtyRegion.IsEmpty()) {
return nsRegion();
}
nsFilterInstance instance(aFilteredFrame, nullptr, nullptr,
&aPreFilterDirtyRegion);
if (!instance.IsInitialized()) {
return nsRegion();
}
// We've passed in the source's dirty area so the instance knows about it.
// Now we can ask the instance to compute the area of the filter output
// that's dirty.
nsRegion dirtyRegion;
nsresult rv = instance.ComputePostFilterDirtyRegion(&dirtyRegion);
if (NS_SUCCEEDED(rv)) {
return dirtyRegion;
}
return nsRegion();
}