[cairo-commit] 3 commits - src/cairo-pdf-surface.c src/cairo-pdf-surface-private.h

Adrian Johnson ajohnson at kemper.freedesktop.org
Tue Aug 28 04:07:17 PDT 2007


 src/cairo-pdf-surface-private.h |    1 
 src/cairo-pdf-surface.c         |   45 +++++++++++++++-------------------------
 2 files changed, 17 insertions(+), 29 deletions(-)

New commits:
diff-tree 766346aa5cffb699206cc17114221ba7a0323565 (from ad43b7fe6bba3ba597b28b6f6668ee98cdc04a88)
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Aug 28 20:35:49 2007 +0930

    PDF: Remove unused code

diff --git a/src/cairo-pdf-surface-private.h b/src/cairo-pdf-surface-private.h
index 79e24d4..99b5393 100644
--- a/src/cairo-pdf-surface-private.h
+++ b/src/cairo-pdf-surface-private.h
@@ -72,7 +72,6 @@ struct _cairo_pdf_surface {
 
     cairo_array_t objects;
     cairo_array_t pages;
-    cairo_array_t streams;
     cairo_array_t rgb_linear_functions;
     cairo_array_t alpha_linear_functions;
     cairo_array_t knockout_group;
diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 6302d1b..7d39baf 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -235,10 +235,6 @@ _cairo_pdf_surface_open_stream (cairo_pd
 static cairo_status_t
 _cairo_pdf_surface_close_stream (cairo_pdf_surface_t	*surface);
 
-static cairo_status_t
-_cairo_pdf_surface_add_stream (cairo_pdf_surface_t	*surface,
-			       cairo_pdf_resource_t	 stream);
-
 static void
 _cairo_pdf_surface_write_pages (cairo_pdf_surface_t *surface);
 
@@ -296,13 +292,6 @@ _cairo_pdf_surface_update_object (cairo_
     object->offset = _cairo_output_stream_get_position (surface->output);
 }
 
-static cairo_status_t
-_cairo_pdf_surface_add_stream (cairo_pdf_surface_t	*surface,
-			       cairo_pdf_resource_t	 stream)
-{
-    return _cairo_array_append (&surface->streams, &stream);
-}
-
 static cairo_surface_t *
 _cairo_pdf_surface_create_for_stream_internal (cairo_output_stream_t	*output,
 					       double			 width,
@@ -327,7 +316,6 @@ _cairo_pdf_surface_create_for_stream_int
 
     _cairo_array_init (&surface->objects, sizeof (cairo_pdf_object_t));
     _cairo_array_init (&surface->pages, sizeof (cairo_pdf_resource_t));
-    _cairo_array_init (&surface->streams, sizeof (cairo_pdf_resource_t));
     _cairo_array_init (&surface->rgb_linear_functions, sizeof (cairo_pdf_rgb_linear_function_t));
     _cairo_array_init (&surface->alpha_linear_functions, sizeof (cairo_pdf_alpha_linear_function_t));
     _cairo_array_init (&surface->fonts, sizeof (cairo_pdf_font_t));
@@ -526,7 +514,6 @@ cairo_pdf_surface_set_size (cairo_surfac
 static void
 _cairo_pdf_surface_clear (cairo_pdf_surface_t *surface)
 {
-    _cairo_array_truncate (&surface->streams, 0);
     _cairo_pdf_group_element_array_finish (&surface->content_group);
     _cairo_pdf_group_element_array_finish (&surface->knockout_group);
     _cairo_array_truncate (&surface->content_group, 0);
@@ -1087,7 +1074,6 @@ _cairo_pdf_surface_finish (void *abstrac
 
     _cairo_array_fini (&surface->objects);
     _cairo_array_fini (&surface->pages);
-    _cairo_array_fini (&surface->streams);
     _cairo_array_fini (&surface->rgb_linear_functions);
     _cairo_array_fini (&surface->alpha_linear_functions);
     _cairo_array_fini (&surface->fonts);
@@ -3394,10 +3380,6 @@ _cairo_pdf_surface_write_page (cairo_pdf
 				 has_fallback_images ? knockout_group.id : content_group.id);
     _cairo_pdf_surface_close_stream (surface);
 
-    status = _cairo_pdf_surface_add_stream (surface, page_content);
-    if (status)
-	return status;
-
     page = _cairo_pdf_surface_new_object (surface);
     _cairo_output_stream_printf (surface->output,
 				 "%d 0 obj\r\n"
diff-tree ad43b7fe6bba3ba597b28b6f6668ee98cdc04a88 (from a60beb2eef46b03bcb81f5204dcde49cbc090928)
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Aug 28 20:35:23 2007 +0930

    PDF: Clean up comments

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index cfac9fb..6302d1b 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -69,9 +69,6 @@
  * - What if you create a similar surface and does show_page and then
  *   does show_surface on another surface?
  *
- * - Output TM so page scales to the right size - PDF default user
- *   space has 1 unit = 1 / 72 inch.
- *
  * - Add test case for RGBA images.
  *
  * - Add test case for RGBA gradients.
@@ -83,17 +80,19 @@
  * Page Structure of the Generated PDF:
  *
  * Each page requiring fallbacks images contains a knockout group at
- * the top level. The first operation of the knock group paints a
- * group containing all the supported drawing operations. Fallback images
- * (if any) are painted from the knockout group. This ensures that
- * fallback images do not composite with any content under the
+ * the top level. The first operation of the knockout group paints a
+ * group containing all the supported drawing operations. Fallback
+ * images (if any) are painted in the knockout group. This ensures
+ * that fallback images do not composite with any content under the
  * fallback images.
  *
  * The group containing the supported operations (content_group_list
  * in the example below) does not do any drawing directly. Instead it
  * paints groups containing the drawing operations and performs
  * clipping. The reason for this is that clipping operations performed
- * in a group does not affect the parent group.
+ * in a group do not affect the parent group.
+ *
+ * Example PDF Page Structure:
  *
  *   Page Content
  *   ------------
@@ -152,8 +151,9 @@
  *   Content Stream may be resumed.
  *
  *   The Content Stream contains the text and graphics operators. When
- *   a pattern is required the Content Stream is paused, the pattern
- *   is written to a PDF Stream, then the Content Stream is resumed.
+ *   a pattern is required the Content Stream is paused, a PDF Stream
+ *   is opened, the pattern is written to a PDF Stream, the PDF Stream
+ *   is closed, then the Content Stream is resumed.
  *
  *   Each group comprising the Content Stream is stored in memory
  *   until the stream is closed or the maximum group size is
diff-tree a60beb2eef46b03bcb81f5204dcde49cbc090928 (from 1a6b62e5995aac27527c37fd5cb6ec5e36a3f890)
Author: Adrian Johnson <ajohnson at redneon.com>
Date:   Tue Aug 28 20:34:55 2007 +0930

    Fix PDF regression with multipage documents

diff --git a/src/cairo-pdf-surface.c b/src/cairo-pdf-surface.c
index 8afd1c7..cfac9fb 100644
--- a/src/cairo-pdf-surface.c
+++ b/src/cairo-pdf-surface.c
@@ -219,6 +219,9 @@ static cairo_pdf_resource_t
 _cairo_pdf_surface_new_object (cairo_pdf_surface_t *surface);
 
 static void
+_cairo_pdf_group_element_array_finish (cairo_array_t *array);
+
+static void
 _cairo_pdf_surface_clear (cairo_pdf_surface_t *surface);
 
 static void
@@ -524,6 +527,10 @@ static void
 _cairo_pdf_surface_clear (cairo_pdf_surface_t *surface)
 {
     _cairo_array_truncate (&surface->streams, 0);
+    _cairo_pdf_group_element_array_finish (&surface->content_group);
+    _cairo_pdf_group_element_array_finish (&surface->knockout_group);
+    _cairo_array_truncate (&surface->content_group, 0);
+    _cairo_array_truncate (&surface->knockout_group, 0);
 }
 
 static void


More information about the cairo-commit mailing list