[cairo-commit] 6 commits - boilerplate/Makefile.win32 Makefile.win32 src/cairo-surface.c src/cairo-surface-fallback.c src/cairo-surface-fallback-private.h src/cairo-win32-font.c src/cairo-win32.h src/cairo-win32-surface.c src/Makefile.win32 test/Makefile.win32 test/pdiff

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Tue Aug 28 10:57:51 PDT 2007


 Makefile.win32                       |   45 ++++++++++++--
 boilerplate/Makefile.win32           |   13 ++--
 src/Makefile.win32                   |   18 +----
 src/cairo-surface-fallback-private.h |   10 +++
 src/cairo-surface-fallback.c         |   43 +++++++++++++
 src/cairo-surface.c                  |    6 +
 src/cairo-win32-font.c               |  109 +++++++++++++++++++++++++++--------
 src/cairo-win32-surface.c            |    5 +
 src/cairo-win32.h                    |    3 
 test/Makefile.win32                  |   18 ++++-
 test/pdiff/Makefile.win32            |   18 +++++
 11 files changed, 233 insertions(+), 55 deletions(-)

New commits:
diff-tree 6525d4debb6df67126b04609bb04d23d9c9bd7a6 (from ae19b1c9911f95f64657f6ddaa0c924ca7a34b88)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Tue Aug 28 10:47:52 2007 -0700

    [win32] call free() and not scaled_font_destroy() if scaled init fails
    
    If scaled_font_destroy() is called, a deadlock can result; there's no
    reason to call destroy since the initialization failed (and, indeed,
    it might not be valid to do so anyway).

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 64df7e2..dfb475f 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -308,7 +308,7 @@ _win32_scaled_font_create (LOGFONTW     
 	status = _cairo_win32_scaled_font_set_metrics (f);
 
     if (status) {
-	cairo_scaled_font_destroy (&f->base);
+	free (f);
 	return NULL;
     }
 
diff-tree ae19b1c9911f95f64657f6ddaa0c924ca7a34b88 (from 69dae7ee4ace8a92226140ce5ccb690e7f62e35c)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Tue Aug 28 10:40:33 2007 -0700

    [win32] Add cairo_win32_font_face_create_for_logfontw_hfont
    
    Patch from: Robert O'Callahan <roc at ocallahans.org>
    
    Add cairo_win32_font_face_create_for_logfontw_hfont, allow win32
    scaled_fonts to rescale themselves properly to the required CTM and
    only use the font_face's hfont if we're sure it's appropriate.

diff --git a/src/cairo-win32-font.c b/src/cairo-win32-font.c
index 681dba7..64df7e2 100644
--- a/src/cairo-win32-font.c
+++ b/src/cairo-win32-font.c
@@ -1,3 +1,4 @@
+/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
 /* cairo - a vector graphics library with display and print output
  *
  * Copyright © 2005 Red Hat, Inc
@@ -226,9 +227,15 @@ _get_system_quality (void)
     }
 }
 
+/* If face_hfont is non-NULL then font_matrix must be a simple scale by some
+ * factor S, ctm must be the identity, logfont->lfHeight must be -S,
+ * logfont->lfWidth, logfont->lfEscapement, logfont->lfOrientation must
+ * all be 0, and face_hfont is the result of calling CreateFontIndirectW on
+ * logfont.
+ */
 static cairo_scaled_font_t *
 _win32_scaled_font_create (LOGFONTW                   *logfont,
-			   HFONT                      hfont,
+			   HFONT                      face_hfont,
 			   cairo_font_face_t	      *font_face,
 			   const cairo_matrix_t       *font_matrix,
 			   const cairo_matrix_t       *ctm,
@@ -274,11 +281,21 @@ _win32_scaled_font_create (LOGFONTW     
     }
 
     f->em_square = 0;
-    f->scaled_hfont = hfont;
+    f->scaled_hfont = NULL;
     f->unscaled_hfont = NULL;
 
-    /* don't delete the hfont if it was passed in to us */
-    f->delete_scaled_hfont = !hfont;
+    if (f->quality == logfont->lfQuality ||
+        (logfont->lfQuality == DEFAULT_QUALITY &&
+         options->antialias == CAIRO_ANTIALIAS_DEFAULT)) {
+        /* If face_hfont is non-NULL, then we can use it to avoid creating our
+         * own --- because the constraints on face_hfont mentioned above
+         * guarantee it was created in exactly the same way that
+         * _win32_scaled_font_get_scaled_hfont would create it.
+         */
+        f->scaled_hfont = face_hfont;
+    }
+    /* don't delete the hfont if we're using the one passed in to us */
+    f->delete_scaled_hfont = !f->scaled_hfont;
 
     cairo_matrix_multiply (&scale, font_matrix, ctm);
     _compute_transform (f, &scale);
@@ -1483,6 +1500,11 @@ const cairo_scaled_font_backend_t cairo_
 
 typedef struct _cairo_win32_font_face cairo_win32_font_face_t;
 
+/* If hfont is non-NULL then logfont->lfHeight must be -S for some S,
+ * logfont->lfWidth, logfont->lfEscapement, logfont->lfOrientation must
+ * all be 0, and hfont is the result of calling CreateFontIndirectW on
+ * logfont.
+ */
 struct _cairo_win32_font_face {
     cairo_font_face_t base;
     LOGFONTW logfont;
@@ -1496,6 +1518,14 @@ _cairo_win32_font_face_destroy (void *ab
 {
 }
 
+static cairo_bool_t
+_is_scale (const cairo_matrix_t *matrix, double scale)
+{
+    return matrix->xx == scale && matrix->yy == scale &&
+           matrix->xy == 0. && matrix->yx == 0. &&
+           matrix->x0 == 0. && matrix->y0 == 0.;
+}
+
 static cairo_status_t
 _cairo_win32_font_face_scaled_font_create (void			*abstract_face,
 					   const cairo_matrix_t	*font_matrix,
@@ -1503,10 +1533,20 @@ _cairo_win32_font_face_scaled_font_creat
 					   const cairo_font_options_t *options,
 					   cairo_scaled_font_t **font)
 {
+    HFONT hfont = NULL;
+
     cairo_win32_font_face_t *font_face = abstract_face;
 
+    if (font_face->hfont) {
+        /* Check whether it's OK to go ahead and use the font-face's HFONT. */
+        if (_is_scale (ctm, 1.) &&
+            _is_scale (font_matrix, -font_face->logfont.lfHeight)) {
+            hfont = font_face->hfont;
+        }
+    }
+
     *font = _win32_scaled_font_create (&font_face->logfont,
-				       font_face->hfont,
+				       hfont,
 				       &font_face->base,
 				       font_matrix, ctm, options);
     if (*font)
@@ -1522,10 +1562,13 @@ static const cairo_font_face_backend_t _
 };
 
 /**
- * cairo_win32_font_face_create_for_logfontw:
+ * cairo_win32_font_face_create_for_logfontw_hfont:
  * @logfont: A #LOGFONTW structure specifying the font to use.
- *   The lfHeight, lfWidth, lfOrientation and lfEscapement
- *   fields of this structure are ignored.
+ *   If hfont is null then the lfHeight, lfWidth, lfOrientation and lfEscapement
+ *   fields of this structure are ignored. Otherwise lfWidth, lfOrientation and
+ *   lfEscapement must be zero.
+ * @font: An #HFONT that can be used when the font matrix is a scale by
+ *   -lfHeight and the CTM is identity.
  *
  * Creates a new font for the Win32 font backend based on a
  * #LOGFONT. This font can then be used with
@@ -1538,18 +1581,18 @@ static const cairo_font_face_backend_t _
  *  cairo_font_face_destroy() when you are done using it.
  **/
 cairo_font_face_t *
-cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont)
+cairo_win32_font_face_create_for_logfontw_hfont (LOGFONTW *logfont, HFONT font)
 {
     cairo_win32_font_face_t *font_face;
 
     font_face = malloc (sizeof (cairo_win32_font_face_t));
     if (!font_face) {
-	_cairo_error (CAIRO_STATUS_NO_MEMORY);
-	return (cairo_font_face_t *)&_cairo_font_face_nil;
+        _cairo_error (CAIRO_STATUS_NO_MEMORY);
+        return (cairo_font_face_t *)&_cairo_font_face_nil;
     }
 
     font_face->logfont = *logfont;
-    font_face->hfont = NULL;
+    font_face->hfont = font;
 
     _cairo_font_face_init (&font_face->base, &_cairo_win32_font_face_backend);
 
@@ -1557,6 +1600,28 @@ cairo_win32_font_face_create_for_logfont
 }
 
 /**
+ * cairo_win32_font_face_create_for_logfontw:
+ * @logfont: A #LOGFONTW structure specifying the font to use.
+ *   The lfHeight, lfWidth, lfOrientation and lfEscapement
+ *   fields of this structure are ignored.
+ *
+ * Creates a new font for the Win32 font backend based on a
+ * #LOGFONT. This font can then be used with
+ * cairo_set_font_face() or cairo_scaled_font_create().
+ * The #cairo_scaled_font_t
+ * returned from cairo_scaled_font_create() is also for the Win32 backend
+ * and can be used with functions such as cairo_win32_scaled_font_select_font().
+ *
+ * Return value: a newly created #cairo_font_face_t. Free with
+ *  cairo_font_face_destroy() when you are done using it.
+ **/
+cairo_font_face_t *
+cairo_win32_font_face_create_for_logfontw (LOGFONTW *logfont)
+{
+    return cairo_win32_font_face_create_for_logfontw_hfont (logfont, NULL);
+}
+
+/**
  * cairo_win32_font_face_create_for_hfont:
  * @font: An #HFONT structure specifying the font to use.
  *
@@ -1573,19 +1638,17 @@ cairo_win32_font_face_create_for_logfont
 cairo_font_face_t *
 cairo_win32_font_face_create_for_hfont (HFONT font)
 {
-    cairo_win32_font_face_t *font_face;
+    LOGFONTW logfont;
+    GetObject (font, sizeof(logfont), &logfont);
 
-    font_face = malloc (sizeof (cairo_win32_font_face_t));
-    if (!font_face) {
-	_cairo_error (CAIRO_STATUS_NO_MEMORY);
-	return (cairo_font_face_t *)&_cairo_font_face_nil;
+    if (logfont.lfEscapement != 0 || logfont.lfOrientation != 0 ||
+        logfont.lfWidth != 0) {
+        /* We can't use this font because that optimization requires that
+         * lfEscapement, lfOrientation and lfWidth be zero. */
+        font = NULL;
     }
 
-    font_face->hfont = font;
-
-    _cairo_font_face_init (&font_face->base, &_cairo_win32_font_face_backend);
-
-    return &font_face->base;
+    return cairo_win32_font_face_create_for_logfontw_hfont (&logfont, font);
 }
 
 /**
diff --git a/src/cairo-win32.h b/src/cairo-win32.h
index 8719d33..5664386 100644
--- a/src/cairo-win32.h
+++ b/src/cairo-win32.h
@@ -70,6 +70,9 @@ cairo_win32_font_face_create_for_logfont
 cairo_public cairo_font_face_t *
 cairo_win32_font_face_create_for_hfont (HFONT font);
 
+cairo_public cairo_font_face_t *
+cairo_win32_font_face_create_for_logfontw_hfont (LOGFONTW *logfont, HFONT font);
+
 cairo_public cairo_status_t
 cairo_win32_scaled_font_select_font (cairo_scaled_font_t *scaled_font,
 				     HDC                  hdc);
diff-tree 69dae7ee4ace8a92226140ce5ccb690e7f62e35c (from 19fa097f515e72c195d10ddd64920ec71fa903ec)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Mon Aug 27 16:30:52 2007 -0700

    Implement fallback for clone_similar

diff --git a/src/cairo-surface-fallback-private.h b/src/cairo-surface-fallback-private.h
index 13d92d0..82c5625 100644
--- a/src/cairo-surface-fallback-private.h
+++ b/src/cairo-surface-fallback-private.h
@@ -1,3 +1,4 @@
+/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
 /* cairo - a vector graphics library with display and print output
  *
  * Copyright © 2002 University of Southern California
@@ -116,4 +117,13 @@ _cairo_surface_fallback_composite_trapez
 					      cairo_trapezoid_t	       *traps,
 					      int			num_traps);
 
+cairo_private cairo_status_t
+_cairo_surface_fallback_clone_similar (cairo_surface_t  *surface,
+				       cairo_surface_t  *src,
+				       int               src_x,
+				       int               src_y,
+				       int               width,
+				       int               height,
+				       cairo_surface_t **clone_out);
+
 #endif
diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index 7365565..75b9f12 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -1,3 +1,4 @@
+/* -*- Mode: c; tab-width: 8; c-basic-offset: 4; indent-tabs-mode: t; -*- */
 /* cairo - a vector graphics library with display and print output
  *
  * Copyright © 2002 University of Southern California
@@ -1252,3 +1253,43 @@ _cairo_surface_fallback_composite_trapez
 
     return status;
 }
+
+cairo_status_t
+_cairo_surface_fallback_clone_similar (cairo_surface_t	*surface,
+				       cairo_surface_t	*src,
+				       int		 src_x,
+				       int		 src_y,
+				       int		 width,
+				       int		 height,
+				       cairo_surface_t **clone_out)
+{
+    cairo_status_t status;
+    cairo_pattern_union_t src_pattern;
+    cairo_surface_t *new_surface = NULL;
+
+    new_surface = _cairo_surface_create_similar_scratch (surface,
+							 cairo_surface_get_content (src),
+							 width, height);
+    if (new_surface->status)
+	return new_surface->status;
+
+    _cairo_pattern_init_for_surface (&src_pattern.surface, src);
+
+    status = _cairo_surface_composite (CAIRO_OPERATOR_SOURCE,
+				       &src_pattern.base,
+				       NULL,
+				       new_surface,
+				       src_x, src_y,
+				       0, 0,
+				       0, 0,
+				       width, height);
+
+    _cairo_pattern_fini (&src_pattern.base);
+
+    if (status == CAIRO_STATUS_SUCCESS)
+	*clone_out = new_surface;
+    else
+	cairo_surface_destroy (new_surface);
+
+    return status;
+}
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index 0c5cbbe..a87b776 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1032,7 +1032,11 @@ _cairo_surface_clone_similar (cairo_surf
 	return CAIRO_STATUS_SURFACE_FINISHED;
 
     if (surface->backend->clone_similar == NULL)
-	return CAIRO_INT_STATUS_UNSUPPORTED;
+	return (cairo_int_status_t)
+	    _cairo_surface_fallback_clone_similar (surface, src,
+						   src_x, src_y,
+						   width, height,
+						   clone_out);
 
     status = surface->backend->clone_similar (surface, src, src_x, src_y,
 					      width, height, clone_out);
diff-tree 19fa097f515e72c195d10ddd64920ec71fa903ec (from f4a8633fce5262c09b323eef212fd6efe57d8f10)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Mon Aug 27 15:29:24 2007 -0700

    [win32] Update win32 Makefiles
    
    Happy building with msys, one location for CFLAGS/etc changes (toplevel),
    new pdiff makefile.

diff --git a/Makefile.win32 b/Makefile.win32
index 25fee71..cdde7d2 100644
--- a/Makefile.win32
+++ b/Makefile.win32
@@ -2,12 +2,34 @@
 # Win32 makefile
 #
 
-CAIRO_VERSION = 1.2.5
+CC := cl
+LINK := link
+OPT := -O2
+
+PIXMAN_CFLAGS := -I../../pixman/pixman
+PIXMAN_LIBS := ../../pixman/pixman/pixman-1.lib
+
+EXE_LDFLAGS = libpng.lib zlib.lib gdi32.lib msimg32.lib user32.lib
+
+DEFAULT_CFLAGS = -MD -Zi -nologo $(OPT)
+DEFAULT_CFLAGS += -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
+DEFAULT_CFLAGS += -DPACKAGE_VERSION="" -DPACKAGE_BUGREPORT="" -DCAIRO_BUILD
+DEFAULT_CFLAGS += -I. 
+DEFAULT_CFLAGS += $(PIXMAN_CFLAGS)
+DEFAULT_CFLAGS += -DCAIRO_NO_MUTEX=1
+
+CFLAGS := $(DEFAULT_CFLAGS)
+
 CAIRO_VERSION_MAJOR = 1
-CAIRO_VERSION_MINOR = 2
-CAIRO_VERSION_MICRO = 5
+CAIRO_VERSION_MINOR = 5
+CAIRO_VERSION_MICRO = 1
+
+CAIRO_VERSION = $(CAIRO_VERSION_MAJOR).$(CAIRO_VERSION_MINOR).$(CAIRO_VERSION_MICRO)
 
-SUBDIRS = pixman/src src
+# Only if this was called as the top-level makefile
+ifeq ($(SUBMAKEFILE),)
+
+SUBDIRS = src
 
 TEST_SUBDIRS = boilerplate test
 
@@ -16,15 +38,26 @@ all: cairo
 cairo: src/cairo-features.h
 	@list='$(SUBDIRS)'; for f in $$list ; do \
 		echo making all in $$f... ; \
-		(cd $$f ; make -f Makefile.win32) || exit 1 ; \
+		(cd $$f ; $(MAKE) -f Makefile.win32 CC="$(CC)" LINK="$(LINK)" OPT="$(OPT)" CFLAGS="$(CFLAGS)" PIXMAN_LIBS="$(PIXMAN_LIBS)") || exit 1 ; \
 	done
 
 test: cairo
 	@list='$(TEST_SUBDIRS)'; for f in $$list ; do \
 		echo making all in $$f... ; \
-		(cd $$f ; make -f Makefile.win32) || exit 1 ; \
+		(cd $$f ; $(MAKE) -f Makefile.win32 CC="$(CC)" LINK="$(LINK)" OPT="$(OPT)" CFLAGS="$(CFLAGS)" PIXMAN_LIBS="$(PIXMAN_LIBS)") || exit 1 ; \
 	done
 	@(cd test ; make -f Makefile.win32 test)
 
 html:
 	@(cd test ; make -f Makefile.win32 html)
+
+endif
+
+# Some generic rules
+
+%.obj: %.c
+	@$(CC) $(CFLAGS) -c -Fo"$@" $<
+
+%-static.obj: %.c
+	@$(CC) $(CFLAGS) -c -DCAIRO_WIN32_STATIC_BUILD=1 -Fo"$@" $<
+
diff --git a/boilerplate/Makefile.win32 b/boilerplate/Makefile.win32
index 87c1d44..c746f6b 100644
--- a/boilerplate/Makefile.win32
+++ b/boilerplate/Makefile.win32
@@ -1,5 +1,9 @@
-CC = cl
-CFLAGS = /nologo /MD /Zi /O2 /I../src /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE
+
+SUBMAKEFILE = 1
+
+include ../Makefile.win32
+
+CFLAGS += -I../src
 
 SOURCES = \
 	cairo-boilerplate.c \
@@ -10,9 +14,6 @@ OBJECTS = $(subst .c,.obj,$(SOURCES))
 
 all: boiler.lib
 
-%.obj: %.c
-	@$(CC) $(CFLAGS) /c /Fo"$@" $<
-
 boiler.lib: $(OBJECTS)
-	lib /NOLOGO /OUT:$@ $(OBJECTS)
+	lib -NOLOGO -OUT:$@ $(OBJECTS)
 
diff --git a/src/Makefile.win32 b/src/Makefile.win32
index c322e45..037f9c3 100644
--- a/src/Makefile.win32
+++ b/src/Makefile.win32
@@ -1,7 +1,7 @@
-CC = cl
-LINK = link
 
-CFLAGS = /MD /Zi /nologo /O2 /c /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /I../pixman/src /I. /DPACKAGE_VERSION="" /DPACKAGE_BUGREPORT="" /DCAIRO_BUILD
+SUBMAKEFILE = 1
+
+include ../Makefile.win32
 
 DEFFILE = cairo.def
 srcdir = `pwd`
@@ -26,6 +26,7 @@ SOURCES = \
 	cairo-lzw.c \
 	cairo-matrix.c \
 	cairo-meta-surface.c \
+	cairo-mutex.c \
 	cairo-output-stream.c \
 	cairo-operator.c \
 	cairo-path-bounds.c \
@@ -83,12 +84,6 @@ STATIC_OBJECTS = $(subst .c,-static.obj,
 
 all: cairo.dll cairo-static.lib
 
-%.obj: %.c
-	@$(CC) $(CFLAGS) /Fo"$@" $<
-
-%-static.obj: %.c
-	@$(CC) $(CFLAGS) /DCAIRO_WIN32_STATIC_BUILD=1 /Fo"$@" $<
-
 $(DEFFILE):
 	(echo EXPORTS; \
 	(cd $(srcdir); cat $(cairo_headers) || echo 'cairo_ERROR ()' ) | \
@@ -102,11 +97,10 @@ $(DEFFILE):
 	@ ! grep -q cairo_ERROR $@ || ($(RM) $@; false)
 
 cairo.dll: $(OBJECTS) $(SHARED_OBJECTS) $(DEFFILE)
-	$(CC) /MD /Zi /LD /Fe$@ ../pixman/src/pixman.lib $(OBJECTS) $(SHARED_OBJECTS) /link /DEF:$(DEFFILE) user32.lib gdi32.lib libpng.lib zlib.lib
+	$(CC) -MD -Zi -LD -Fe$@ $(PIXMAN_LIBS) $(OBJECTS) $(SHARED_OBJECTS) -link -DEF:$(DEFFILE) user32.lib gdi32.lib libpng.lib zdll.lib
 
 cairo-static.lib: $(OBJECTS) $(STATIC_OBJECTS)
-	lib /NOLOGO /OUT:$@ ../pixman/src/pixman.lib $(OBJECTS) $(STATIC_OBJECTS)
-
+	lib -NOLOGO -OUT:$@ $(PIXMAN_LIBS) $(OBJECTS) $(STATIC_OBJECTS)
 
 clean:
 	@rm -f *.obj *.dll *.lib *.pdb *.ilk || exit 0
diff --git a/test/Makefile.win32 b/test/Makefile.win32
index 9797b75..27d8228 100644
--- a/test/Makefile.win32
+++ b/test/Makefile.win32
@@ -1,6 +1,11 @@
-CC = cl
-CFLAGS = /nologo /Zi /O2 /MD /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE /I../src /I../pixman/src /I../boilerplate
-LDFLAGS = ../src/cairo.lib ../pixman/src/pixman.lib ../boilerplate/boiler.lib libpng.lib zlib.lib gdi32.lib msimg32.lib user32.lib
+
+SUBMAKEFILE = 1
+
+include ../Makefile.win32
+
+CFLAGS += -I../src -I../boilerplate -I./pdiff
+
+LDFLAGS += ./pdiff/pdiff.lib ../src/cairo.lib $(PIXMAN_LIBS) ../boilerplate/boiler.lib $(EXE_LDFLAGS)
 
 TESTS = 			\
 a8-mask				\
@@ -98,8 +103,11 @@ TEST_EXE = $(addsuffix .exe,$(TESTS))
 
 all: $(TEST_EXE)
 
-%.exe: %.c
-	@$(CC) $(CFLAGS) /Fe"$@" $<  $(TESTCORE_SOURCES) /link $(LDFLAGS)
+%.exe: %.c ./pdiff/pdiff.lib
+	@$(CC) $(CFLAGS) -Fe"$@" $<  $(TESTCORE_SOURCES) -link $(LDFLAGS)
+
+./pdiff/pdiff.lib:
+	(cd pdiff ; $(MAKE) -f Makefile.win32)
 
 test: $(TEST_EXE)
 	@for exe in $(TEST_EXE) ; do \
diff --git a/test/pdiff/Makefile.win32 b/test/pdiff/Makefile.win32
new file mode 100644
index 0000000..c5d3f6b
--- /dev/null
+++ b/test/pdiff/Makefile.win32
@@ -0,0 +1,18 @@
+
+SUBMAKEFILE = 1
+
+include ../../Makefile.win32
+
+CFLAGS += -I../../src
+
+SOURCES = \
+	lpyramid.c \
+	pdiff.c \
+	$(NULL)
+
+OBJECTS = $(subst .c,.obj,$(SOURCES))
+
+all: pdiff.lib
+
+pdiff.lib: $(OBJECTS)
+	lib -NOLOGO -OUT:$@ $(OBJECTS)
diff-tree f4a8633fce5262c09b323eef212fd6efe57d8f10 (from 9aad6efd2b2ee14b0a8960a8e4de91b330ad0c4c)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Mon Aug 27 14:26:19 2007 -0700

    [win32] check correct surface for BitBlt support in get_subimage

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 81e1081..1358670 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -476,7 +476,10 @@ _cairo_win32_surface_get_subimage (cairo
 
     status = CAIRO_INT_STATUS_UNSUPPORTED;
 
-    if ((local->flags & CAIRO_WIN32_SURFACE_CAN_BITBLT) &&
+    /* We are blitting -from- surface, so we need to check if it
+     * supports BitBlt.  I believe any surface can be used as a
+     * BitBlt destination. */
+    if ((surface->flags & CAIRO_WIN32_SURFACE_CAN_BITBLT) &&
 	BitBlt (local->dc,
 		0, 0,
 		width, height,
diff-tree 9aad6efd2b2ee14b0a8960a8e4de91b330ad0c4c (from 7ccae2de6d859fcac93cedbd3ecd1121e0d0a72b)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Mon Aug 27 14:17:50 2007 -0700

    Fix image_extra arg in call to _cairo_release_source_image

diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c
index 3929d8d..7365565 100644
--- a/src/cairo-surface-fallback.c
+++ b/src/cairo-surface-fallback.c
@@ -1070,7 +1070,7 @@ _cairo_surface_fallback_snapshot (cairo_
     }
 
     _cairo_surface_release_source_image (surface,
-					 image, &image_extra);
+					 image, image_extra);
 
     snapshot->device_transform = surface->device_transform;
     snapshot->device_transform_inverse = surface->device_transform_inverse;


More information about the cairo-commit mailing list