[cairo-commit] 2 commits - boilerplate/cairo-boilerplate-test-surfaces.c boilerplate/Makefile.win32 doc/public src/cairo.c src/cairo-gstate.c src/cairo.h src/cairoint.h src/cairo-paginated-surface.c src/cairo-surface.c src/cairo-svg-surface.c TODO
Vladimir Vukicevic
vladimir at kemper.freedesktop.org
Tue Sep 11 13:32:41 PDT 2007
TODO | 5 ----
boilerplate/Makefile.win32 | 4 +++
boilerplate/cairo-boilerplate-test-surfaces.c | 5 ----
doc/public/cairo-sections.txt | 3 ++
src/cairo-gstate.c | 4 +--
src/cairo-paginated-surface.c | 6 ++---
src/cairo-surface.c | 27 ++++++++++++++++++++++++--
src/cairo-svg-surface.c | 2 -
src/cairo.c | 6 +++++
src/cairo.h | 6 +++++
src/cairoint.h | 8 +------
11 files changed, 53 insertions(+), 23 deletions(-)
New commits:
diff-tree f2910ad3e9bfd279af7f9f43013489a32b5c1747 (from 9e975757a2820303d67e8497ab6cef9368237eb5)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Tue Sep 11 13:32:26 2007 -0700
Update cairo-sections.txt
diff --git a/doc/public/cairo-sections.txt b/doc/public/cairo-sections.txt
index 91c9f35..3bf8956 100644
--- a/doc/public/cairo-sections.txt
+++ b/doc/public/cairo-sections.txt
@@ -13,6 +13,7 @@ cairo_ft_scaled_font_unlock_face
<TITLE>Win32 Fonts</TITLE>
cairo_win32_font_face_create_for_logfontw
cairo_win32_font_face_create_for_hfont
+cairo_win32_font_face_create_for_logfontw_hfont
cairo_win32_scaled_font_select_font
cairo_win32_scaled_font_done_font
cairo_win32_scaled_font_get_metrics_factor
@@ -129,6 +130,8 @@ cairo_surface_get_type
cairo_surface_get_reference_count
cairo_surface_set_user_data
cairo_surface_get_user_data
+cairo_surface_copy_page
+cairo_surface_show_page
</SECTION>
<SECTION>
diff-tree 9e975757a2820303d67e8497ab6cef9368237eb5 (from 7dd05b7f86da6a465bb979c2ba955655ddcf66ed)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date: Tue Sep 11 13:30:35 2007 -0700
Export cairo_surface_{copy,show}_page
This patch adds cairo_surface_copy_page and cairo_surface_show_page
as public methods, leaving the previous cairo_show_page variants as
shorthands. copy_page/show_page are specific to the surface, not
to the context, so they need to be surface methods.
diff --git a/TODO b/TODO
index 6cb6d44..5574ecc 100644
--- a/TODO
+++ b/TODO
@@ -27,11 +27,6 @@ Changes that add new API (API changes/re
current path. We may also need to provide the coordinates of the
faces of every dash as well.
- ⢠cairo_surface_show_page() and cairo_surface_copy_page()
- how_page is a surface operation and should have been there instead of
- cairo_show_page() from the beginning. Same about copy_page().
- Implement the right API now.
-
⢠Polling API (cairo_get_serial and cairo_changed)
⢠cairo_save/restore_path()
diff --git a/boilerplate/Makefile.win32 b/boilerplate/Makefile.win32
index c746f6b..20027b0 100644
--- a/boilerplate/Makefile.win32
+++ b/boilerplate/Makefile.win32
@@ -7,6 +7,10 @@ CFLAGS += -I../src
SOURCES = \
cairo-boilerplate.c \
+ cairo-boilerplate-win32.c \
+ cairo-boilerplate-ps.c \
+ cairo-boilerplate-svg.c \
+ cairo-boilerplate-pdf.c \
xmalloc.c \
$(NULL)
diff --git a/boilerplate/cairo-boilerplate-test-surfaces.c b/boilerplate/cairo-boilerplate-test-surfaces.c
index 93ca5e7..667ed5b 100644
--- a/boilerplate/cairo-boilerplate-test-surfaces.c
+++ b/boilerplate/cairo-boilerplate-test-surfaces.c
@@ -121,10 +121,7 @@ _cairo_boilerplate_test_paginated_surfac
cairo_status_t status;
/* show page first. the automatic show_page is too late for us */
- /* XXX use cairo_surface_show_page() when that's added */
- cairo_t *cr = cairo_create (surface);
- cairo_show_page (cr);
- cairo_destroy (cr);
+ cairo_surface_show_page (surface);
tpc = cairo_surface_get_user_data (surface, &test_paginated_closure_key);
diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c
index cda40b1..4c27567 100644
--- a/src/cairo-gstate.c
+++ b/src/cairo-gstate.c
@@ -1086,13 +1086,13 @@ BAIL:
cairo_status_t
_cairo_gstate_copy_page (cairo_gstate_t *gstate)
{
- return _cairo_surface_copy_page (gstate->target);
+ return cairo_surface_copy_page (gstate->target);
}
cairo_status_t
_cairo_gstate_show_page (cairo_gstate_t *gstate)
{
- return _cairo_surface_show_page (gstate->target);
+ return cairo_surface_show_page (gstate->target);
}
static void
diff --git a/src/cairo-paginated-surface.c b/src/cairo-paginated-surface.c
index 85f00fa..e4f1762 100644
--- a/src/cairo-paginated-surface.c
+++ b/src/cairo-paginated-surface.c
@@ -376,14 +376,14 @@ _cairo_paginated_surface_copy_page (void
surface->page_num++;
/* XXX: It might make sense to add some suport here for calling
- * _cairo_surface_copy_page on the target surface. It would be an
+ * cairo_surface_copy_page on the target surface. It would be an
* optimization for the output, (so that PostScript could include
* copypage, for example), but the interaction with image
* fallbacks gets tricky. For now, we just let the target see a
* show_page and we implement the copying by simply not destroying
* the meta-surface. */
- return _cairo_surface_show_page (surface->target);
+ return cairo_surface_show_page (surface->target);
}
static cairo_int_status_t
@@ -400,7 +400,7 @@ _cairo_paginated_surface_show_page (void
if (status)
return status;
- status = _cairo_surface_show_page (surface->target);
+ status = cairo_surface_show_page (surface->target);
if (status)
return status;
diff --git a/src/cairo-surface.c b/src/cairo-surface.c
index d3f100d..2b6553f 100644
--- a/src/cairo-surface.c
+++ b/src/cairo-surface.c
@@ -1585,8 +1585,19 @@ _cairo_surface_composite_trapezoids (cai
traps, num_traps);
}
+/**
+ * cairo_surface_copy_page:
+ * @suface: a #cairo_surface_t
+ *
+ * Emits the current page for backends that support multiple pages,
+ * but doesn't clear it, so that the contents of the current page will
+ * be retained for the next page. Use cairo_surface_show_page() if you
+ * want to get an empty page after the emission.
+ *
+ * Since: 1.6
+ */
cairo_status_t
-_cairo_surface_copy_page (cairo_surface_t *surface)
+cairo_surface_copy_page (cairo_surface_t *surface)
{
assert (! surface->is_snapshot);
@@ -1602,9 +1613,20 @@ _cairo_surface_copy_page (cairo_surface_
return surface->backend->copy_page (surface);
}
+slim_hidden_def (cairo_surface_copy_page);
+
+/**
+ * cairo_surface_show_page:
+ * @surface: a #cairo_Surface_t
+ *
+ * Emits and clears the current page for backends that support multiple
+ * pages. Use cairo_surface_copy_page() if you don't want to clear the page.
+ *
+ * Since: 1.6
+ **/
cairo_status_t
-_cairo_surface_show_page (cairo_surface_t *surface)
+cairo_surface_show_page (cairo_surface_t *surface)
{
assert (! surface->is_snapshot);
@@ -1620,6 +1642,7 @@ _cairo_surface_show_page (cairo_surface_
return surface->backend->show_page (surface);
}
+slim_hidden_def (cairo_surface_show_page);
/**
* _cairo_surface_get_current_clip_serial:
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index eafec32..b4e9270 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -991,7 +991,7 @@ _cairo_svg_surface_emit_meta_surface (ca
return status;
}
- status = _cairo_surface_show_page (paginated_surface);
+ status = cairo_surface_show_page (paginated_surface);
if (status) {
cairo_surface_destroy (&meta->base);
return status;
diff --git a/src/cairo.c b/src/cairo.c
index f3c2f16..371a343 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -2107,6 +2107,9 @@ slim_hidden_def(cairo_fill_preserve);
* doesn't clear it, so, the contents of the current page will be retained
* for the next page too. Use cairo_show_page() if you want to get an
* empty page after the emission.
+ *
+ * This is a convenience function that simply calls
+ * cairo_surface_copy_page() on @cr's target.
**/
void
cairo_copy_page (cairo_t *cr)
@@ -2127,6 +2130,9 @@ cairo_copy_page (cairo_t *cr)
*
* Emits and clears the current page for backends that support multiple
* pages. Use cairo_copy_page() if you don't want to clear the page.
+ *
+ * This is a convenience function that simply calls
+ * cairo_surface_show_page() on @cr's target.
**/
void
cairo_show_page (cairo_t *cr)
diff --git a/src/cairo.h b/src/cairo.h
index 8c3718f..636c417 100644
--- a/src/cairo.h
+++ b/src/cairo.h
@@ -1535,6 +1535,12 @@ cairo_surface_set_fallback_resolution (c
double x_pixels_per_inch,
double y_pixels_per_inch);
+cairo_public cairo_status_t
+cairo_surface_copy_page (cairo_surface_t *surface);
+
+cairo_public cairo_status_t
+cairo_surface_show_page (cairo_surface_t *surface);
+
/* Image-surface functions */
/**
diff --git a/src/cairoint.h b/src/cairoint.h
index 58f2ea3..39cb025 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -1829,12 +1829,6 @@ _cairo_surface_composite_trapezoids (cai
int ntraps);
cairo_private cairo_status_t
-_cairo_surface_copy_page (cairo_surface_t *surface);
-
-cairo_private cairo_status_t
-_cairo_surface_show_page (cairo_surface_t *surface);
-
-cairo_private cairo_status_t
_cairo_surface_acquire_source_image (cairo_surface_t *surface,
cairo_image_surface_t **image_out,
void **image_extra);
@@ -2455,6 +2449,8 @@ slim_hidden_proto (cairo_surface_mark_di
slim_hidden_proto_no_warn (cairo_surface_reference);
slim_hidden_proto (cairo_surface_set_device_offset);
slim_hidden_proto (cairo_surface_set_fallback_resolution);
+slim_hidden_proto (cairo_surface_copy_page);
+slim_hidden_proto (cairo_surface_show_page);
slim_hidden_proto (cairo_surface_status);
slim_hidden_proto (cairo_version_string);
More information about the cairo-commit
mailing list