Bug 380071 - add cairo_clip_extents() functionality to thebes. r=vlad
authortor@cs.brown.edu
Tue, 22 May 2007 12:30:03 -0700
changeset 1706 cbb58de344ae6ef9e10956d0c5d86958f05fe620
parent 1705 72721b0343a2af239fdfb2e599158029ee6a0da1
child 1707 c58a44c875f8249101eb61a3727cc9ec0fe45ae0
push idunknown
push userunknown
push dateunknown
reviewersvlad
bugs380071
milestone1.9a5pre
Bug 380071 - add cairo_clip_extents() functionality to thebes. r=vlad
gfx/thebes/public/gfxContext.h
gfx/thebes/src/gfxContext.cpp
--- 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);
 }