mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 1238438 (part 3) - Inline both PathFromRegionInternal() functions. r=nical.
They both have a single call site, so aren't worth being in separate functions. --HG-- extra : rebase_source : 09961affe0902cfd44448b75445438d9900a0942
This commit is contained in:
parent
c58fca74ef
commit
23b425f2f7
@ -801,8 +801,8 @@ gfxUtils::ImageFormatToDepth(gfxImageFormat aFormat)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
/*static*/ void
|
||||||
PathFromRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion)
|
gfxUtils::ClipToRegion(gfxContext* aContext, const nsIntRegion& aRegion)
|
||||||
{
|
{
|
||||||
aContext->NewPath();
|
aContext->NewPath();
|
||||||
nsIntRegionRectIterator iter(aRegion);
|
nsIntRegionRectIterator iter(aRegion);
|
||||||
@ -810,29 +810,6 @@ PathFromRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion)
|
|||||||
while ((r = iter.Next()) != nullptr) {
|
while ((r = iter.Next()) != nullptr) {
|
||||||
aContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height));
|
aContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static already_AddRefed<Path>
|
|
||||||
PathFromRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion)
|
|
||||||
{
|
|
||||||
RefPtr<PathBuilder> pb = aTarget->CreatePathBuilder();
|
|
||||||
nsIntRegionRectIterator iter(aRegion);
|
|
||||||
|
|
||||||
const IntRect* r;
|
|
||||||
while ((r = iter.Next()) != nullptr) {
|
|
||||||
pb->MoveTo(Point(r->x, r->y));
|
|
||||||
pb->LineTo(Point(r->XMost(), r->y));
|
|
||||||
pb->LineTo(Point(r->XMost(), r->YMost()));
|
|
||||||
pb->LineTo(Point(r->x, r->YMost()));
|
|
||||||
pb->Close();
|
|
||||||
}
|
|
||||||
return pb->Finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*static*/ void
|
|
||||||
gfxUtils::ClipToRegion(gfxContext* aContext, const nsIntRegion& aRegion)
|
|
||||||
{
|
|
||||||
PathFromRegionInternal(aContext, aRegion);
|
|
||||||
aContext->Clip();
|
aContext->Clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -845,7 +822,19 @@ gfxUtils::ClipToRegion(DrawTarget* aTarget, const nsIntRegion& aRegion)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<Path> path = PathFromRegionInternal(aTarget, aRegion);
|
RefPtr<PathBuilder> pb = aTarget->CreatePathBuilder();
|
||||||
|
nsIntRegionRectIterator iter(aRegion);
|
||||||
|
|
||||||
|
const IntRect* r;
|
||||||
|
while ((r = iter.Next()) != nullptr) {
|
||||||
|
pb->MoveTo(Point(r->x, r->y));
|
||||||
|
pb->LineTo(Point(r->XMost(), r->y));
|
||||||
|
pb->LineTo(Point(r->XMost(), r->YMost()));
|
||||||
|
pb->LineTo(Point(r->x, r->YMost()));
|
||||||
|
pb->Close();
|
||||||
|
}
|
||||||
|
RefPtr<Path> path = pb->Finish();
|
||||||
|
|
||||||
aTarget->PushClip(path);
|
aTarget->PushClip(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user