[cairo-commit] rendertest/src Makefile.am, 1.2, 1.3 args.c, 1.2, 1.3 glitz.c, 1.2, 1.3 glitz_agl.c, 1.2, 1.3 glitz_common.h, 1.2, 1.3 glitz_glx.c, 1.2, 1.3 images.h, 1.2, 1.3 rects.h, NONE, 1.1 rendertest.c, 1.2, 1.3 rendertest.h, 1.2, 1.3 traps.h, 1.1, 1.2 xcb.c, 1.2, 1.3

David Reveman commit at pdx.freedesktop.org
Fri Sep 3 07:29:28 PDT 2004


Committed by: davidr

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

Modified Files:
	Makefile.am args.c glitz.c glitz_agl.c glitz_common.h 
	glitz_glx.c images.h rendertest.c rendertest.h traps.h xcb.c 
Added Files:
	rects.h 
Log Message:
Tracking changes to glitz

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/rendertest/src/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile.am	18 Aug 2004 12:49:30 -0000	1.2
--- Makefile.am	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 5,8 ****
--- 5,9 ----
  	rendertest.h \
  	images.h \
+ 	rects.h \
  	traps.h
  

Index: args.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/args.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** args.c	18 Aug 2004 12:49:30 -0000	1.2
--- args.c	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 43,46 ****
--- 43,47 ----
  
  static const render_option_t _options[] = {
+   { "clip",        'c', "CLIP", 0, "         use this clip primitive" },
    { "interactive", 'i', NULL,   0, "      prompt before all tests" },
    { "npot",        'n', NULL,   0,
***************
*** 139,146 ****
--- 140,161 ----
  }
  
+ static render_clip_t
+ _render_clip (char *clip)
+ {
+   if (strcasecmp (clip, "RECTS") == 0)
+     return RENDER_CLIP_RECTANGLES;
+   else if (strcasecmp (clip, "TRAPS") == 0)
+     return RENDER_CLIP_TRAPEZOIDS;
+   else
+     return RENDER_CLIP_NONE;
+ }
+ 
  static int
  _parse_option (int key, char *arg, render_int_arg_state_t *s)
  {
    switch (key) {
+   case 'c':
+     s->state->settings.clip = _render_clip (arg);
+     break;
    case 'i':
      s->state->settings.interactive = 1;
***************
*** 264,267 ****
--- 279,283 ----
    state->settings.last_test = 65535;
    state->settings.time = 0;
+   state->settings.clip = RENDER_CLIP_NONE;
  
    for (i = 1; i < argc; i++) {

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz.c	18 Aug 2004 12:49:30 -0000	1.2
--- glitz.c	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 106,118 ****
  {
    switch (fill) {
!   case RENDER_FILL_NEAREST:
!     return GLITZ_FILL_NEAREST;
    case RENDER_FILL_REPEAT:
      return GLITZ_FILL_REPEAT;
    case RENDER_FILL_REFLECT:
      return GLITZ_FILL_REFLECT;
    case RENDER_FILL_NONE:
    default:
!     return GLITZ_FILL_CLIP;
    }
  }
--- 106,119 ----
  {
    switch (fill) {
!   case RENDER_FILL_TRANSPARENT:
!     return GLITZ_FILL_TRANSPARENT;
    case RENDER_FILL_REPEAT:
      return GLITZ_FILL_REPEAT;
    case RENDER_FILL_REFLECT:
      return GLITZ_FILL_REFLECT;
+   case RENDER_FILL_NEAREST:
    case RENDER_FILL_NONE:
    default:
!     return GLITZ_FILL_NEAREST;
    }
  }
***************
*** 160,167 ****
    if (similar == NULL)
      return NULL;
!   
    similar->width = width;
    similar->height = height;
    similar->backend = other->backend;
  
    similar->surface = (glitz_surface_t *)
--- 161,169 ----
    if (similar == NULL)
      return NULL;
! 
    similar->width = width;
    similar->height = height;
    similar->backend = other->backend;
+   similar->flags = 0;
  
    similar->surface = (glitz_surface_t *)
***************
*** 183,186 ****
--- 185,191 ----
  }
  
+ #define MIN(a,b) ((a) < (b) ? (a) : (b))
+ #define MAX(a,b) ((a) > (b) ? (a) : (b))
+ 
  render_status_t
  _glitz_render_composite (render_operator_t op,
***************
*** 198,201 ****
--- 203,244 ----
  {
    glitz_status_t status;
+ 
+   if (GLITZ_SURFACE_CLIP (src)) {
+     if (x_src < 0) {
+       x_dst -= x_src;
+       x_mask -= x_src;
+       width += x_src;
+       x_src = 0;
+     }
+ 
+     if (y_src < 0) {
+       y_dst -= y_src;
+       y_mask -= y_src;
+       height += y_src;
+       y_src = 0;
+     }
+ 
+     width = MIN (src->width - x_src, width);
+     height = MIN (src->height - y_src, height);
+   }
+ 
+   if (mask && GLITZ_SURFACE_CLIP (mask)) {
+     if (x_mask < 0) {
+       x_dst -= x_mask;
+       x_src -= x_mask;
+       width += x_mask;
+       x_mask = 0;
+     }
+ 
+     if (y_mask < 0) {
+       y_dst -= y_mask;
+       y_src -= y_mask;
+       height += y_mask;
+       y_mask = 0;
+     }
+ 
+     width = MIN (mask->width - x_mask, width);
+     height = MIN (mask->height - y_mask, height);
+   }
    
    glitz_composite (_glitz_operator (op),
***************
*** 218,223 ****
  }
  
  render_status_t
! _glitz_render_put_pixels (render_surface_t *dst,
                            render_format_t format,
                            unsigned char *data)
--- 261,269 ----
  }
  
+ #undef MIN
+ #undef MAX
+ 
  render_status_t
! _glitz_render_set_pixels (render_surface_t *dst,
                            render_format_t format,
                            unsigned char *data)
***************
*** 225,229 ****
    glitz_status_t status;
  
!   glitz_pixel_buffer_t *buffer;
    glitz_pixel_format_t pf;
  
--- 271,275 ----
    glitz_status_t status;
  
!   glitz_buffer_t *buffer;
    glitz_pixel_format_t pf;
  
***************
*** 265,276 ****
    pf.bytes_per_line = (((dst->width * pf.masks.bpp) / 8) + 3) & -4;
    
!   buffer = glitz_pixel_buffer_create_for_data ((char *) data, &pf);
    
!   glitz_put_pixels ((glitz_surface_t *) dst->surface,
  		    0, 0, 
  		    dst->width, dst->height,
  		    buffer);
  
!   glitz_pixel_buffer_destroy (buffer);
    
    status = glitz_surface_get_status ((glitz_surface_t *) dst->surface);
--- 311,326 ----
    pf.bytes_per_line = (((dst->width * pf.masks.bpp) / 8) + 3) & -4;
    
!   buffer = glitz_pixel_buffer_create (dst->surface,
!                                       data,
!                                       pf.bytes_per_line * dst->height,
!                                       GLITZ_BUFFER_HINT_STREAM_DRAW);
    
!   glitz_set_pixels ((glitz_surface_t *) dst->surface,
  		    0, 0, 
  		    dst->width, dst->height,
+                     &pf,
  		    buffer);
  
!   glitz_buffer_destroy (buffer);
    
    status = glitz_surface_get_status ((glitz_surface_t *) dst->surface);
***************
*** 291,294 ****
--- 341,349 ----
                          render_fill_t fill)
  {
+   if (fill == RENDER_FILL_NONE)
+     surface->flags |= RENDER_GLITZ_SURFACE_FLAG_CLIP_MASK;
+   else
+     surface->flags &= ~RENDER_GLITZ_SURFACE_FLAG_CLIP_MASK;
+       
    glitz_surface_set_fill ((glitz_surface_t *) surface->surface,
                            _glitz_fill (fill));
***************
*** 345,415 ****
  
  render_status_t
! _glitz_render_fill_rectangle (render_operator_t op,
!                               render_surface_t *dst,
!                               const render_color_t *color,
!                               int x,
!                               int y,
!                               unsigned int width,
!                               unsigned int height)
  {
!   glitz_status_t status;
  
!   glitz_fill_rectangle (_glitz_operator (op),
!                         (glitz_surface_t *) dst->surface,
!                         (glitz_color_t *) color,
!                         x, y, width, height);
!   
!   status = glitz_surface_get_status ((glitz_surface_t *) dst->surface);
!   while (glitz_surface_get_status ((glitz_surface_t *) dst->surface));
!   
!   return _glitz_status (status);
! }
  
! render_status_t
! _glitz_render_add_traps (render_surface_t *dst,
!                          int x_offset,
!                          int y_offset,
!                          render_trapezoid_t *traps,
!                          int n_traps)
! {
!   glitz_status_t status;
  
!   glitz_add_trapezoids ((glitz_surface_t *) dst->surface,
                          x_offset, y_offset,
!                         (glitz_trapezoid_t *) traps,
!                         n_traps);
!   
!   status = glitz_surface_get_status ((glitz_surface_t *) dst->surface);
!   while (glitz_surface_get_status ((glitz_surface_t *) dst->surface));
    
!   return _glitz_status (status);
  }
  
  render_status_t
! _glitz_render_composite_traps (render_operator_t op,
!                                render_surface_t *dst,
!                                render_surface_t *src,
!                                int x_src,
!                                int y_src,
!                                int x_offset,
!                                int y_offset,
!                                unsigned short opacity,
!                                render_trapezoid_t *traps,
!                                int n_traps)
  {
!   glitz_status_t status;
  
!   glitz_composite_trapezoids (_glitz_operator (op),
!                               (glitz_surface_t *) dst->surface,
!                               (glitz_surface_t *) src->surface,
!                               x_src, y_src,
!                               x_offset, y_offset,
!                               opacity,
!                               (glitz_trapezoid_t *) traps,
!                               n_traps);
!   
!   status = glitz_surface_get_status ((glitz_surface_t *) dst->surface);
!   while (glitz_surface_get_status ((glitz_surface_t *) dst->surface));
    
!   return _glitz_status (status);
  }
--- 400,515 ----
  
  render_status_t
! _glitz_render_set_clip_rectangles (render_surface_t *surface,
!                                    int x_offset,
!                                    int y_offset,
!                                    render_rectangle_t *rects,
!                                    int n_rects)
  {
!   if (n_rects > 0) {
!     glitz_float_t *data;
!     glitz_buffer_t *buffer;
!     glitz_geometry_format_t gf;
!     
!     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;
  
!     buffer =
!       glitz_geometry_buffer_create ((glitz_surface_t *) surface->surface, NULL,
!                                     n_rects * 8 * sizeof (glitz_float_t),
!                                     GLITZ_BUFFER_HINT_STATIC_DRAW);
!     if (!buffer)
!       return RENDER_STATUS_NO_MEMORY;
  
!     do {
!       data = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
!       for (; n_rects; rects++, n_rects--) {
!         *data++ = (glitz_float_t) rects->x;
!         *data++ = (glitz_float_t) rects->y;
!         *data++ = (glitz_float_t) (rects->x + rects->width);
!         *data++ = (glitz_float_t) rects->y;
!         *data++ = (glitz_float_t) (rects->x + rects->width);
!         *data++ = (glitz_float_t) (rects->y + rects->height);
!         *data++ = (glitz_float_t) rects->x;
!         *data++ = (glitz_float_t) (rects->y + rects->height);
!       }
!     } while (glitz_buffer_unmap (buffer));
  
!     glitz_set_geometry ((glitz_surface_t *) surface->surface,
                          x_offset, y_offset,
!                         &gf, buffer);
!     
!     glitz_buffer_destroy (buffer);
!   } else
!     glitz_set_geometry ((glitz_surface_t *) surface->surface,
!                         0, 0, NULL, NULL);
    
!   return RENDER_STATUS_SUCCESS;
  }
  
  render_status_t
! _glitz_render_set_clip_trapezoids (render_surface_t *surface,
!                                    int x_offset,
!                                    int y_offset,
!                                    render_trapezoid_t *traps,
!                                    int n_traps)
  {
!   if (n_traps > 0) {
!     glitz_float_t *data;
!     glitz_buffer_t *buffer;
!     glitz_geometry_format_t gf;
  
!     if (GLITZ_SURFACE_INDIRECT (surface))
!       gf.mode = GLITZ_GEOMETRY_MODE_INDIRECT;
!     else
!       gf.mode = GLITZ_GEOMETRY_MODE_DIRECT;
! 
!     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;
! 
!     buffer =
!       glitz_geometry_buffer_create ((glitz_surface_t *) surface->surface, NULL,
!                                     n_traps * 8 * sizeof (glitz_float_t),
!                                     GLITZ_BUFFER_HINT_STATIC_DRAW);
!     if (!buffer)
!       return RENDER_STATUS_NO_MEMORY;
! 
!     do {
!       data = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
!       for (; n_traps; traps++, n_traps--) {
!         *data++ = FIXED_TO_FLOAT (traps->top.left);
!         *data++ = FIXED_TO_FLOAT (traps->top.y);
!         *data++ = FIXED_TO_FLOAT (traps->top.right);
!         *data++ = FIXED_TO_FLOAT (traps->top.y);
!         *data++ = FIXED_TO_FLOAT (traps->bottom.right);
!         *data++ = FIXED_TO_FLOAT (traps->bottom.y);
!         *data++ = FIXED_TO_FLOAT (traps->bottom.left);
!         *data++ = FIXED_TO_FLOAT (traps->bottom.y);
!       }
!     } while (glitz_buffer_unmap (buffer));
!     
!     glitz_set_geometry ((glitz_surface_t *) surface->surface,
!                         x_offset, y_offset,
!                         &gf, buffer);
!     
!     glitz_buffer_destroy (buffer);
!   } else
!     glitz_set_geometry ((glitz_surface_t *) surface->surface,
!                         0, 0, NULL, NULL);
    
!   return RENDER_STATUS_SUCCESS;
  }

Index: glitz_agl.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_agl.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_agl.c	18 Aug 2004 12:49:30 -0000	1.2
--- glitz_agl.c	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 40,44 ****
    _glitz_render_destroy,
    _glitz_render_composite,
!   _glitz_render_put_pixels,
    _glitz_render_show,
    _glitz_render_set_fill,
--- 40,44 ----
    _glitz_render_destroy,
    _glitz_render_composite,
!   _glitz_render_set_pixels,
    _glitz_render_show,
    _glitz_render_set_fill,
***************
*** 46,56 ****
    _glitz_render_set_transform,
    _glitz_render_set_filter,
!   _glitz_render_fill_rectangle,
!   _glitz_render_add_traps,
!   _glitz_render_composite_traps
  };
  
  typedef struct agl_options {
!   int aa;
    int samples;
    int db;
--- 46,56 ----
    _glitz_render_set_transform,
    _glitz_render_set_filter,
!   _glitz_render_set_clip_rectangles,
!   _glitz_render_set_clip_trapezoids
  };
  
  typedef struct agl_options {
!   int eh;
!   int indirect;
    int samples;
    int db;
***************
*** 59,66 ****
  static const render_option_t _glx_options[] = {
    { "single-buffer", 'l', NULL, 0, "    use single buffered format" },
!   { "anti-aliasing", 'a', "TYPE", 0, "use this type of anti-aliasing: "
!     "SW, HW or NONE" },
!   { "samples", 'p', "SAMPLES", 0, "   number of samples used with "
!     "multi-sampling" },
    { 0 }
  };
--- 59,65 ----
  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 }
  };
***************
*** 75,85 ****
      options->db = 0;
      break;
!   case 'a':
!     if (strcasecmp (arg, "HW") == 0)
!       options->aa = 2;
!     else if (strcasecmp (arg, "NONE") == 0)
!       options->aa = 0;
      else
!       options->aa = 1;
      break;
    case 'p':
--- 74,89 ----
      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':
***************
*** 107,113 ****
    CFStringRef title;
  
!   options.aa = 1;
!   options.samples = 4;
    options.db = 1;
    
    state.pointer = &options;
--- 111,118 ----
    CFStringRef title;
  
!   options.eh = 1;
!   options.samples = 1;
    options.db = 1;
+   options.indirect = 0;
    
    state.pointer = &options;
***************
*** 120,123 ****
--- 125,144 ----
      
    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;
***************
*** 145,149 ****
    mask = GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
  
!   if (options.aa == 2) {
      templ.multisample.supported = 1;
      templ.multisample.samples = options.samples;
--- 166,170 ----
    mask = GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
  
!   if (options.samples > 1) {
      templ.multisample.supported = 1;
      templ.multisample.samples = options.samples;
***************
*** 175,199 ****
    }
  
-   if (options.aa == 1) {
-     glitz_surface_set_polyedge (surface.surface, GLITZ_POLYEDGE_SMOOTH);
-     if (options.samples == 2) {
-       glitz_surface_set_polyedge_smooth_hint (surface.surface,
-                                               GLITZ_POLYEDGE_SMOOTH_HINT_FAST);
-     } else if (options.samples == 4) {
-       glitz_surface_set_polyedge_smooth_hint (surface.surface,
-                                               GLITZ_POLYEDGE_SMOOTH_HINT_GOOD);
-     } else if (options.samples == 8) {
-       glitz_surface_set_polyedge_smooth_hint (surface.surface,
-                                               GLITZ_POLYEDGE_SMOOTH_HINT_BEST);
-     } else {
-       fprintf (stderr, "Error: %d samples software multi-sampling not "
-                "supported\n", options.samples);
-       return 1;
-     }
-   } else if (options.aa == 2) {
-     glitz_surface_set_polyedge (surface.surface, GLITZ_POLYEDGE_SMOOTH);
-   } else
-     glitz_surface_set_polyedge (surface.surface, GLITZ_POLYEDGE_SHARP);
-   
    ShowWindow (win);
  
--- 196,199 ----

Index: glitz_common.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_common.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_common.h	18 Aug 2004 12:49:30 -0000	1.2
--- glitz_common.h	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 24,27 ****
--- 24,52 ----
   */
  
+ #include <glitz.h>
+ 
+ #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 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,
***************
*** 48,52 ****
  
  render_status_t
! _glitz_render_put_pixels (render_surface_t *dst,
                            render_format_t format,
                            unsigned char *data);
--- 73,77 ----
  
  render_status_t
! _glitz_render_set_pixels (render_surface_t *dst,
                            render_format_t format,
                            unsigned char *data);
***************
*** 74,101 ****
  
  render_status_t
! _glitz_render_fill_rectangle (render_operator_t op,
!                               render_surface_t *dst,
!                               const render_color_t *color,
!                               int x,
!                               int y,
!                               unsigned int width,
!                               unsigned int height);
!                          
! render_status_t
! _glitz_render_add_traps (render_surface_t *dst,
!                          int x_offset,
!                          int y_offset,
!                          render_trapezoid_t *traps,
!                          int n_traps);
  
  render_status_t
! _glitz_render_composite_traps (render_operator_t op,
!                                render_surface_t *dst,
!                                render_surface_t *src,
!                                int x_src,
!                                int y_src,
!                                int x_offset,
!                                int y_offset,
!                                unsigned short opacity,
!                                render_trapezoid_t *traps,
!                                int n_traps);
--- 99,112 ----
  
  render_status_t
! _glitz_render_set_clip_rectangles (render_surface_t *surface,
!                                    int x_offset,
!                                    int y_offset,
!                                    render_rectangle_t *rects,
!                                    int n_rects);
  
  render_status_t
! _glitz_render_set_clip_trapezoids (render_surface_t *surface,
!                                    int x_offset,
!                                    int y_offset,
!                                    render_trapezoid_t *traps,
!                                    int n_traps);

Index: glitz_glx.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/glitz_glx.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_glx.c	18 Aug 2004 12:49:30 -0000	1.2
--- glitz_glx.c	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 42,46 ****
    _glitz_render_destroy,
    _glitz_render_composite,
!   _glitz_render_put_pixels,
    _glitz_render_show,
    _glitz_render_set_fill,
--- 42,46 ----
    _glitz_render_destroy,
    _glitz_render_composite,
!   _glitz_render_set_pixels,
    _glitz_render_show,
    _glitz_render_set_fill,
***************
*** 48,54 ****
    _glitz_render_set_transform,
    _glitz_render_set_filter,
!   _glitz_render_fill_rectangle,
!   _glitz_render_add_traps,
!   _glitz_render_composite_traps
  };
  
--- 48,53 ----
    _glitz_render_set_transform,
    _glitz_render_set_filter,
!   _glitz_render_set_clip_rectangles,
!   _glitz_render_set_clip_trapezoids
  };
  
***************
*** 56,60 ****
    char *display;
    char *geometry;
!   int aa;
    int samples;
    int db;
--- 55,60 ----
    char *display;
    char *geometry;
!   int eh;
!   int indirect;
    int samples;
    int db;
***************
*** 65,72 ****
    { "geometry", 'g', "GEOMETRY", 0, " X geometry specification" },
    { "single-buffer", 'l', NULL, 0, "    use single buffered format" },
!   { "anti-aliasing", 'a', "TYPE", 0, "use this type of anti-aliasing: "
!     "SW, HW or NONE" },
!   { "samples", 'p', "SAMPLES", 0, "   number of samples used with "
!     "multi-sampling" },
    { 0 }
  };
--- 65,71 ----
    { "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 }
  };
***************
*** 87,97 ****
      options->db = 0;
      break;
!   case 'a':
!     if (strcasecmp (arg, "HW") == 0)
!       options->aa = 2;
!     else if (strcasecmp (arg, "NONE") == 0)
!       options->aa = 0;
      else
!       options->aa = 1;
      break;
    case 'p':
--- 86,101 ----
      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':
***************
*** 124,130 ****
    options.display = NULL;
    options.geometry = NULL;
!   options.aa = 1;
!   options.samples = 4;
    options.db = 1;
    
    state.pointer = &options;
--- 128,135 ----
    options.display = NULL;
    options.geometry = NULL;
!   options.eh = 1;
!   options.samples = 1;
    options.db = 1;
+   options.indirect = 0;
    
    state.pointer = &options;
***************
*** 137,140 ****
--- 142,161 ----
      
    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) {
***************
*** 161,165 ****
    mask = GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
  
!   if (options.aa == 2) {
      templ.multisample.supported = 1;
      templ.multisample.samples = options.samples;
--- 182,186 ----
    mask = GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
  
!   if (options.samples > 1) {
      templ.multisample.supported = 1;
      templ.multisample.samples = options.samples;
***************
*** 208,232 ****
      return 1;
    }
- 
-   if (options.aa == 1) {
-     glitz_surface_set_polyedge (surface.surface, GLITZ_POLYEDGE_SMOOTH);
-     if (options.samples == 2) {
-       glitz_surface_set_polyedge_smooth_hint (surface.surface,
-                                               GLITZ_POLYEDGE_SMOOTH_HINT_FAST);
-     } else if (options.samples == 4) {
-       glitz_surface_set_polyedge_smooth_hint (surface.surface,
-                                               GLITZ_POLYEDGE_SMOOTH_HINT_GOOD);
-     } else if (options.samples == 8) {
-       glitz_surface_set_polyedge_smooth_hint (surface.surface,
-                                               GLITZ_POLYEDGE_SMOOTH_HINT_BEST);
-     } else {
-       fprintf (stderr, "Error: %d samples software multi-sampling not "
-                "supported\n", options.samples);
-       return 1;
-     }
-   } else if (options.aa == 2) {
-     glitz_surface_set_polyedge (surface.surface, GLITZ_POLYEDGE_SMOOTH);
-   } else
-     glitz_surface_set_polyedge (surface.surface, GLITZ_POLYEDGE_SHARP);
    
    XSelectInput (display, win, ExposureMask);
--- 229,232 ----

Index: images.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/images.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** images.h	18 Aug 2004 12:49:30 -0000	1.2
--- images.h	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 1011,3463 ****
  unsigned char logo_png[] = {
    0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00,
!   0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x01, 0x0e,
!   0x00, 0x00, 0x00, 0x64, 0x08, 0x06, 0x00, 0x00, 0x00, 0x77,
!   0xa9, 0xde, 0x2d, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4b, 0x47,
    0x44, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0xa0, 0xbd, 0xa7,
    0x93, 0x00, 0x00, 0x20, 0x00, 0x49, 0x44, 0x41, 0x54, 0x78,
!   0x9c, 0xed, 0x9d, 0x77, 0x7c, 0x1c, 0xd5, 0xb9, 0xf7, 0x9f,
!   0x99, 0xdd, 0x9d, 0x99, 0xed, 0x4d, 0xab, 0x5d, 0xf5, 0x62,
!   0xb9, 0x5b, 0xb2, 0x6c, 0x59, 0x72, 0x95, 0x7b, 0x01, 0xdb,
[...5423 lines suppressed...]
+   0x73, 0x6c, 0xdd, 0xc7, 0x28, 0x89, 0x13, 0xbb, 0x68, 0x01,
+   0xe5, 0x68, 0x1e, 0xc9, 0x02, 0x13, 0x5b, 0xd3, 0xaa, 0x1c,
+   0xce, 0xa5, 0x14, 0xa5, 0xa0, 0x96, 0x9e, 0x40, 0x36, 0xa8,
+   0x70, 0x8b, 0xba, 0x19, 0xd1, 0x58, 0x28, 0xfd, 0x10, 0x13,
+   0x7b, 0x54, 0xdf, 0xa0, 0xda, 0x12, 0xab, 0x2d, 0xe3, 0x32,
+   0xa5, 0x1e, 0x56, 0x64, 0xa6, 0x62, 0xc9, 0x76, 0x71, 0x52,
+   0x62, 0x72, 0xc9, 0xe8, 0x4a, 0xc6, 0x46, 0xe0, 0x69, 0x85,
+   0x31, 0xad, 0x34, 0x84, 0x28, 0x27, 0x48, 0x04, 0x73, 0xb3,
+   0x11, 0x5b, 0x57, 0x0e, 0xb0, 0xae, 0x8b, 0x6a, 0x0a, 0x94,
+   0x8a, 0xa9, 0x54, 0x41, 0xd2, 0x73, 0xc8, 0xda, 0xe3, 0x68,
+   0x88, 0x92, 0x84, 0x91, 0x29, 0x99, 0x6c, 0x37, 0x74, 0x07,
+   0x01, 0x42, 0x19, 0xc6, 0xbb, 0x0d, 0xc3, 0x51, 0x45, 0xdc,
+   0x4a, 0xa8, 0x6d, 0x85, 0x0a, 0x14, 0x76, 0x20, 0x51, 0xbd,
+   0x02, 0x61, 0x23, 0xb2, 0x62, 0x40, 0x63, 0x02, 0x5a, 0x5a,
+   0x62, 0x9b, 0x90, 0xa9, 0x82, 0x50, 0x84, 0xfc, 0x3f, 0xc1,
+   0x1f, 0x47, 0x94, 0xa4, 0xff, 0x76, 0x8b, 0x00, 0x00, 0x00,
+   0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82
+ };
+ 
  #endif /* IMAGES_H_INCLUDED */

--- NEW FILE: rects.h ---
(This appears to be a binary file; contents omitted.)

Index: rendertest.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/rendertest.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rendertest.c	18 Aug 2004 12:49:30 -0000	1.2
--- rendertest.c	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 30,33 ****
--- 30,34 ----
  #include "rendertest.h"
  #include "images.h"
+ #include "rects.h"
  #include "traps.h"
  
***************
*** 92,104 ****
  {
    switch (fill) {
[...1218 lines suppressed...]
    surface->backend->destroy (solid_red);
--- 1158,1175 ----
                   "(11 color stops)\n",
                   test, info.s);
!     status = _render_set_transform (grad11x1, &m);
      if (!status)
!       status = _render_set_filter (grad11x1,
!                                    RENDER_FILTER_RADIAL_GRADIENT,
!                                    params,
!                                    sizeof (params) /
!                                    sizeof (render_fixed16_16_t));
      _render_composite_tests (&info, grad11x1, NULL, status);
!     _render_set_filter (grad11x1, RENDER_FILTER_NEAREST, NULL, 0);
!     _render_set_transform (grad11x1, &_identity);
    }
  
    surface->backend->destroy (grad2x1);
    surface->backend->destroy (grad11x1);
    surface->backend->destroy (solid_blue);
    surface->backend->destroy (solid_red);

Index: rendertest.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/rendertest.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** rendertest.h	18 Aug 2004 12:49:30 -0000	1.2
--- rendertest.h	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 28,32 ****
  
  #define RENDER_DEFAULT_DST_WIDTH 320
! #define RENDER_DEFAULT_DST_HEIGHT 240
  
  typedef int render_bool_t;
--- 28,32 ----
  
  #define RENDER_DEFAULT_DST_WIDTH 320
! #define RENDER_DEFAULT_DST_HEIGHT 280
  
  typedef int render_bool_t;
***************
*** 82,86 ****
--- 82,93 ----
  
  typedef enum {
+   RENDER_CLIP_NONE,
+   RENDER_CLIP_RECTANGLES,
+   RENDER_CLIP_TRAPEZOIDS
+ } render_clip_t;
+ 
+ typedef enum {
    RENDER_FILL_NONE,
+   RENDER_FILL_TRANSPARENT,
    RENDER_FILL_NEAREST,
    RENDER_FILL_REPEAT,
***************
*** 101,104 ****
--- 108,116 ----
  } render_filter_t;
  
+ typedef struct render_rectangle {
+   short x, y;
+   unsigned short width, height;
+ } render_rectangle_t;
+ 
  typedef struct render_span_fixed {
    render_fixed16_16_t left, right, y;
***************
*** 119,128 ****
  
  typedef struct render_surface {
    void *surface;
    int width;
    int height;
!   const render_backend_t *backend;
  } render_surface_t;
  
  struct render_backend {
    render_surface_t *(*create_similar)      (render_surface_t *other,
--- 131,155 ----
  
  typedef struct render_surface {
+   const render_backend_t *backend;
+   
    void *surface;
    int width;
    int height;
!   unsigned long flags;
  } render_surface_t;
  
+ #define RENDER_SURFACE_FLAG_SOLID_MASK     (1L << 0)
+ #define RENDER_SURFACE_FLAG_TRANSFORM_MASK (1L << 1)
+ #define RENDER_SURFACE_FLAG_FILTER_MASK    (1L << 2)
+ 
+ #define SURFACE_SOLID(surface) \
+   ((surface)->flags & RENDER_SURFACE_FLAG_SOLID_MASK)
+ 
+ #define SURFACE_TRANSFORM(surface) \
+   ((surface)->flags & RENDER_SURFACE_FLAG_TRANSFORM_MASK)
+ 
+ #define SURFACE_FILTER(surface) \
+   ((surface)->flags & RENDER_SURFACE_FLAG_FILTER_MASK)
+ 
  struct render_backend {
    render_surface_t *(*create_similar)      (render_surface_t *other,
***************
*** 146,150 ****
                                              int height);
  
!   render_status_t   (*put_pixels)          (render_surface_t *dst,
                                              render_format_t format,
                                              unsigned char *data);
--- 173,177 ----
                                              int height);
  
!   render_status_t   (*set_pixels)          (render_surface_t *dst,
                                              render_format_t format,
                                              unsigned char *data);
***************
*** 166,191 ****
                                              int n_params);
    
!   render_status_t   (*fill_rectangle)      (render_operator_t op,
!                                             render_surface_t *dst,
!                                             const render_color_t *color,
!                                             int x,
!                                             int y,
!                                             unsigned int width,
!                                             unsigned int height);
!                                               
!   render_status_t   (*add_traps)           (render_surface_t *dst,
                                              int x_offset,
                                              int y_offset,
!                                             render_trapezoid_t *traps,
!                                             int n_traps);
! 
!   render_status_t   (*composite_traps)     (render_operator_t op,
!                                             render_surface_t *dst,
!                                             render_surface_t *src,
!                                             int x_src,
!                                             int y_src,
                                              int x_offset,
                                              int y_offset,
-                                             unsigned short opacity,
                                              render_trapezoid_t *traps,
                                              int n_traps);
--- 193,205 ----
                                              int n_params);
    
!   render_status_t   (*set_clip_rectangles) (render_surface_t *surface,
                                              int x_offset,
                                              int y_offset,
!                                             render_rectangle_t *rects,
!                                             int n_rects);
!                                               
!   render_status_t   (*set_clip_trapezoids) (render_surface_t *surface,
                                              int x_offset,
                                              int y_offset,
                                              render_trapezoid_t *traps,
                                              int n_traps);
***************
*** 204,207 ****
--- 218,222 ----
    int time;
    render_operator_t op;
+   render_clip_t clip;
  } render_settings_t;
  

Index: traps.h
===================================================================
RCS file: /cvs/cairo/rendertest/src/traps.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** traps.h	18 Aug 2004 12:50:41 -0000	1.1
--- traps.h	3 Sep 2004 14:29:26 -0000	1.2
***************
*** 187,208 ****
  };
  
- render_trapezoid_t pixel_aligned_traps[] = {
-   {
-     { 0x00000000, 0x008f0000, 0x00000000 },
-     { 0x00000000, 0x008f0000, 0x00010000 }
-   }, {
-     { 0x00000000, 0x00010000, 0x00010000 },
-     { 0x00000000, 0x00010000, 0x008f0000 }
-   } , {
-     { 0x008e0000, 0x008f0000, 0x00010000 },
-     { 0x008e0000, 0x008f0000, 0x008f0000 }
-   }, {
-     { 0x00010000, 0x008e0000, 0x008e0000 },
-     { 0x00010000, 0x008e0000, 0x008f0000 }
-   }, {
-     { 0x00020000, 0x008d0000, 0x00020000 },
-     { 0x00020000, 0x008d0000, 0x008d0000 }
-   }
- };
- 
  #endif /* TRAPS_H_INCLUDED */
--- 187,189 ----

Index: xcb.c
===================================================================
RCS file: /cvs/cairo/rendertest/src/xcb.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** xcb.c	18 Aug 2004 12:49:30 -0000	1.2
--- xcb.c	3 Sep 2004 14:29:26 -0000	1.3
***************
*** 290,293 ****
--- 290,294 ----
    similar->height = height;
    similar->backend = other->backend;
+   similar->flags = 0;
    surface->render_major = other_surface->render_major;
    surface->render_minor = other_surface->render_minor;
***************
*** 355,359 ****
  
  static render_status_t
! _xcb_render_put_pixels (render_surface_t *dst,
                          render_format_t format,
                          unsigned char *data)
--- 356,360 ----
  
  static render_status_t
! _xcb_render_set_pixels (render_surface_t *dst,
                          render_format_t format,
                          unsigned char *data)
***************
*** 413,418 ****
--- 414,425 ----
    CARD32 mask = XCBRenderCPRepeat;
    CARD32 pa;
+ 
+   pa = 0;
    
    switch (fill) {
+   case RENDER_FILL_TRANSPARENT:
+     if (!SURFACE_TRANSFORM (surface))
+       return RENDER_STATUS_NOT_SUPPORTED;
+     break;
    case RENDER_FILL_NEAREST:
    case RENDER_FILL_REFLECT:
***************
*** 423,427 ****
    case RENDER_FILL_NONE:
    default:
-     pa = 0;
      break;
    }
--- 430,433 ----
***************
*** 506,529 ****
  
  static render_status_t
! _xcb_render_fill_rectangle (render_operator_t op,
!                             render_surface_t *dst,
!                             const render_color_t *color,
!                             int x,
!                             int y,
!                             unsigned int width,
!                             unsigned int height)
  {
!   xcb_surface_t *surface = (xcb_surface_t *) dst->surface;
!   XCBRECTANGLE rect;
! 
!   rect.x = x;
!   rect.y = y;
!   rect.width = width;
!   rect.height = height;
! 
!   XCBRenderFillRectangles (surface->c,
!                            _xcb_operator (op),
!                            ((xcb_surface_t *) dst->surface)->picture,
!                            *((XCBRenderCOLOR *) color), 1, &rect);
    
    return RENDER_STATUS_SUCCESS;
--- 512,537 ----
  
  static render_status_t
! _xcb_render_set_clip_rectangles (render_surface_t *surface,
!                                  int x_offset,
!                                  int y_offset,
!                                  render_rectangle_t *rects,
!                                  int n_rects)
  {
!   xcb_surface_t *s = (xcb_surface_t *) surface->surface;
!   
!   if (n_rects > 0) {
!     XCBRenderSetPictureClipRectangles (s->c, s->picture,
!                                        x_offset, y_offset,
!                                        n_rects, (XCBRECTANGLE *) rects);
!   } else {
!     XCBRECTANGLE xr;
!     
!     xr.x = 0;
!     xr.y = 0;
!     xr.width = surface->width;
!     xr.height = surface->height;
!     
!     XCBRenderSetPictureClipRectangles (s->c, s->picture, 0, 0, 1, &xr);
!   }
    
    return RENDER_STATUS_SUCCESS;
***************
*** 531,554 ****
  
  static render_status_t
! _xcb_render_add_traps (render_surface_t *dst,
!                        int x_offset,
!                        int y_offset,
!                        render_trapezoid_t *traps,
!                        int n_traps)
! {
!   return RENDER_STATUS_NOT_SUPPORTED;
! }
! 
! static render_status_t
! _xcb_render_composite_traps (render_operator_t op,
!                              render_surface_t *dst,
!                              render_surface_t *src,
!                              int x_src,
!                              int y_src,
!                              int x_offset,
!                              int y_offset,
!                              unsigned short opacity,
!                              render_trapezoid_t *traps,
!                              int n_traps)
  {
    return RENDER_STATUS_NOT_SUPPORTED;
--- 539,547 ----
  
  static render_status_t
! _xcb_render_set_clip_trapezoids (render_surface_t *surface,
!                                  int x_offset,
!                                  int y_offset,
!                                  render_trapezoid_t *traps,
!                                  int n_traps)
  {
    return RENDER_STATUS_NOT_SUPPORTED;
***************
*** 559,563 ****
    _xcb_render_destroy,
    _xcb_render_composite,
!   _xcb_render_put_pixels,
    _xcb_render_show,
    _xcb_render_set_fill,
--- 552,556 ----
    _xcb_render_destroy,
    _xcb_render_composite,
!   _xcb_render_set_pixels,
    _xcb_render_show,
    _xcb_render_set_fill,
***************
*** 565,571 ****
    _xcb_render_set_transform,
    _xcb_render_set_filter,
!   _xcb_render_fill_rectangle,
!   _xcb_render_add_traps,
!   _xcb_render_composite_traps
  };
  
--- 558,563 ----
    _xcb_render_set_transform,
    _xcb_render_set_filter,
!   _xcb_render_set_clip_rectangles,
!   _xcb_render_set_clip_trapezoids
  };
  
***************
*** 604,607 ****
--- 596,600 ----
    
    surface.backend = &_glitz_xcb_render_backend;
+   surface.flags = 0;
  
    win.c = XCBConnectBasic ();




More information about the cairo-commit mailing list