Bug 380071 - add cairo_clip_extents() functionality to thebes. r=vlad
--- a/gfx/thebes/public/gfxContext.h
+++ b/gfx/thebes/public/gfxContext.h
@@ -498,17 +498,22 @@ public:
*/
void Clip(const gfxRect& rect); // will clip to a rect
/**
* This will ensure that the surface actually has its clip set.
* Useful if you are doing native drawing.
*/
void UpdateSurfaceClip();
-
+
+ /**
+ * This will return the current bounds of the clip region.
+ */
+ gfxRect GetClipExtents();
+
/**
* Groups
*/
void PushGroup(gfxASurface::gfxContentType content = gfxASurface::CONTENT_COLOR);
already_AddRefed<gfxPattern> PopGroup();
void PopGroupToSource();
/**
--- a/gfx/thebes/src/gfxContext.cpp
+++ b/gfx/thebes/src/gfxContext.cpp
@@ -588,16 +588,24 @@ gfxContext::ResetClip()
void
gfxContext::UpdateSurfaceClip()
{
NewPath();
Rectangle(gfxRect(0,0,0,0));
Fill();
}
+gfxRect
+gfxContext::GetClipExtents()
+{
+ double xmin, ymin, xmax, ymax;
+ cairo_clip_extents(mCairo, &xmin, &ymin, &xmax, &ymax);
+ return gfxRect(xmin, ymin, xmax - xmin, ymax - ymin);
+}
+
// rendering sources
void
gfxContext::SetColor(const gfxRGBA& c)
{
cairo_set_source_rgba(mCairo, c.r, c.g, c.b, c.a);
}