本文整理汇总了C++中nsRegion::RectIter方法的典型用法代码示例。如果您正苦于以下问题:C++ nsRegion::RectIter方法的具体用法?C++ nsRegion::RectIter怎么用?C++ nsRegion::RectIter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsRegion
的用法示例。
在下文中一共展示了nsRegion::RectIter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Contains
bool nsRegion::Contains(const nsRegion& aRgn) const
{
// XXX this could be made faster by iterating over
// both regions at the same time some how
for (auto iter = aRgn.RectIter(); !iter.Done(); iter.Next()) {
if (!Contains(iter.Get())) {
return false;
}
}
return true;
}
示例2: set
void set(nsRegion ®ion) {
clear();
for (auto iter = region.RectIter(); !iter.Done(); iter.Next()) {
const nsRect& r = iter.Get();
for (int y = r.y; y < r.YMost(); y++) {
for (int x = r.x; x < r.XMost(); x++) {
bitmap[x + y * width] = REGION_VALUE;
}
}
}
}
示例3: 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;
}
示例4: AppendToString
void
AppendToString(std::stringstream& aStream, const nsRegion& r,
const char* pfx, const char* sfx)
{
aStream << pfx;
aStream << "< ";
for (auto iter = r.RectIter(); !iter.Done(); iter.Next()) {
AppendToString(aStream, iter.Get());
aStream << "; ";
}
aStream << ">";
aStream << sfx;
}