diff --git a/src/cairo.c b/src/cairo.c
index 5f26d6f..c462e42 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -530,6 +530,11 @@ cairo_push_group_with_content (cairo_t *cr, cairo_content_t content)
                                      parent_surface->device_transform.x0 - extents.x,
                                      parent_surface->device_transform.y0 - extents.y);
 
+    /* If we have a current path, we need to adjust it to compensate for
+     * the device offset just applied. */
+    _cairo_path_fixed_transform (cr->path,
+				 &group_surface->device_transform);
+
     /* create a new gstate for the redirect */
     cairo_save (cr);
     if (cr->status)
@@ -613,6 +618,11 @@ cairo_pop_group (cairo_t *cr)
 	cairo_pattern_set_matrix (group_pattern, &group_matrix);
     }
 
+    /* If we have a current path, we need to adjust it to compensate for
+     * the device offset just removed. */
+    _cairo_path_fixed_transform (cr->path,
+				 &group_surface->device_transform_inverse);
+
 done:
     cairo_surface_destroy (group_surface);
 
