Bug 950550. Restore the transform in DrawTargetCairo::PopClip. r=jrmuizel
--- a/gfx/2d/DrawTargetCairo.cpp
+++ b/gfx/2d/DrawTargetCairo.cpp
@@ -990,17 +990,28 @@ DrawTargetCairo::PushClipRect(const Rect
cairo_rectangle(mContext, aRect.X(), aRect.Y(), aRect.Width(), aRect.Height());
cairo_clip_preserve(mContext);
}
void
DrawTargetCairo::PopClip()
{
// save/restore does not affect the path, so no need to call WillChange()
+
+ // cairo_restore will restore the transform too and we don't want to do that
+ // so we'll save it now and restore it after the cairo_restore
+ cairo_matrix_t mat;
+ cairo_get_matrix(mContext, &mat);
+
cairo_restore(mContext);
+
+ cairo_set_matrix(mContext, &mat);
+
+ MOZ_ASSERT(GetTransform() == Matrix(mat.xx, mat.yx, mat.xy, mat.yy, mat.x0, mat.y0),
+ "Transforms are out of sync");
}
TemporaryRef<PathBuilder>
DrawTargetCairo::CreatePathBuilder(FillRule aFillRule /* = FILL_WINDING */) const
{
RefPtr<PathBuilderCairo> builder = new PathBuilderCairo(aFillRule);
return builder;