[cairo-commit] 7 commits - perf/micro src/cairo-gl-surface.c src/cairo-mesh-pattern-rasterizer.c src/cairo-xml-surface.c test/any2ppm.c

Bryce Harrington bryce at kemper.freedesktop.org
Tue Feb 25 12:16:00 PST 2014


 perf/micro/hatching.c               |    4 ++--
 src/cairo-gl-surface.c              |    3 +++
 src/cairo-mesh-pattern-rasterizer.c |   10 +++++-----
 src/cairo-xml-surface.c             |    5 ++---
 test/any2ppm.c                      |    4 ++++
 5 files changed, 16 insertions(+), 10 deletions(-)

New commits:
commit 7b50883577df0949f793cc6dbfda281e96119dcd
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Wed Feb 19 11:25:16 2014 -0800

    gl: Handle PIXMAN_a8r8g8b8_sRGB format in switch
    
    Fixes the following compiler warning:
    
      cairo-gl-surface.c:182:5: warning: enumeration value
      ‘PIXMAN_a8r8g8b8_sRGB’ not handled in switch
    
    Same fix as done for image in 1d0055078.
    
    Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index b58c536..cfccf4d 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -261,6 +261,9 @@ _cairo_gl_get_image_format_and_type_gl (pixman_format_code_t pixman_format,
 	*type = GL_UNSIGNED_BYTE;
 	return TRUE;
 
+#if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,27,2)
+    case PIXMAN_a8r8g8b8_sRGB:
+#endif
     case PIXMAN_a2b10g10r10:
     case PIXMAN_x2b10g10r10:
     case PIXMAN_a4r4g4b4:
commit 44a09f462c8ff59f864967f45f9b31e473632b7a
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Tue Feb 18 21:13:53 2014 -0800

    mesh: Avoid theoretical infinite loops
    
    This quells this warning:
    
      src/cairo-mesh-pattern-rasterizer.c:731:5: warning: cannot
      optimize possibly infinite loops
    
    I guess the compiler's complaining because if vsteps were negative or
    equal to UINT_MAX the loop could cycle infinitely.  Silly compiler.
    
    Fix as suggested by Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-mesh-pattern-rasterizer.c b/src/cairo-mesh-pattern-rasterizer.c
index 6f0dd66..548e880 100644
--- a/src/cairo-mesh-pattern-rasterizer.c
+++ b/src/cairo-mesh-pattern-rasterizer.c
@@ -697,9 +697,9 @@ rasterize_bezier_patch (unsigned char *data, int width, int height, int stride,
 			cairo_point_double_t p[4][4], double col[4][4])
 {
     double pv[4][2][4], cstart[4], cend[4], dcstart[4], dcend[4];
-    int vsteps, v, i, k;
+    int v, i, k;
 
-    vsteps = 1 << vshift;
+    v = 1 << vshift;
 
     /*
      * pv[i][0] is the function (represented using forward
@@ -724,11 +724,11 @@ rasterize_bezier_patch (unsigned char *data, int width, int height, int stride,
     for (i = 0; i < 4; ++i) {
 	cstart[i]  = col[0][i];
 	cend[i]    = col[1][i];
-	dcstart[i] = (col[2][i] - col[0][i]) / vsteps;
-	dcend[i]   = (col[3][i] - col[1][i]) / vsteps;
+	dcstart[i] = (col[2][i] - col[0][i]) / v;
+	dcend[i]   = (col[3][i] - col[1][i]) / v;
     }
 
-    for (v = 0; v <= vsteps; ++v) {
+    while (v--) {
 	cairo_point_double_t nodes[4];
 	for (i = 0; i < 4; ++i) {
 	    nodes[i].x = pv[i][0][0];
commit 19f412bb1faa5391a03c121c31f7ad94fd275d82
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Tue Feb 18 21:01:07 2014 -0800

    xml: constify source objects for emit routines
    
    This quells the following warnings:
    
      src/cairo-xml-surface.c:576:5: warning: passing argument 2 of
      ‘_cairo_xml_surface_emit_clip_boxes’ discards ‘const’ qualifier from
      pointer target type
      src/cairo-xml-surface.c:462:1: note: expected ‘struct cairo_clip_t
      *’ but argument is of type ‘const struct cairo_clip_t *’
    
    Most of the cairo_xml*emit* routines const their source objects;
    these should follow suit.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xml-surface.c b/src/cairo-xml-surface.c
index ef03930..6dbafdb 100644
--- a/src/cairo-xml-surface.c
+++ b/src/cairo-xml-surface.c
@@ -460,7 +460,7 @@ to_xml (cairo_xml_surface_t *surface)
 
 static cairo_status_t
 _cairo_xml_surface_emit_clip_boxes (cairo_xml_surface_t *surface,
-				    cairo_clip_t *clip)
+				    const cairo_clip_t *clip)
 {
     cairo_box_t *box;
     cairo_xml_t *xml;
@@ -520,7 +520,7 @@ _cairo_xml_surface_emit_clip_boxes (cairo_xml_surface_t *surface,
 
 static cairo_status_t
 _cairo_xml_surface_emit_clip_path (cairo_xml_surface_t *surface,
-				   cairo_clip_path_t *clip_path)
+				   const cairo_clip_path_t *clip_path)
 {
     cairo_box_t box;
     cairo_status_t status;
commit dc8ca191f584f837f4c2b70d0ebbe2c9d87575cf
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Tue Feb 18 20:56:09 2014 -0800

    xml: Drop unused variable
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/src/cairo-xml-surface.c b/src/cairo-xml-surface.c
index c9473c2..ef03930 100644
--- a/src/cairo-xml-surface.c
+++ b/src/cairo-xml-surface.c
@@ -463,7 +463,6 @@ _cairo_xml_surface_emit_clip_boxes (cairo_xml_surface_t *surface,
 				    cairo_clip_t *clip)
 {
     cairo_box_t *box;
-    cairo_status_t status;
     cairo_xml_t *xml;
     int n;
 
commit 9b8a752249c69ba94461b3ef6d919c1b86ae6fab
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Tue Feb 18 20:13:57 2014 -0800

    test: Quell warning for deprecated g_type_init()
    
    The g_type_init() routine was deprecated in glib 2.34.  Tested and
    verified this conditionalization on glib 2.32 and 2.36.  No need to
    change version dependencies.
    
      test/any2ppm.c:864:5: warning: ‘g_type_init’ is deprecated
      (declared at /usr/include/glib-2.0/gobject/gtype.h:669)
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/any2ppm.c b/test/any2ppm.c
index af2a43e..b125496 100644
--- a/test/any2ppm.c
+++ b/test/any2ppm.c
@@ -863,8 +863,10 @@ main (int argc, char **argv)
     const char *err;
 
 #if CAIRO_CAN_TEST_PDF_SURFACE || CAIRO_CAN_TEST_SVG_SURFACE
+#if GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION <= 34
     g_type_init ();
 #endif
+#endif
 
 #if CAIRO_CAN_TEST_SVG_SURFACE
     rsvg_set_default_dpi (72.0);
commit 75e671c29b2f2916c41af46f8c3707539b235674
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Tue Feb 18 18:10:20 2014 -0800

    test: Quell warning for inclusion of old rsvg header files
    
    This silences a warning due to header file deprecated as of libsrvg
    2.36.2.  Tested and verified this hackaround on librsvg 2.36.4 and
    2.36.1.  No need to change version dependencies.
    
      In file included from test/any2ppm.c:73:0:
      /usr/include/librsvg-2.0/librsvg/rsvg-cairo.h:27:2: warning:
      #warning "Including <librsvg/rsvg-cairo.h> directly is deprecated."
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/test/any2ppm.c b/test/any2ppm.c
index e698e57..af2a43e 100644
--- a/test/any2ppm.c
+++ b/test/any2ppm.c
@@ -70,8 +70,10 @@
 
 #if CAIRO_CAN_TEST_SVG_SURFACE
 #include <librsvg/rsvg.h>
+#ifndef RSVG_CAIRO_H
 #include <librsvg/rsvg-cairo.h>
 #endif
+#endif
 
 #if CAIRO_HAS_SPECTRE
 #include <libspectre/spectre.h>
commit a346e40ed33e69c7c03be3aa1b7b0065e4ee1d07
Author: Bryce Harrington <b.harrington at samsung.com>
Date:   Tue Feb 18 17:37:22 2014 -0800

    perf: Guarantee path width is non-negative
    
    This quells the following warning:
    
      perf/micro/hatching.c:39:5: warning: cannot optimize loop, the
      loop counter may overflow
    
    Width and height aren't going to be negative so enforce it so that the
    compiler can do whatever optimization it wants to do.
    
    Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>

diff --git a/perf/micro/hatching.c b/perf/micro/hatching.c
index b51acec..996bda6 100644
--- a/perf/micro/hatching.c
+++ b/perf/micro/hatching.c
@@ -32,9 +32,9 @@
 #define WIDTH	100
 #define HEIGHT	100
 
-static void path (cairo_t *cr, int width, int height)
+static void path (cairo_t *cr, unsigned int width, unsigned int height)
 {
-    int i;
+    unsigned int i;
 
     for (i = 0; i < width+1; i += STEP) {
 	cairo_rectangle (cr, i-1, -1, 2, height+2);


More information about the cairo-commit mailing list