[cairo-commit] cairo/src cairo_array.c, 1.1, 1.2 cairo_pdf_surface.c, 1.3, 1.4 cairo_xlib_surface.c, 1.35, 1.36 cairoint.h, 1.83, 1.84

Kristian Hogsberg commit at pdx.freedesktop.org
Mon Jan 17 09:40:03 PST 2005


Committed by: krh

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv5211/src

Modified Files:
	cairo_array.c cairo_pdf_surface.c cairo_xlib_surface.c 
	cairoint.h 
Log Message:
2005-01-17  Kristian Høgsberg  <krh at redhat.com>

        * src/cairo_pdf_surface.c: Add preliminary text support, including
        support for truetype font subsetting.

        * src/cairoint.h: Change type of 'surface' argument in show_glyphs
        to void * as it is for all other surface virtual functions.
        * src/cairo_xlib_surface.c (_cairo_xlib_surface_show_glyphs):
        Update accordingly.

        * configure.in: Add check for endianess.

        * src/cairo_array.c (_cairo_array_grow_by): Fix bug in array
        growing loop.
        (_cairo_array_append): Accept NULL for elements argument, in which
        case we just allocate space in the array.



Index: cairo_array.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_array.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- cairo_array.c	5 Jan 2005 22:29:31 -0000	1.1
+++ cairo_array.c	17 Jan 2005 17:40:01 -0000	1.2
@@ -68,7 +68,7 @@
 	new_size = old_size * 2;
 
     while (new_size < required_size)
-	new_size = old_size * 2;
+	new_size = new_size * 2;
 
     array->size = new_size;
     new_elements = realloc (array->elements,
@@ -105,22 +105,26 @@
     memcpy (dst, _cairo_array_index (array, index), array->element_size);
 }
 
-cairo_status_t
-_cairo_array_append (cairo_array_t *array, void *elements, int num_elements)
+void *
+_cairo_array_append (cairo_array_t *array,
+		     const void *elements, int num_elements)
 {
     cairo_status_t status;
+    void *dest;
 
     status = _cairo_array_grow_by (array, num_elements);
     if (status != CAIRO_STATUS_SUCCESS)
-	return status;
+	return NULL;
 
     assert (array->num_elements + num_elements <= array->size);
 
-    memcpy (&array->elements[array->num_elements * array->element_size],
-	    elements, num_elements * array->element_size);
+    dest = &array->elements[array->num_elements * array->element_size];
     array->num_elements += num_elements;
 
-    return CAIRO_STATUS_SUCCESS;
+    if (elements != NULL)
+	memcpy (dest, elements, num_elements * array->element_size);
+
+    return dest;
 }
 
 int

Index: cairo_pdf_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_pdf_surface.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- cairo_pdf_surface.c	7 Jan 2005 07:20:07 -0000	1.3
+++ cairo_pdf_surface.c	17 Jan 2005 17:40:01 -0000	1.4
@@ -36,6 +36,12 @@
 
 #include "cairoint.h"
 
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_OUTLINE_H
+#include FT_TRUETYPE_TAGS_H
+#include FT_TRUETYPE_TABLES_H
+
 #include <time.h>
 #include <zlib.h>
[...1024 lines suppressed...]
 	     "   /Resources <<\r\n");
 
+    num_resources =  _cairo_array_num_elements (&surface->fonts);
+    if (num_resources > 0) {
+	fprintf (file,
+		 "      /Font <<");
+
+	for (i = 0; i < num_resources; i++) {
+	    res = _cairo_array_index (&surface->fonts, i);
+	    fprintf (file,
+		     " /res%d %d 0 R",
+		     res->id, res->id);
+	}
+
+	fprintf (file,
+		 " >>\r\n");
+    }
     
     num_alphas =  _cairo_array_num_elements (&surface->alphas);
     if (num_alphas > 0) {

Index: cairo_xlib_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xlib_surface.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- cairo_xlib_surface.c	13 Jan 2005 14:50:23 -0000	1.35
+++ cairo_xlib_surface.c	17 Jan 2005 17:40:01 -0000	1.36
@@ -697,7 +697,7 @@
 				 cairo_font_scale_t	*scale,
 				 cairo_operator_t       operator,
 				 cairo_surface_t        *source,
-				 cairo_surface_t        *surface,
+				 void			*abstract_surface,
 				 int                    source_x,
 				 int                    source_y,
 				 const cairo_glyph_t    *glyphs,
@@ -1250,14 +1250,14 @@
 				 cairo_font_scale_t	*scale,
 				 cairo_operator_t       operator,
 				 cairo_surface_t        *source,
-				 cairo_surface_t        *surface,
+				 void		        *abstract_surface,
 				 int                    source_x,
 				 int                    source_y,
 				 const cairo_glyph_t    *glyphs,
 				 int                    num_glyphs)
 {
     unsigned int elt_size;
-    cairo_xlib_surface_t *self = (cairo_xlib_surface_t *) surface;
+    cairo_xlib_surface_t *self = abstract_surface;
     cairo_image_surface_t *tmp = NULL;
     cairo_xlib_surface_t *src = NULL;
     glyphset_cache_t *g;
@@ -1278,7 +1278,7 @@
     }
 
     /* prep the source surface. */
-    if (source->backend == surface->backend) {
+    if (source->backend == self->base.backend) {
 	src = (cairo_xlib_surface_t *) source;
 
     } else {
@@ -1287,7 +1287,7 @@
 	    goto FREE_ENTRIES;
 
 	src = (cairo_xlib_surface_t *) 
-	    _cairo_surface_create_similar_scratch (surface, self->format, 1,
+	    _cairo_surface_create_similar_scratch (&self->base, self->format, 1,
 						   tmp->width, tmp->height);
 
 	if (src == NULL)

Index: cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- cairoint.h	17 Jan 2005 17:18:37 -0000	1.83
+++ cairoint.h	17 Jan 2005 17:40:01 -0000	1.84
@@ -276,8 +276,9 @@
 cairo_private void
 _cairo_array_truncate (cairo_array_t *array, int length);
 
-cairo_private cairo_status_t
-_cairo_array_append (cairo_array_t *array, void *elements, int num_elements);
+cairo_private void *
+_cairo_array_append (cairo_array_t *array,
+		     const void *elements, int num_elements);
 
 cairo_private void *
 _cairo_array_index (cairo_array_t *array, int index);
@@ -606,7 +607,7 @@
 				 cairo_font_scale_t		*scale,
 				 cairo_operator_t		operator,
 				 cairo_surface_t		*source,
-				 cairo_surface_t		*surface,
+				 void				*surface,
 				 int				source_x,
 				 int				source_y,
 				 const cairo_glyph_t		*glyphs,




More information about the cairo-commit mailing list