[cairo-commit] 4 commits - build/configure.ac.system configure.ac src/cairo-skiplist.c util/cairo-script
Chris Wilson
ickle at kemper.freedesktop.org
Wed Nov 26 09:47:18 PST 2008
build/configure.ac.system | 2 +-
configure.ac | 5 ++++-
src/cairo-skiplist.c | 11 +++++++++++
util/cairo-script/Makefile.am | 4 ++--
util/cairo-script/cairo-script-file.c | 5 ++++-
util/cairo-script/cairo-script-operators.c | 2 ++
util/cairo-script/csi-replay.c | 8 ++++++++
7 files changed, 32 insertions(+), 5 deletions(-)
New commits:
commit 5591cb58fd94483ec3dc7c169ae8cf0a6b7841bd
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Nov 26 17:43:22 2008 +0000
[script] Only use zlib if available.
Conditionally link against zlib - replaying a script will fail if the
trace uses a compressed format.
diff --git a/configure.ac b/configure.ac
index 7384ccc..47a3ac6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,7 +29,10 @@ AC_CACHE_SAVE
dnl ===========================================================================
AC_CHECK_LIB(z, compress,
- [AC_CHECK_HEADER(zlib.h, [have_libz=yes],
+ [AC_CHECK_HEADER(zlib.h, [
+ have_libz=yes
+ AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if you have zlib available])
+ ],
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])],
[have_libz="no (requires zlib http://www.gzip.org/zlib/)"])
diff --git a/util/cairo-script/Makefile.am b/util/cairo-script/Makefile.am
index 465adf4..829b06e 100644
--- a/util/cairo-script/Makefile.am
+++ b/util/cairo-script/Makefile.am
@@ -17,7 +17,7 @@ libcairo_script_interpreter_la_SOURCES = \
$(NULL)
libcairo_script_interpreter_la_CFLAGS = $(CAIRO_CFLAGS)
libcairo_script_interpreter_la_LDFLAGS = -version-info $(CAIRO_LIBTOOL_VERSION_INFO) -no-undefined $(export_symbols)
-libcairo_script_interpreter_la_LIBADD = -lz $(top_builddir)/src/libcairo.la $(CAIRO_LIBS)
+libcairo_script_interpreter_la_LIBADD = $(top_builddir)/src/libcairo.la $(CAIRO_LIBS)
csi_replay_SOURCES = csi-replay.c
csi_replay_LDADD = libcairo-script-interpreter.la
diff --git a/util/cairo-script/cairo-script-file.c b/util/cairo-script/cairo-script-file.c
index c21ef63..fcdccf1 100644
--- a/util/cairo-script/cairo-script-file.c
+++ b/util/cairo-script/cairo-script-file.c
@@ -36,7 +36,6 @@
#include <stdio.h>
#include <string.h>
-#include <zlib.h>
#define CHUNK_SIZE 32768
@@ -372,6 +371,9 @@ csi_file_new_ascii85_decode (csi_t *ctx,
return _csi_file_new_filter (ctx, obj, src, &funcs, data);
}
+#if HAVE_ZLIB
+#include <zlib.h>
+
typedef struct _deflate_decode_data {
z_stream zlib_stream;
@@ -503,6 +505,7 @@ csi_file_new_deflate_decode (csi_t *ctx,
return _csi_file_new_filter (ctx, obj, src, &funcs, data);
}
+#endif
#if 0
static int
diff --git a/util/cairo-script/cairo-script-operators.c b/util/cairo-script/cairo-script-operators.c
index a70b55d..13d6f76 100644
--- a/util/cairo-script/cairo-script-operators.c
+++ b/util/cairo-script/cairo-script-operators.c
@@ -1317,7 +1317,9 @@ _filter (csi_t *ctx)
csi_object_t *);
} filters[] = {
{ "ascii85", csi_file_new_ascii85_decode },
+#if HAVE_ZLIB
{ "deflate", csi_file_new_deflate_decode },
+#endif
#if 0
{ "lzw", csi_file_new_lzw_decode },
#endif
commit 9432c0c9b89ed6b3d369b377cf884918cd6180db
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Nov 26 17:33:35 2008 +0000
[script] Link the interpreter against the built library.
Ensure we correctly link against the version of cairo just built.
diff --git a/util/cairo-script/Makefile.am b/util/cairo-script/Makefile.am
index 4d22812..465adf4 100644
--- a/util/cairo-script/Makefile.am
+++ b/util/cairo-script/Makefile.am
@@ -17,10 +17,10 @@ libcairo_script_interpreter_la_SOURCES = \
$(NULL)
libcairo_script_interpreter_la_CFLAGS = $(CAIRO_CFLAGS)
libcairo_script_interpreter_la_LDFLAGS = -version-info $(CAIRO_LIBTOOL_VERSION_INFO) -no-undefined $(export_symbols)
-libcairo_script_interpreter_la_LIBADD = -lz $(CAIRO_LIBS) -L$(top_builddir)/src -lcairo
+libcairo_script_interpreter_la_LIBADD = -lz $(top_builddir)/src/libcairo.la $(CAIRO_LIBS)
csi_replay_SOURCES = csi-replay.c
-csi_replay_LDADD = libcairo-script-interpreter.la $(top_builddir)/src/libcairo.la
+csi_replay_LDADD = libcairo-script-interpreter.la
EXTRA_DIST = \
COPYING
commit 815e5b962ef8477c344da0f0b52c1f85c9854777
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Nov 26 17:30:29 2008 +0000
[script] Add a fallback image surface for replay
If we do not have a native windowing surface compiled into the library,
just replay the script to an image surface.
diff --git a/util/cairo-script/csi-replay.c b/util/cairo-script/csi-replay.c
index 5ca035f..e5a847e 100644
--- a/util/cairo-script/csi-replay.c
+++ b/util/cairo-script/csi-replay.c
@@ -68,6 +68,14 @@ _surface_create (void *closure,
return surface;
}
+#else
+/* fallback: just use an image surface */
+static cairo_surface_t *
+_surface_create (void *closure,
+ double width, double height)
+{
+ return cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height);
+}
#endif
int
commit 5e376523628d5e2078e395ea7263a04bacd37c47
Author: Chris Wilson <chris at chris-wilson.co.uk>
Date: Wed Nov 26 17:26:57 2008 +0000
[skiplist] Check for ffs()
Wine at least does not provide ffs(), so check at configure time and
open-code a replacement.
diff --git a/build/configure.ac.system b/build/configure.ac.system
index d06b798..4544a54 100644
--- a/build/configure.ac.system
+++ b/build/configure.ac.system
@@ -69,7 +69,7 @@ AC_CHECK_HEADER(fenv.h,
dnl check for misc headers and functions
AC_CHECK_HEADERS([libgen.h byteswap.h signal.h setjmp.h])
-AC_CHECK_FUNCS([vasnprintf link ctime_r drand48 flockfile])
+AC_CHECK_FUNCS([vasnprintf link ctime_r drand48 flockfile ffs])
dnl check for win32 headers (this detects mingw as well)
AC_CHECK_HEADERS([windows.h], have_windows=yes, have_windows=no)
diff --git a/src/cairo-skiplist.c b/src/cairo-skiplist.c
index 5f46ec0..02e1556 100644
--- a/src/cairo-skiplist.c
+++ b/src/cairo-skiplist.c
@@ -95,7 +95,18 @@ random_level (void)
* This works because we only use the lower MAX_LEVEL
* bits, and MAX_LEVEL < 16 */
uint32_t bits = hars_petruska_f54_1_random ();
+#if HAVE_FFS
return ffs (-(1<<MAX_LEVEL) | bits | bits >> 16);
+#else
+ int level = 1;
+
+ bits |= -(1<<MAX_LEVEL) | bits >> 16;
+ while ((bits & 1) == 0) {
+ level++;
+ bits >>= 1;
+ }
+ return level;
+#endif
}
static void *
More information about the cairo-commit
mailing list