Bug 1042327. Use a more narrow workaround for pixman bug. r=jrmuizel

--HG--
extra : rebase_source : 4631ea06598c681a5729e225d4e2f495fbb2622b
This commit is contained in:
Robert O'Callahan 2014-07-24 00:02:04 +12:00
Родитель dd83ee7f1e
Коммит 5694ddab1c
1 изменённых файлов: 10 добавлений и 13 удалений

Просмотреть файл

@ -103,7 +103,15 @@ public:
}
nsRegion& And(const nsRegion& aRegion, const nsRect& aRect)
{
pixman_region32_intersect_rect(&mImpl, aRegion.Impl(), aRect.x, aRect.y, aRect.width, aRect.height);
// pixman has a bug where it doesn't validate the input to intersect_rect
// and can end up with regions with empty rects, so take the more round about route
// if we're passing in an empty rect.
if (aRect.IsEmpty()) {
SetEmpty();
} else {
pixman_region32_intersect_rect(&mImpl, aRegion.Impl(),
aRect.x, aRect.y, aRect.width, aRect.height);
}
return *this;
}
nsRegion& And(const nsRect& aRect1, const nsRect& aRect2)
@ -262,13 +270,7 @@ public:
{
return pixman_region32_equal(Impl(), aRegion.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;
}
uint32_t GetNumRects () const { return pixman_region32_n_rects(Impl()); }
const nsRect GetBounds () const { return BoxToRect(mImpl.extents); }
uint64_t Area () const;
// Converts this region from aFromAPP, an appunits per pixel ratio, to
@ -409,11 +411,6 @@ 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 ()