[cairo-commit] 2 commits - perf/cairo-perf.c perf/cairo-perf.h perf/Makefile.am perf/paint-with-alpha.c src/cairo.c

Carl Worth cworth at kemper.freedesktop.org
Wed Apr 25 07:25:00 PDT 2007


 perf/Makefile.am        |    1 +
 perf/cairo-perf.c       |    1 +
 perf/cairo-perf.h       |    1 +
 perf/paint-with-alpha.c |   45 +++++++++++++++++++++++++++++++++++++++++++++
 src/cairo.c             |    2 +-
 5 files changed, 49 insertions(+), 1 deletion(-)

New commits:
diff-tree 72b812be8c69108c46334841823a2e9103b69516 (from 302f1146da5b179e5016e2d523e891437c1a256b)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 23 09:35:35 2007 -0700

    perf: Add new paint-with-alpha test
    
    MacSlow noticed that cairo_paint_with_alpha is much slower than
    it should be, (and jrmuizel has a nice plan for fixing the
    performance bug).

diff --git a/perf/Makefile.am b/perf/Makefile.am
index 1f8e6fc..d5685bd 100644
--- a/perf/Makefile.am
+++ b/perf/Makefile.am
@@ -25,6 +25,7 @@ cairo_perf_SOURCES =		\
 	mosaic.c		\
 	mosaic.h		\
 	paint.c			\
+	paint-with-alpha.c	\
 	pattern_create_radial.c \
 	rectangles.c		\
 	stroke.c		\
diff --git a/perf/cairo-perf.c b/perf/cairo-perf.c
index 993345c..1363f89 100644
--- a/perf/cairo-perf.c
+++ b/perf/cairo-perf.c
@@ -383,6 +383,7 @@ main (int argc, char *argv[])
 
 cairo_perf_case_t perf_cases[] = {
     { paint,  256, 512},
+    { paint_with_alpha,  256, 512},
     { fill,   64, 256},
     { stroke, 64, 256},
     { text,   64, 256},
diff --git a/perf/cairo-perf.h b/perf/cairo-perf.h
index 1fef997..0a66f93 100644
--- a/perf/cairo-perf.h
+++ b/perf/cairo-perf.h
@@ -94,6 +94,7 @@ cairo_perf_cover_sources_and_operators (
 
 CAIRO_PERF_DECL (fill);
 CAIRO_PERF_DECL (paint);
+CAIRO_PERF_DECL (paint_with_alpha);
 CAIRO_PERF_DECL (stroke);
 CAIRO_PERF_DECL (subimage_copy);
 CAIRO_PERF_DECL (tessellate);
diff --git a/perf/paint-with-alpha.c b/perf/paint-with-alpha.c
new file mode 100644
index 0000000..d4d860e
--- /dev/null
+++ b/perf/paint-with-alpha.c
@@ -0,0 +1,45 @@
+/*
+ * Copyright © 2006 Red Hat, Inc.
+ *
+ * Permission to use, copy, modify, distribute, and sell this software
+ * and its documentation for any purpose is hereby granted without
+ * fee, provided that the above copyright notice appear in all copies
+ * and that both that copyright notice and this permission notice
+ * appear in supporting documentation, and that the name of
+ * Red Hat, Inc. not be used in advertising or publicity pertaining to
+ * distribution of the software without specific, written prior
+ * permission. Red Hat, Inc. makes no representations about the
+ * suitability of this software for any purpose.  It is provided "as
+ * is" without express or implied warranty.
+ *
+ * RED HAT, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL RED HAT, INC. BE LIABLE FOR ANY SPECIAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
+ * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * Author: Carl D. Worth <cworth at cworth.org>
+ */
+
+#include "cairo-perf.h"
+
+static cairo_perf_ticks_t
+do_paint_with_alpha (cairo_t *cr, int width, int height)
+{
+    cairo_perf_timer_start ();
+
+    cairo_paint_with_alpha (cr, 0.5);
+
+    cairo_perf_timer_stop ();
+
+    return cairo_perf_timer_elapsed ();
+}
+
+void
+paint_with_alpha (cairo_perf_t *perf, cairo_t *cr, int width, int height)
+{
+    cairo_perf_cover_sources_and_operators (perf, "paint-with-alpha",
+					    do_paint_with_alpha);
+}
diff-tree 302f1146da5b179e5016e2d523e891437c1a256b (from e37c9edac02ccd9fbcbc4622a2f421f4be0d597e)
Author: Carl Worth <cworth at cworth.org>
Date:   Mon Apr 23 09:26:32 2007 -0700

    Fix two bugs in documentation code sample of cairo_arc
    
    The sample code for drawing an ellipse had width and height
    reversed in the call to cairo_scale, and also had both
    incorrectly inverted.

diff --git a/src/cairo.c b/src/cairo.c
index abcdaff..621dea8 100644
--- a/src/cairo.c
+++ b/src/cairo.c
@@ -1545,7 +1545,7 @@ slim_hidden_def (cairo_curve_to);
  * <informalexample><programlisting>
  * cairo_save (cr);
  * cairo_translate (cr, x + width / 2., y + height / 2.);
- * cairo_scale (cr, 1. / (height / 2.), 1. / (width / 2.));
+ * cairo_scale (cr, width / 2., height / 2.);
  * cairo_arc (cr, 0., 0., 1., 0., 2 * M_PI);
  * cairo_restore (cr);
  * </programlisting></informalexample>


More information about the cairo-commit mailing list