[GRASS-SVN] r35242 - grass/trunk/lib/cairodriver

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Jan 6 16:32:56 EST 2009


Author: glynn
Date: 2009-01-06 16:32:56 -0500 (Tue, 06 Jan 2009)
New Revision: 35242

Modified:
   grass/trunk/lib/cairodriver/Draw_bitmap.c
Log:
Workaround for lack of cairo_format_stride_for_width() prior to cairo 1.6



Modified: grass/trunk/lib/cairodriver/Draw_bitmap.c
===================================================================
--- grass/trunk/lib/cairodriver/Draw_bitmap.c	2009-01-06 17:01:19 UTC (rev 35241)
+++ grass/trunk/lib/cairodriver/Draw_bitmap.c	2009-01-06 21:32:56 UTC (rev 35242)
@@ -33,7 +33,12 @@
 
     G_debug(1, "Cairo_Bitmap: %d %d %d", ncols, nrows, threshold);
 
+#if CAIRO_VERSION_MAJOR > 1 || CAIRO_VERSION_MAJOR == 1 && CAIRO_VERSION_MINOR >= 6
     stride = cairo_format_stride_for_width(CAIRO_FORMAT_A8, ncols);
+#else
+#define MULTIPLE 4
+    stride = (ncols + (MULTIPLE - 1)) / MULTIPLE * MULTIPLE;
+#endif
     data = malloc(stride * nrows);
     surf = cairo_image_surface_create_for_data(
 	data, CAIRO_FORMAT_A8, ncols, nrows, stride);



More information about the grass-commit mailing list