зеркало из https://github.com/mozilla/pjs.git
Bug 675837 - Add gfxContext::ClipContainsRect. r=roc
This commit is contained in:
Родитель
72dd10803c
Коммит
40b785ca36
|
@ -696,6 +696,29 @@ gfxContext::GetClipExtents()
|
||||||
return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
|
return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PRBool
|
||||||
|
gfxContext::ClipContainsRect(const gfxRect& aRect)
|
||||||
|
{
|
||||||
|
cairo_rectangle_list_t *clip =
|
||||||
|
cairo_copy_clip_rectangle_list(mCairo);
|
||||||
|
|
||||||
|
PRBool result = PR_FALSE;
|
||||||
|
|
||||||
|
if (clip->status == CAIRO_STATUS_SUCCESS) {
|
||||||
|
for (int i = 0; i < clip->num_rectangles; i++) {
|
||||||
|
gfxRect rect(clip->rectangles[i].x, clip->rectangles[i].y,
|
||||||
|
clip->rectangles[i].width, clip->rectangles[i].height);
|
||||||
|
if (rect.Contains(aRect)) {
|
||||||
|
result = PR_TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cairo_rectangle_list_destroy(clip);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
// rendering sources
|
// rendering sources
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -605,6 +605,13 @@ public:
|
||||||
*/
|
*/
|
||||||
gfxRect GetClipExtents();
|
gfxRect GetClipExtents();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if the given rectangle is fully contained in the current clip.
|
||||||
|
* This is conservative; it may return false even when the given rectangle is
|
||||||
|
* fully contained by the current clip.
|
||||||
|
*/
|
||||||
|
PRBool ClipContainsRect(const gfxRect& aRect);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Groups
|
* Groups
|
||||||
*/
|
*/
|
||||||
|
|
Загрузка…
Ссылка в новой задаче