[cairo-commit] rendertest/src glitz.c, 1.5, 1.6 glitz_agl.c, 1.6, 1.7 glitz_common.h, 1.4, 1.5 glitz_glx.c, 1.6, 1.7 xcb.c, 1.6, 1.7

David Reveman commit at pdx.freedesktop.org
Tue Jan 25 12:33:39 PST 2005


Committed by: davidr

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

Modified Files:
	glitz.c glitz_agl.c glitz_common.h glitz_glx.c xcb.c 
Log Message:
Track changes to glitz and add xcb convolution filter support

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- glitz.c	3 Nov 2004 23:51:04 -0000	1.5
+++ glitz.c	25 Jan 2005 20:33:37 -0000	1.6
@@ -161,7 +161,7 @@
   similar->flags = 0;
 
   similar->surface = (glitz_surface_t *)
-    glitz_surface_create (drawable, format, width, height);
+    glitz_surface_create (drawable, format, width, height, 0, NULL);
   if (similar->surface == NULL) {
     free (similar);
     return NULL;
@@ -414,21 +414,22 @@
     glitz_buffer_t *buffer;
     glitz_drawable_t *drawable;
     glitz_geometry_format_t gf;
+    int count;
     
-    gf.mode = GLITZ_GEOMETRY_MODE_DIRECT;
-    gf.edge_hint = GLITZ_GEOMETRY_EDGE_HINT_SHARP;
-    gf.primitive = GLITZ_GEOMETRY_PRIMITIVE_QUADS;
-    gf.type = GLITZ_DATA_TYPE_FLOAT;
-    gf.first = 0;
-    gf.count = n_rects * 4;
+    gf.vertex.primitive = GLITZ_PRIMITIVE_QUADS;
+    gf.vertex.type = GLITZ_DATA_TYPE_FLOAT;
+    gf.vertex.bytes_per_vertex = sizeof (glitz_float_t) * 2;
+    gf.vertex.attributes = 0;
+
+    count = n_rects * 4;
 
     drawable =
       glitz_surface_get_drawable ((glitz_surface_t *) surface->surface);
 
     buffer =
-      glitz_geometry_buffer_create (drawable, NULL,
-                                    n_rects * 8 * sizeof (glitz_float_t),
-                                    GLITZ_BUFFER_HINT_STATIC_DRAW);
+      glitz_vertex_buffer_create (drawable, NULL,
+                                  n_rects * 8 * sizeof (glitz_float_t),
+                                  GLITZ_BUFFER_HINT_STATIC_DRAW);
     if (!buffer)
       return RENDER_STATUS_NO_MEMORY;
 
@@ -446,13 +447,15 @@
     glitz_buffer_unmap (buffer);
 
     glitz_set_geometry ((glitz_surface_t *) surface->surface,
-                        x_offset << 16, y_offset << 16,
+                        GLITZ_GEOMETRY_TYPE_VERTEX,
                         &gf, buffer);
+    glitz_set_array ((glitz_surface_t *) surface->surface,
+                     0, 2, count, x_offset << 16, y_offset << 16);
     
     glitz_buffer_destroy (buffer);
   } else
     glitz_set_geometry ((glitz_surface_t *) surface->surface,
-                        0, 0, NULL, NULL);
+                        GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL);
   
   return RENDER_STATUS_SUCCESS;
 }
@@ -469,33 +472,22 @@
     glitz_buffer_t *buffer;
     glitz_drawable_t *drawable;
     glitz_geometry_format_t gf;
+    int count;
 
-    if (GLITZ_SURFACE_INDIRECT (surface))
-      gf.mode = GLITZ_GEOMETRY_MODE_INDIRECT;
-    else
-      gf.mode = GLITZ_GEOMETRY_MODE_DIRECT;
+    gf.vertex.primitive = GLITZ_PRIMITIVE_QUADS;
+    gf.vertex.type = GLITZ_DATA_TYPE_FLOAT;
+    gf.vertex.bytes_per_vertex = sizeof (glitz_float_t) * 2;
+    gf.vertex.attributes = 0;
 
-    if (GLITZ_SURFACE_EDGE_FAST_SMOOTH (surface))
-      gf.edge_hint = GLITZ_GEOMETRY_EDGE_HINT_FAST_SMOOTH;
-    else if (GLITZ_SURFACE_EDGE_GOOD_SMOOTH (surface))
-      gf.edge_hint = GLITZ_GEOMETRY_EDGE_HINT_GOOD_SMOOTH;
-    else if (GLITZ_SURFACE_EDGE_BEST_SMOOTH (surface))
-      gf.edge_hint = GLITZ_GEOMETRY_EDGE_HINT_BEST_SMOOTH;
-    else
-      gf.edge_hint = GLITZ_GEOMETRY_EDGE_HINT_SHARP;
-    
-    gf.primitive = GLITZ_GEOMETRY_PRIMITIVE_QUADS;
-    gf.type = GLITZ_DATA_TYPE_FLOAT;
-    gf.first = 0;
-    gf.count = n_traps * 4;
+    count = n_traps * 4;
 
     drawable =
       glitz_surface_get_drawable ((glitz_surface_t *) surface->surface);
 
     buffer =
-      glitz_geometry_buffer_create (drawable, NULL,
-                                    n_traps * 8 * sizeof (glitz_float_t),
-                                    GLITZ_BUFFER_HINT_STATIC_DRAW);
+      glitz_vertex_buffer_create (drawable, NULL,
+                                  n_traps * 8 * sizeof (glitz_float_t),
+                                  GLITZ_BUFFER_HINT_STATIC_DRAW);
     if (!buffer)
       return RENDER_STATUS_NO_MEMORY;
 
@@ -513,13 +505,15 @@
     glitz_buffer_unmap (buffer);
     
     glitz_set_geometry ((glitz_surface_t *) surface->surface,
-                        x_offset << 16, y_offset << 16,
+                        GLITZ_GEOMETRY_TYPE_VERTEX,
                         &gf, buffer);
+    glitz_set_array ((glitz_surface_t *) surface->surface,
+                     0, 2, count, x_offset << 16, y_offset << 16);
     
     glitz_buffer_destroy (buffer);
   } else
     glitz_set_geometry ((glitz_surface_t *) surface->surface,
-                        0, 0, NULL, NULL);
+                        GLITZ_GEOMETRY_TYPE_NONE, NULL, NULL);
   
   return RENDER_STATUS_SUCCESS;
 }
@@ -540,7 +534,7 @@
     return NULL;
   }
 
-  surface = glitz_surface_create (drawable, format, width, height);
+  surface = glitz_surface_create (drawable, format, width, height, 0, NULL);
   if (!surface) {
     fprintf (stderr, "Error: couldn't create glitz surface\n");
     return NULL;

Index: glitz_agl.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_agl.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- glitz_agl.c	3 Nov 2004 23:51:04 -0000	1.6
+++ glitz_agl.c	25 Jan 2005 20:33:37 -0000	1.7
@@ -50,16 +50,12 @@
 };
 
 typedef struct agl_options {
-  int eh;
-  int indirect;
   int samples;
   int db;
 } agl_options_t;
 
 static const render_option_t _glx_options[] = {
   { "single-buffer", 'l', NULL, 0, "    use single buffered format" },
-  { "indirect", 'j', NULL, 0, "         use indirect clipping" },
-  { "edge-hint", 'e', "EDGEHINT", 0, "use this edge hint" },
   { "samples", 'p', "SAMPLES", 0, "   use this hardware multi-sample format" },
   { 0 }
 };
@@ -73,19 +69,6 @@
   case 'l':
     options->db = 0;
     break;
-  case 'j':
-    options->indirect = 1;
-    break;
-  case 'e':
-    if (strcasecmp (arg, "NONE") == 0)
-      options->eh = 0;
-    else if (strcasecmp (arg, "GOOD") == 0)
-      options->eh = 2;
-    else if (strcasecmp (arg, "BEST") == 0)
-      options->eh = 3;
-    else
-      options->eh = 1;
-    break;
   case 'p':
     options->samples = atoi (arg);
     break;
@@ -111,10 +94,8 @@
   Rect win_bounds;
   CFStringRef title;
 
-  options.eh = 1;
   options.samples = 1;
   options.db = 1;
-  options.indirect = 0;
   
   state.pointer = &options;
 
@@ -127,21 +108,6 @@
   surface.backend = &_glitz_agl_render_backend;
   surface.flags = 0;
 
-  if (options.indirect)
-    surface.flags |= RENDER_GLITZ_SURFACE_FLAG_INDIRECT_MASK;
-
-  switch (options.eh) {
-  case 1:
-    surface.flags |= RENDER_GLITZ_SURFACE_FLAG_EDGE_FAST_SMOOTH_MASK;
-    break;
-  case 2:
-    surface.flags |= RENDER_GLITZ_SURFACE_FLAG_EDGE_GOOD_SMOOTH_MASK;
-    break;
-  case 3:
-    surface.flags |= RENDER_GLITZ_SURFACE_FLAG_EDGE_BEST_SMOOTH_MASK;
-    break;
-  }
-
   x = y = 50;
   surface.width = RENDER_DEFAULT_DST_WIDTH;
   surface.height = RENDER_DEFAULT_DST_HEIGHT;

Index: glitz_common.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_common.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- glitz_common.h	3 Nov 2004 23:51:04 -0000	1.4
+++ glitz_common.h	25 Jan 2005 20:33:37 -0000	1.5
@@ -27,27 +27,11 @@
 
 #define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536)
 
-#define RENDER_GLITZ_SURFACE_FLAG_CLIP_MASK             (1L << 16)
-#define RENDER_GLITZ_SURFACE_FLAG_INDIRECT_MASK         (1L << 17)
-#define RENDER_GLITZ_SURFACE_FLAG_EDGE_FAST_SMOOTH_MASK (1L << 18)
-#define RENDER_GLITZ_SURFACE_FLAG_EDGE_GOOD_SMOOTH_MASK (1L << 19)
-#define RENDER_GLITZ_SURFACE_FLAG_EDGE_BEST_SMOOTH_MASK (1L << 20)
+#define RENDER_GLITZ_SURFACE_FLAG_CLIP_MASK (1L << 16)
 
 #define GLITZ_SURFACE_CLIP(surface) \
   ((surface)->flags & RENDER_GLITZ_SURFACE_FLAG_CLIP_MASK)
 
-#define GLITZ_SURFACE_INDIRECT(surface) \
-  ((surface)->flags & RENDER_GLITZ_SURFACE_FLAG_INDIRECT_MASK)
-
-#define GLITZ_SURFACE_EDGE_FAST_SMOOTH(surface) \
-  ((surface)->flags & RENDER_GLITZ_SURFACE_FLAG_EDGE_FAST_SMOOTH_MASK)
-
-#define GLITZ_SURFACE_EDGE_GOOD_SMOOTH(surface) \
-  ((surface)->flags & RENDER_GLITZ_SURFACE_FLAG_EDGE_GOOD_SMOOTH_MASK)
-
-#define GLITZ_SURFACE_EDGE_BEST_SMOOTH(surface) \
-  ((surface)->flags & RENDER_GLITZ_SURFACE_FLAG_EDGE_BEST_SMOOTH_MASK)
-
 render_surface_t *
 _glitz_render_create_similar (render_surface_t *other,
                               render_format_t format,

Index: glitz_glx.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_glx.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- glitz_glx.c	3 Nov 2004 23:51:04 -0000	1.6
+++ glitz_glx.c	25 Jan 2005 20:33:37 -0000	1.7
@@ -54,8 +54,6 @@
 typedef struct glx_options {
   char *display;
   char *geometry;
-  int eh;
-  int indirect;
   int samples;
   int db;
 } glx_options_t;
@@ -64,8 +62,6 @@
   { "display", 'd', "DISPLAY", 0, "   X display to use" },
   { "geometry", 'g', "GEOMETRY", 0, " X geometry specification" },
   { "single-buffer", 'l', NULL, 0, "    use single buffered format" },
-  { "indirect", 'j', NULL, 0, "         use indirect clipping" },
-  { "edge-hint", 'e', "EDGEHINT", 0, "use this edge hint" },
   { "samples", 'p', "SAMPLES", 0, "   use this hardware multi-sample format" },
   { 0 }
 };
@@ -85,19 +81,6 @@
   case 'l':
     options->db = 0;
     break;
-  case 'j':
-    options->indirect = 1;
-    break;
-  case 'e':
-    if (strcasecmp (arg, "NONE") == 0)
-      options->eh = 0;
-    else if (strcasecmp (arg, "GOOD") == 0)
-      options->eh = 2;
-    else if (strcasecmp (arg, "BEST") == 0)
-      options->eh = 3;
-    else
-      options->eh = 1;
-    break;
   case 'p':
     options->samples = atoi (arg);
     break;
@@ -128,10 +111,8 @@
 
   options.display = NULL;
   options.geometry = NULL;
-  options.eh = 1;
   options.samples = 1;
   options.db = 1;
-  options.indirect = 0;
   
   state.pointer = &options;
 
@@ -144,21 +125,6 @@
   surface.backend = &_glitz_glx_render_backend;
   surface.flags = 0;
 
-  if (options.indirect)
-    surface.flags |= RENDER_GLITZ_SURFACE_FLAG_INDIRECT_MASK;
-
-  switch (options.eh) {
-  case 1:
-    surface.flags |= RENDER_GLITZ_SURFACE_FLAG_EDGE_FAST_SMOOTH_MASK;
-    break;
-  case 2:
-    surface.flags |= RENDER_GLITZ_SURFACE_FLAG_EDGE_GOOD_SMOOTH_MASK;
-    break;
-  case 3:
-    surface.flags |= RENDER_GLITZ_SURFACE_FLAG_EDGE_BEST_SMOOTH_MASK;
-    break;
-  }
-
   if (options.geometry) {
     unsigned int width, height;
     

Index: xcb.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/xcb.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- xcb.c	3 Nov 2004 23:51:04 -0000	1.6
+++ xcb.c	25 Jan 2005 20:33:37 -0000	1.7
@@ -485,28 +485,67 @@
                         render_fixed16_16_t *params,
                         int n_params)
 {
-  char *render_filter;
+  char *render_filter = NULL;
   xcb_surface_t *s = (xcb_surface_t *) surface->surface;
-    
-  switch (filter) {
-  case RENDER_FILTER_NEAREST:
-    render_filter = "nearest";
-    break;
-  case RENDER_FILTER_BILINEAR:
-    render_filter = "bilinear";
-    break;
-  default:
-    return RENDER_STATUS_NOT_SUPPORTED;
-    break;
-  }
 
   if (XCB_RENDER_HAS_FILTERS (s))
-    XCBRenderSetPictureFilter (s->c, s->picture,
-                               strlen (render_filter), render_filter, 0, NULL);
-  else if (filter != RENDER_FILTER_NEAREST)
-    return RENDER_STATUS_NOT_SUPPORTED;
+  {
+    switch (filter) {
+    case RENDER_FILTER_NEAREST:
+      render_filter = "nearest";
+      break;
+    case RENDER_FILTER_BILINEAR:
+      render_filter = "bilinear";
+      break;
+    case RENDER_FILTER_CONVOLUTION:
+    {
+      XCBRenderQueryFiltersRep *reply;
+      XCBGenericError *e;
+      XCBSTRIter iter;
+      int len;
+      
+      reply =
+        XCBRenderQueryFiltersReply (s->c,
+                                    XCBRenderQueryFilters (s->c, s->drawable),
+                                    &e);
+          
+      iter = XCBRenderQueryFiltersFiltersIter (reply);
+      len = XCBRenderQueryFiltersFiltersLength (reply);
+      
+      while (iter.rem)
+      {
+        XCBSTR *str;
+        
+        str = iter.data;
+        if (XCBSTRNameLength (str))
+        {
+          if (strncmp ("convolution",
+                       XCBSTRName (str),
+                       XCBSTRNameLength (str)) == 0)
+          {
+            render_filter = "convolution";
+            break;
+          }
+        }
 
-  return RENDER_STATUS_SUCCESS;
+        XCBSTRNext (&iter);
+      }
+    } break;
+    default:
+      break;
+    }
+  }
+
+  if (render_filter)
+  {
+    XCBRenderSetPictureFilter (s->c, s->picture,
+                               strlen (render_filter), render_filter,
+                               n_params, (XCBRenderFIXED *) params);
+      
+    return RENDER_STATUS_SUCCESS;
+  }
+  
+  return RENDER_STATUS_NOT_SUPPORTED;
 }
 
 static render_status_t




More information about the cairo-commit mailing list