From 0dba52ccbdc24e9f3eba9a2c258c52f4a4f0c32a Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 12 May 2011 12:52:51 +1000 Subject: Make rounded rectangle work on Cairo versions before 1.2. --- gtk/PlatGTK.cxx | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'gtk') diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 8359f4db9..c94847825 100644 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -1242,7 +1242,12 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl static void PathRoundRectangle(cairo_t *context, double left, double top, double width, double height, int radius) { double degrees = M_PI / 180.0; +#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0) cairo_new_sub_path(context); +#else + // First arc is in the top-right corner and starts from a point on the top line + cairo_move_to(context, left + width - radius, top); +#endif cairo_arc(context, left + width - radius, top + radius, radius, -90 * degrees, 0 * degrees); cairo_arc(context, left + width - radius, top + height - radius, radius, 0 * degrees, 90 * degrees); cairo_arc(context, left + radius, top + height - radius, radius, 90 * degrees, 180 * degrees); -- cgit v1.2.3