зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1042327. Use a more narrow workaround for pixman bug. r=jrmuizel
--HG-- extra : rebase_source : 4631ea06598c681a5729e225d4e2f495fbb2622b
This commit is contained in:
Родитель
dd83ee7f1e
Коммит
5694ddab1c
|
@ -103,7 +103,15 @@ public:
|
||||||
}
|
}
|
||||||
nsRegion& And(const nsRegion& aRegion, const nsRect& aRect)
|
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;
|
return *this;
|
||||||
}
|
}
|
||||||
nsRegion& And(const nsRect& aRect1, const nsRect& aRect2)
|
nsRegion& And(const nsRect& aRect1, const nsRect& aRect2)
|
||||||
|
@ -262,13 +270,7 @@ public:
|
||||||
{
|
{
|
||||||
return pixman_region32_equal(Impl(), aRegion.Impl());
|
return pixman_region32_equal(Impl(), aRegion.Impl());
|
||||||
}
|
}
|
||||||
uint32_t GetNumRects () const
|
uint32_t GetNumRects () const { return pixman_region32_n_rects(Impl()); }
|
||||||
{
|
|
||||||
// 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); }
|
const nsRect GetBounds () const { return BoxToRect(mImpl.extents); }
|
||||||
uint64_t Area () const;
|
uint64_t Area () const;
|
||||||
// Converts this region from aFromAPP, an appunits per pixel ratio, to
|
// Converts this region from aFromAPP, an appunits per pixel ratio, to
|
||||||
|
@ -409,11 +411,6 @@ public:
|
||||||
mRegion = &aRegion;
|
mRegion = &aRegion;
|
||||||
i = 0;
|
i = 0;
|
||||||
boxes = pixman_region32_rectangles(aRegion.Impl(), &n);
|
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 ()
|
const nsRect* Next ()
|
||||||
|
|
Загрузка…
Ссылка в новой задаче