зеркало из https://github.com/mozilla/pjs.git
Bug 627273, part 2: Add some gfx path helpers. sr=roc
This commit is contained in:
Родитель
b369718a40
Коммит
fe36562ab1
|
@ -434,9 +434,10 @@ gfxUtils::ImageFormatToDepth(gfxASurface::gfxImageFormat aFormat)
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
ClipToRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion,
|
PathFromRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion,
|
||||||
PRBool aSnap)
|
PRBool aSnap)
|
||||||
{
|
{
|
||||||
aContext->NewPath();
|
aContext->NewPath();
|
||||||
nsIntRegionRectIterator iter(aRegion);
|
nsIntRegionRectIterator iter(aRegion);
|
||||||
|
@ -444,6 +445,13 @@ ClipToRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion,
|
||||||
while ((r = iter.Next()) != nsnull) {
|
while ((r = iter.Next()) != nsnull) {
|
||||||
aContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height), aSnap);
|
aContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height), aSnap);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
ClipToRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion,
|
||||||
|
PRBool aSnap)
|
||||||
|
{
|
||||||
|
PathFromRegionInternal(aContext, aRegion, aSnap);
|
||||||
aContext->Clip();
|
aContext->Clip();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -459,6 +467,19 @@ gfxUtils::ClipToRegionSnapped(gfxContext* aContext, const nsIntRegion& aRegion)
|
||||||
ClipToRegionInternal(aContext, aRegion, PR_TRUE);
|
ClipToRegionInternal(aContext, aRegion, PR_TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*static*/ void
|
||||||
|
gfxUtils::PathFromRegion(gfxContext* aContext, const nsIntRegion& aRegion)
|
||||||
|
{
|
||||||
|
PathFromRegionInternal(aContext, aRegion, PR_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*static*/ void
|
||||||
|
gfxUtils::PathFromRegionSnapped(gfxContext* aContext, const nsIntRegion& aRegion)
|
||||||
|
{
|
||||||
|
PathFromRegionInternal(aContext, aRegion, PR_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
PRBool
|
PRBool
|
||||||
gfxUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut)
|
gfxUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut)
|
||||||
{
|
{
|
||||||
|
|
|
@ -96,6 +96,16 @@ public:
|
||||||
*/
|
*/
|
||||||
static void ClipToRegionSnapped(gfxContext* aContext, const nsIntRegion& aRegion);
|
static void ClipToRegionSnapped(gfxContext* aContext, const nsIntRegion& aRegion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a path consisting of rectangles in |aRegion|.
|
||||||
|
*/
|
||||||
|
static void PathFromRegion(gfxContext* aContext, const nsIntRegion& aRegion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create a path consisting of rectangles in |aRegion|, snapping the rectangles.
|
||||||
|
*/
|
||||||
|
static void PathFromRegionSnapped(gfxContext* aContext, const nsIntRegion& aRegion);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Convert image format to depth value
|
* Convert image format to depth value
|
||||||
*/
|
*/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче