[cairo-commit] 6 commits - src/cairoint.h src/cairo-qt-surface.cpp src/cairo-quartz-surface.c src/cairo-surface.c src/cairo-surface-subsurface.c src/cairo-win32-printing-surface.c src/cairo-win32-surface.c src/cairo-xlib-xcb-surface.c

Andrea Canciani ranma42 at kemper.freedesktop.org
Wed Jul 27 00:47:15 PDT 2011


 src/cairo-qt-surface.cpp           |    7 ++++++-
 src/cairo-quartz-surface.c         |   15 ++++++++++-----
 src/cairo-surface-subsurface.c     |    2 +-
 src/cairo-surface.c                |    6 +++++-
 src/cairo-win32-printing-surface.c |    6 +++---
 src/cairo-win32-surface.c          |   22 +++++++++++-----------
 src/cairo-xlib-xcb-surface.c       |    7 ++++++-
 src/cairoint.h                     |    2 +-
 8 files changed, 43 insertions(+), 24 deletions(-)

New commits:
commit fc98fd9db5a619013ffcd671aacb5b8494443c8d
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Jul 27 09:22:31 2011 +0200

    win32: Fix typos in documentation
    
    The documentation of the win32 surface backend contained a typo,
    pointed out by Andrej Mitrovic in
    http://lists.cairographics.org/archives/cairo/2011-July/022084.html
    
    Another imprecision was found reviewing the public API documentation.

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index 3d843d7..d137562 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -1832,12 +1832,12 @@ cairo_win32_surface_create_with_dib (cairo_format_t format,
 
 /**
  * cairo_win32_surface_create_with_ddb:
- * @hdc: the DC to create a surface for
+ * @hdc: a DC compatible with the surface to create
  * @format: format of pixels in the surface to create
  * @width: width of the surface, in pixels
  * @height: height of the surface, in pixels
  *
- * Creates a device-independent-bitmap surface not associated with
+ * Creates a device-dependent-bitmap surface not associated with
  * any particular existing surface or device context. The created
  * bitmap will be uninitialized.
  *
commit 2fd20e5c1e3a54cfe060820f1841b92743891607
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Jul 27 09:10:19 2011 +0200

    surface: Check image parameter in cairo_surface_unmap_image()
    
    The image argument must be a cairo-image surface.

diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index b6a9489..cb05ff6 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -676,10 +676,14 @@ cairo_surface_unmap_image (cairo_surface_t *surface,
 	status = _cairo_error (CAIRO_STATUS_SURFACE_FINISHED);
 	goto error;
     }
+    if (unlikely (! _cairo_surface_is_image (image))) {
+	status = _cairo_error (CAIRO_STATUS_SURFACE_TYPE_MISMATCH);
+	goto error;
+    }
 
     status = CAIRO_INT_STATUS_UNSUPPORTED;
     if (surface->backend->unmap_image)
-	status = surface->backend->unmap_image (surface, image);
+	status = surface->backend->unmap_image (surface, (cairo_image_surface_t *) image);
     if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
 	cairo_surface_pattern_t pattern;
 
commit 3f9717347eebbb0f0d517b215f763d738c4a476c
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Wed Jul 27 09:10:34 2011 +0200

    win32: Constify
    
    Silences some compiler warnings.

diff --git a/src/cairo-surface-subsurface.c b/src/cairo-surface-subsurface.c
index cdefd56..29d9ef0 100644
--- a/src/cairo-surface-subsurface.c
+++ b/src/cairo-surface-subsurface.c
@@ -582,7 +582,7 @@ cairo_surface_create_for_rectangle (cairo_surface_t *target,
 
 cairo_surface_t *
 _cairo_surface_create_for_rectangle_int (cairo_surface_t *target,
-					 cairo_rectangle_int_t *extents)
+					 const cairo_rectangle_int_t *extents)
 {
     cairo_surface_subsurface_t *surface;
 
diff --git a/src/cairo-win32-printing-surface.c b/src/cairo-win32-printing-surface.c
index 71d1b5e..5cd3cee 100644
--- a/src/cairo-win32-printing-surface.c
+++ b/src/cairo-win32-printing-surface.c
@@ -1084,8 +1084,8 @@ _cairo_win32_printing_surface_path_close_path (void *closure)
 }
 
 static cairo_status_t
-_cairo_win32_printing_surface_emit_path (cairo_win32_surface_t *surface,
-                                         cairo_path_fixed_t    *path)
+_cairo_win32_printing_surface_emit_path (cairo_win32_surface_t    *surface,
+					 const cairo_path_fixed_t *path)
 {
     win32_path_info_t path_info;
 
@@ -1440,7 +1440,7 @@ _cairo_win32_printing_surface_emit_win32_glyphs (cairo_win32_surface_t 	*surface
 						 cairo_glyph_t        	*glyphs,
 						 int			 num_glyphs,
 						 cairo_scaled_font_t  	*scaled_font,
-						 cairo_clip_t		*clip,
+						 const cairo_clip_t	*clip,
 						 int			*remaining_glyphs)
 {
     cairo_matrix_t ctm;
diff --git a/src/cairoint.h b/src/cairoint.h
index 3928eb0..bbe26a8 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1637,7 +1637,7 @@ _cairo_surface_create_similar_scratch (cairo_surface_t *other,
 
 cairo_private cairo_surface_t *
 _cairo_surface_create_for_rectangle_int (cairo_surface_t *target,
-					 cairo_rectangle_int_t *extents);
+					 const cairo_rectangle_int_t *extents);
 
 cairo_private cairo_surface_t *
 _cairo_surface_create_similar_solid (cairo_surface_t	    *other,
commit 9ef178ff350b68c7a7983429e07ff10f4ea0b265
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Jul 26 22:14:22 2011 +0200

    win32: Fix compilation
    
    a69335a84eb9225b477cc8c753470eb3805b852c broke compilaiton of win32
    surfaces because of some typos.

diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c
index e203542..3d843d7 100644
--- a/src/cairo-win32-surface.c
+++ b/src/cairo-win32-surface.c
@@ -572,9 +572,9 @@ _cairo_win32_surface_map_to_image (void                    *abstract_surface,
     if (unlikely (status))
 	return _cairo_surface_create_in_error (status);
 
-    status = _cairo_surface_set_user_data (&local->image->user_data,
-					   (const cairo_user_data_key_t *)surface->image,
-					   local, NULL);
+    status = cairo_surface_set_user_data (local->image,
+					  (const cairo_user_data_key_t *)surface->image,
+					  local, NULL);
     if (unlikely (status)) {
 	cairo_surface_destroy (&local->base);
 	return _cairo_surface_create_in_error (status);
@@ -585,20 +585,20 @@ _cairo_win32_surface_map_to_image (void                    *abstract_surface,
 }
 
 static cairo_int_status_t
-_cairo_win32_surface_release_unmap_image (void                    *abstract_surface,
-					  cairo_image_surface_t   *image)
+_cairo_win32_surface_unmap_image (void                    *abstract_surface,
+				  cairo_image_surface_t   *image)
 {
     cairo_win32_surface_t *surface = abstract_surface;
     cairo_win32_surface_t *local;
 
-    local = _cairo_surface_set_user_data (&image->base.user_data,
-					   (const cairo_user_data_key_t *)surface->image);
+    local = cairo_surface_get_user_data (&image->base,
+					 (const cairo_user_data_key_t *) surface->image);
     if (!local)
 	return CAIRO_INT_STATUS_SUCCESS;
 
     if (!BitBlt (surface->dc,
-		 image->device_transform.x0,
-		 image->device_transform.y0,
+		 image->base.device_transform.x0,
+		 image->base.device_transform.y0,
 		 image->width, image->height,
 		 local->dc,
 		 0, 0,
commit 87016112c5ce486607b5e28ad873cda3d1db65ec
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Jul 26 20:48:55 2011 +0200

    Fix surface backend structures
    
    a69335a84eb9225b477cc8c753470eb3805b852c introduced some new members
    in the backend structure, but quartz, qt and xlib-xcb were not
    updated.

diff --git a/src/cairo-qt-surface.cpp b/src/cairo-qt-surface.cpp
index 772d610..aaed90c 100644
--- a/src/cairo-qt-surface.cpp
+++ b/src/cairo-qt-surface.cpp
@@ -1552,10 +1552,15 @@ _cairo_qt_surface_mark_dirty (void *abstract_surface,
 
 static const cairo_surface_backend_t cairo_qt_surface_backend = {
     CAIRO_SURFACE_TYPE_QT,
+    _cairo_qt_surface_finish,
+
     _cairo_default_context_create,
 
     _cairo_qt_surface_create_similar,
-    _cairo_qt_surface_finish,
+    NULL, /* similar image */
+    NULL, /* map to image */
+    NULL, /* unmap image */
+
     _cairo_qt_surface_acquire_source_image,
     _cairo_qt_surface_release_source_image,
     _cairo_qt_surface_acquire_dest_image,
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index f166df6..d5d8aaf 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -2419,10 +2419,15 @@ _cairo_quartz_surface_clipper_intersect_clip_path (cairo_surface_clipper_t *clip
 
 static const struct _cairo_surface_backend cairo_quartz_surface_backend = {
     CAIRO_SURFACE_TYPE_QUARTZ,
+    _cairo_quartz_surface_finish,
+
     _cairo_default_context_create,
 
     _cairo_quartz_surface_create_similar,
-    _cairo_quartz_surface_finish,
+    NULL, /* similar image */
+    NULL, /* map to image */
+    NULL, /* unmap image */
+
     _cairo_quartz_surface_acquire_source_image,
     _cairo_quartz_surface_release_source_image,
     _cairo_quartz_surface_acquire_dest_image,
diff --git a/src/cairo-xlib-xcb-surface.c b/src/cairo-xlib-xcb-surface.c
index 7fc27e2..b975113 100644
--- a/src/cairo-xlib-xcb-surface.c
+++ b/src/cairo-xlib-xcb-surface.c
@@ -234,10 +234,15 @@ _cairo_xlib_xcb_surface_mark_dirty (void *abstract_surface,
 
 static const cairo_surface_backend_t _cairo_xlib_xcb_surface_backend = {
     CAIRO_SURFACE_TYPE_XLIB,
+    _cairo_xlib_xcb_surface_finish,
+
     _cairo_default_context_create, /* XXX */
 
     _cairo_xlib_xcb_surface_create_similar,
-    _cairo_xlib_xcb_surface_finish,
+    NULL, /* similar image */
+    NULL, /* map to image */
+    NULL, /* unmap image */
+
     _cairo_xlib_xcb_surface_acquire_source_image,
     _cairo_xlib_xcb_surface_release_source_image,
     NULL, NULL, NULL, /* dest acquire/release/clone */
commit ca53fed93953821f3bc95e1d8b142128c8c1bba8
Author: Andrea Canciani <ranma42 at gmail.com>
Date:   Tue Jul 26 20:51:30 2011 +0200

    quartz: Silence const cast warnings
    
    b132fae5e843c329d1414d1a65b2e8d66b99852f const-ified some arguments,
    but missed others.

diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 5b99680..f166df6 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -339,7 +339,7 @@ _cairo_path_to_quartz_context_close_path (void *closure)
 }
 
 static void
-_cairo_quartz_cairo_path_to_quartz_context (cairo_path_fixed_t *path,
+_cairo_quartz_cairo_path_to_quartz_context (const cairo_path_fixed_t *path,
 					    CGContextRef closure)
 {
     cairo_status_t status;
@@ -1086,7 +1086,7 @@ _cairo_quartz_setup_state (cairo_quartz_drawing_state_t *state,
 			   cairo_quartz_surface_t       *surface,
 			   cairo_operator_t              op,
 			   const cairo_pattern_t        *source,
-			   cairo_clip_t                 *clip)
+			   const cairo_clip_t           *clip)
 {
     cairo_bool_t needs_temp;
     cairo_status_t status;
@@ -2168,7 +2168,7 @@ _cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
 					 cairo_surface_t        *mask_surf,
 					 const cairo_matrix_t   *mask_mat,
 					 CGInterpolationQuality filter,
-					 cairo_clip_t           *clip)
+					 const cairo_clip_t     *clip)
 {
     CGRect rect;
     CGImageRef img;
@@ -2225,7 +2225,7 @@ _cairo_quartz_surface_mask_with_solid (cairo_quartz_surface_t *surface,
 				       cairo_operator_t        op,
 				       const cairo_pattern_t  *source,
 				       double                  alpha,
-				       cairo_clip_t *clip)
+				       const cairo_clip_t *clip)
 {
     cairo_quartz_drawing_state_t state;
     cairo_status_t status;


More information about the cairo-commit mailing list