mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1022612. Part 46: Work around pixman bug to make sure nsRegionRectIterator never returns an empty rect. r=mattwoodrow
--HG-- extra : rebase_source : c88f571a6f791c4ead93fc41f6d2b731ec8813f6
This commit is contained in:
parent
6c2516f809
commit
5f35b82ac9
@ -489,8 +489,10 @@ struct RegionParamTraits
|
||||
static void Write(Message* msg, const paramType& param)
|
||||
{
|
||||
Iter it(param);
|
||||
while (const Rect* r = it.Next())
|
||||
while (const Rect* r = it.Next()) {
|
||||
MOZ_ASSERT(!r->IsEmpty());
|
||||
WriteParam(msg, *r);
|
||||
}
|
||||
// empty rects are sentinel values because nsRegions will never
|
||||
// contain them
|
||||
WriteParam(msg, Rect());
|
||||
|
@ -212,7 +212,13 @@ public:
|
||||
{
|
||||
return pixman_region32_equal(Impl(), aRegion.Impl());
|
||||
}
|
||||
uint32_t GetNumRects () const { return pixman_region32_n_rects(Impl()); }
|
||||
uint32_t GetNumRects () const
|
||||
{
|
||||
// Work around pixman bug. Sometimes pixman creates regions with 1 rect
|
||||
// that's empty.
|
||||
uint32_t result = pixman_region32_n_rects(Impl());
|
||||
return (result == 1 && GetBounds().IsEmpty()) ? 0 : result;
|
||||
}
|
||||
const nsRect GetBounds () const { return BoxToRect(mImpl.extents); }
|
||||
uint64_t Area () const;
|
||||
// Converts this region from aFromAPP, an appunits per pixel ratio, to
|
||||
@ -338,6 +344,11 @@ public:
|
||||
mRegion = &aRegion;
|
||||
i = 0;
|
||||
boxes = pixman_region32_rectangles(aRegion.Impl(), &n);
|
||||
// Work around pixman bug. Sometimes pixman creates regions with 1 rect
|
||||
// that's empty.
|
||||
if (n == 1 && nsRegion::BoxToRect(boxes[0]).IsEmpty()) {
|
||||
n = 0;
|
||||
}
|
||||
}
|
||||
|
||||
const nsRect* Next ()
|
||||
@ -345,6 +356,7 @@ public:
|
||||
if (i == n)
|
||||
return nullptr;
|
||||
rect = nsRegion::BoxToRect(boxes[i]);
|
||||
NS_ASSERTION(!rect.IsEmpty(), "Shouldn't return empty rect");
|
||||
i++;
|
||||
return ▭
|
||||
}
|
||||
@ -354,6 +366,7 @@ public:
|
||||
if (i == -1)
|
||||
return nullptr;
|
||||
rect = nsRegion::BoxToRect(boxes[i]);
|
||||
NS_ASSERTION(!rect.IsEmpty(), "Shouldn't return empty rect");
|
||||
i--;
|
||||
return ▭
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user