mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 675837 - Add gfxContext::ClipContainsRect. r=roc
This commit is contained in:
parent
5e32aaf40c
commit
3df75d69f2
@ -696,6 +696,29 @@ gfxContext::GetClipExtents()
|
||||
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
|
||||
|
||||
void
|
||||
|
@ -605,6 +605,13 @@ public:
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user