[cairo-commit] glitz/src Makefile.am, 1.2, 1.3 glitz.c, 1.15, 1.16 glitz.h, 1.11, 1.12 glitz_agl_info.c, 1.3, 1.4 glitz_gl.h, 1.2, 1.3 glitz_glx_info.c, 1.8, 1.9 glitz_matrix.c, 1.5, 1.6 glitz_operator.c, 1.1.1.1, 1.2 glitz_program.c, 1.7, 1.8 glitz_programmatic.c, 1.7, 1.8 glitz_rect.c, 1.4, 1.5 glitz_render.c, NONE, 1.1 glitz_stencil.c, NONE, 1.1 glitz_surface.c, 1.12, 1.13 glitz_trap.c, 1.5, 1.6 glitz_tri.c, 1.5, 1.6 glitz_util.c, 1.4, 1.5 glitzint.h, 1.17, 1.18

David Reveman commit at pdx.freedesktop.org
Fri Jun 11 07:35:43 PDT 2004


Committed by: davidr

Update of /cvs/cairo/glitz/src
In directory pdx:/tmp/cvs-serv15231/src

Modified Files:
	Makefile.am glitz.c glitz.h glitz_agl_info.c glitz_gl.h 
	glitz_glx_info.c glitz_matrix.c glitz_operator.c 
	glitz_program.c glitz_programmatic.c glitz_rect.c 
	glitz_surface.c glitz_trap.c glitz_tri.c glitz_util.c 
	glitzint.h 
Added Files:
	glitz_render.c glitz_stencil.c 
Log Message:
Added software multi-sampling, new render and stencil interfaces

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/glitz/src/Makefile.am,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** Makefile.am	15 Apr 2004 22:03:01 -0000	1.2
--- Makefile.am	11 Jun 2004 14:35:41 -0000	1.3
***************
*** 41,44 ****
--- 41,46 ----
  	glitz_programmatic.c \
  	glitz_color_range.c \
+ 	glitz_render.c \
+ 	glitz_stencil.c \
  	glitz_gl.h \
  	glitzint.h

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** glitz.c	30 May 2004 15:59:54 -0000	1.15
--- glitz.c	11 Jun 2004 14:35:41 -0000	1.16
***************
*** 68,78 ****
    glitz_bounding_box_t dirty_box;
    glitz_point_t src_tl, src_br, mask_tl, mask_br;
!   glitz_program_type_t type;
  
    gl = dst->gl;
  
!   type = glitz_program_type (dst, src, mask);
    
!   if (type == GLITZ_PROGRAM_TYPE_NOT_SUPPORTED)
      return 0;
    
--- 68,78 ----
    glitz_bounding_box_t dirty_box;
    glitz_point_t src_tl, src_br, mask_tl, mask_br;
!   glitz_render_type_t type;
  
    gl = dst->gl;
  
!   type = glitz_render_type (src, mask, dst);
    
!   if (type == GLITZ_RENDER_TYPE_NOT_SUPPORTED)
      return 0;
    
***************
*** 100,105 ****
    gl->disable (GLITZ_GL_SCISSOR_TEST);
  
!   glitz_surface_enable_program (type, dst, src, mask,
!                                 src_texture, mask_texture);
  
    glitz_set_operator (gl, op);
--- 100,106 ----
    gl->disable (GLITZ_GL_SCISSOR_TEST);
  
!   glitz_render_enable (type,
!                        src, mask, dst,
!                        src_texture, mask_texture, 0xffff);
  
    glitz_set_operator (gl, op);
***************
*** 271,275 ****
    glitz_texture_unbind (gl, src_texture);
  
!   glitz_surface_disable_program (type, dst);
  
    dirty_box.x1 = floor (dst_box.x1);
--- 272,276 ----
    glitz_texture_unbind (gl, src_texture);
  
!   glitz_render_disable (type, dst);
  
    dirty_box.x1 = floor (dst_box.x1);
***************
*** 398,407 ****
  {
    glitz_gl_proc_address_list_t *gl;
!   glitz_surface_t *intermediate = NULL, *mask_surface;
    glitz_texture_t *texture;
    glitz_point_t tl, bl, br, tr;
    glitz_bounding_box_t clip;
!   glitz_program_type_t type = 0;
!   glitz_bool_t simple_modulate = 0;
  
    gl = dst->gl;
--- 399,409 ----
  {
    glitz_gl_proc_address_list_t *gl;
!   glitz_surface_t *intermediate = NULL;
    glitz_texture_t *texture;
    glitz_point_t tl, bl, br, tr;
    glitz_bounding_box_t clip;
!   glitz_render_type_t type;
!   glitz_gl_uint_t list = 0;
!   unsigned short opacity = 0xffff;
  
    gl = dst->gl;
***************
*** 413,433 ****
  
    if (mask) {
!     if (SURFACE_PROGRAMMATIC (mask))
        glitz_programmatic_surface_setup (mask,
                                          width + abs (x_mask),
                                          height + abs (y_mask));
  
!     if (SURFACE_SOLID (mask) && (!SURFACE_PROGRAMMATIC (src))) {
!       simple_modulate = 1;
!       if ((dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) &&
!           src->convolution)
!         simple_modulate = 0;
      }
    }
  
!   if (mask && (!simple_modulate)) {
!     glitz_bounding_box_t mask_bounds;
      static glitz_color_t clear_color = { 0x0000, 0x0000, 0x0000, 0x0000 };
-     glitz_bool_t intermediate_translate;
  
      if ((dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK) &&
--- 415,434 ----
  
    if (mask) {
!     if (SURFACE_PROGRAMMATIC (mask)) {
        glitz_programmatic_surface_setup (mask,
                                          width + abs (x_mask),
                                          height + abs (y_mask));
  
!       if (SURFACE_SOLID (mask)) {
!         opacity = ((glitz_programmatic_surface_t *) mask)->u.solid.color.alpha;
!         mask = NULL;
!       }
      }
    }
  
!   if (mask) {
!     glitz_bounding_box_t dst_bounds, mask_bounds;
!     glitz_intermediate_t intermediate_type;
      static glitz_color_t clear_color = { 0x0000, 0x0000, 0x0000, 0x0000 };
  
      if ((dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK) &&
***************
*** 440,531 ****
        return;
  
!     mask_bounds.x1 = x_dst;
!     mask_bounds.y1 = y_dst;
!     intermediate_translate = 0;
!     
!     if (!SURFACE_IMPLICIT_MASK (mask)) {
!       glitz_bounding_box_t bounds;
!       
!       bounds.x1 = x_dst;
!       bounds.x2 = x_dst + width;
!       bounds.y1 = y_dst;
!       bounds.y2 = y_dst + height;
!       
!       glitz_mask_bounds (src, mask, dst,
!                          x_src, y_src, x_mask, y_mask, x_dst, y_dst,
!                          &bounds, &mask_bounds);
! 
!       if (mask_bounds.x2 - mask_bounds.x1 <= 0 ||
!           mask_bounds.y2 - mask_bounds.y1 <= 0)
!         return;
! 
!       if ((x_dst != mask_bounds.x1) || (y_dst != mask_bounds.y1))
!         intermediate_translate = 1;
!       
!       mask_surface = intermediate =
!         glitz_surface_create_intermediate (dst, GLITZ_INTERMEDIATE_RGBA,
!                                            mask_bounds.x2 - mask_bounds.x1,
!                                            mask_bounds.y2 - mask_bounds.y1);
        
!       if (!mask_surface) {
!         glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
!         return;
!       }
! 
!       if (mask->transform)
!         glitz_fill_rectangle (GLITZ_OPERATOR_SRC,
!                               mask_surface,
!                               &clear_color,
!                               0, 0,
!                               mask_surface->width,
!                               mask_surface->height);
  
!       if ((!SURFACE_REPEAT (mask)) && intermediate_translate) {
!         glitz_surface_push_transform (mask);
!         glitz_matrix_translate (mask->transform,
!                                 x_dst - mask_bounds.x1,
!                                 y_dst - mask_bounds.y1);
!       }
!       
!       glitz_composite (GLITZ_OPERATOR_SRC,
!                        mask, NULL, mask_surface,
!                        x_mask, y_mask,
!                        0, 0,
!                        0, 0,
!                        mask_surface->width - (x_dst - mask_bounds.x1),
!                        mask_surface->height - (y_dst - mask_bounds.y1));
  
!       if (intermediate_translate)
!         glitz_surface_pop_transform (mask);
!       
!     } else
!       mask_surface = mask;
  
!     if ((!SURFACE_REPEAT (src)) && intermediate_translate) {
!       glitz_surface_push_transform (src);
!       glitz_matrix_translate (src->transform,
!                               x_dst - mask_bounds.x1,
!                               y_dst - mask_bounds.y1);
!     }
  
!     if (src->transform)
!       mask_surface->hint_mask |= GLITZ_INT_HINT_CLEAR_EXTERIOR_MASK;
      
      glitz_composite (GLITZ_OPERATOR_IN,
!                      src, NULL, mask_surface,
                       x_src, y_src,
                       0, 0,
                       0, 0,
!                      mask_surface->width,
!                      mask_surface->height);
! 
!     if (intermediate_translate)
!       glitz_surface_pop_transform (src);
! 
!     x_dst = mask_bounds.x1;
!     y_dst = mask_bounds.y1;
!     width = mask_surface->width;
!     height = mask_surface->height;
!     src = mask_surface;
      x_src = y_src = 0;
    }
--- 441,500 ----
        return;
  
!     dst_bounds.x1 = x_dst;
!     dst_bounds.x2 = x_dst + width;
!     dst_bounds.y1 = y_dst;
!     dst_bounds.y2 = y_dst + height;
        
!     glitz_mask_bounds (src, mask, dst,
!                        x_src, y_src, x_mask, y_mask, x_dst, y_dst,
!                        &dst_bounds, &mask_bounds);
!     if ((mask_bounds.x2 - x_dst) <= 0 || (mask_bounds.y2 - y_dst) <= 0)
!       return;
  
!     if (src->transform && (!SURFACE_REPEAT (src)))
!       intermediate_type = GLITZ_INTERMEDIATE_RGBA_STENCIL;
!     else
!       intermediate_type = GLITZ_INTERMEDIATE_RGBA;
!     
!     intermediate =
!       glitz_surface_create_intermediate (dst, intermediate_type,
!                                          mask_bounds.x2 - x_dst,
!                                          mask_bounds.y2 - y_dst);
!     
!     if (!intermediate) {
!       glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
!       return;
!     }
  
!     if (mask->transform)
!       glitz_fill_rectangle (GLITZ_OPERATOR_SRC,
!                             intermediate,
!                             &clear_color,
!                             0, 0,
!                             intermediate->width,
!                             intermediate->height);
  
!     glitz_composite (GLITZ_OPERATOR_SRC,
!                      mask, NULL, intermediate,
!                      x_mask, y_mask,
!                      0, 0,
!                      0, 0,
!                      intermediate->width,
!                      intermediate->height);
  
!     if (src->transform && (!SURFACE_REPEAT (src)))
!       intermediate->hint_mask |= GLITZ_INT_HINT_CLEAR_EXTERIOR_MASK;
      
      glitz_composite (GLITZ_OPERATOR_IN,
!                      src, NULL, intermediate,
                       x_src, y_src,
                       0, 0,
                       0, 0,
!                      intermediate->width,
!                      intermediate->height);
!     
!     width = intermediate->width;
!     height = intermediate->height;
!     src = intermediate;
      x_src = y_src = 0;
    }
***************
*** 544,567 ****
  
    glitz_texture_bind (gl, texture);
-   
-   gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
-                  GLITZ_GL_TEXTURE_ENV_MODE,
-                  (simple_modulate)? GLITZ_GL_MODULATE: GLITZ_GL_REPLACE);
-   
-   if (simple_modulate) {
-     glitz_programmatic_surface_t *m = (glitz_programmatic_surface_t *) mask;
- 
-     gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
-                    GLITZ_GL_TEXTURE_ENV_MODE,
-                    GLITZ_GL_MODULATE);
-     gl->color_4us (m->u.solid.color.alpha,
-                    m->u.solid.color.alpha,
-                    m->u.solid.color.alpha,
-                    m->u.solid.color.alpha);
-   } else {
-     gl->tex_env_f (GLITZ_GL_TEXTURE_ENV,
-                    GLITZ_GL_TEXTURE_ENV_MODE,
-                    GLITZ_GL_REPLACE);
-   }
  
    clip.x1 = x_dst;
--- 513,516 ----
***************
*** 569,572 ****
--- 518,529 ----
    clip.x2 = clip.x1 + width;
    clip.y2 = clip.y1 + height;
+ 
+   if (SURFACE_CLEAR_EXTERIOR (dst)) {
+     gl->clear_stencil (0x0);
+     gl->clear (GLITZ_GL_STENCIL_BUFFER_BIT);
+     glitz_set_stencil_operator (gl, GLITZ_STENCIL_OPERATOR_SET, 0x1);
+   }
+ 
+   type = glitz_render_type (src, NULL, dst);
    
    gl->scissor (clip.x1, dst->height - (clip.y1 + height), width, height);
***************
*** 574,581 ****
    glitz_set_operator (gl, op);
  
!   if (src->convolution || SURFACE_PROGRAMMATIC (src)) {
!     type = glitz_program_type (dst, src, NULL);
!     glitz_surface_enable_program (type, dst, src, NULL, texture, NULL);
!   }
    
    if ((!src->transform) && SURFACE_GLREPEAT (src, texture)) {
--- 531,535 ----
    glitz_set_operator (gl, op);
  
!   glitz_render_enable (type, src, NULL, dst, texture, NULL, opacity);
    
    if ((!src->transform) && SURFACE_GLREPEAT (src, texture)) {
***************
*** 610,613 ****
--- 564,572 ----
      repeat_factor_x = (br.x - tl.x) / (double) texture->width;
      repeat_factor_y = (br.y - tl.y) / (double) texture->height;
+ 
+     if (dst->multi_sample) {
+       list = dst->gl->gen_lists (1);
+       dst->gl->new_list (list, GLITZ_GL_COMPILE);
+     }
        
      gl->begin (GLITZ_GL_QUADS);
***************
*** 647,650 ****
--- 606,614 ----
        glitz_texture_ensure_filter (gl, texture, GLITZ_FILTER_NEAREST);
  
+     if (dst->multi_sample) {
+       list = dst->gl->gen_lists (1);
+       dst->gl->new_list (list, GLITZ_GL_COMPILE);
+     }
+ 
      while (repeat_direction) {
        save_base_x1 = base_tl.x;
***************
*** 765,823 ****
    }
  
!   if (src->convolution || SURFACE_PROGRAMMATIC (src))
!     glitz_surface_disable_program (type, dst);
    
    glitz_texture_unbind (gl, texture);
  
!   /* Clear intermediate mask exterior. This is only done if
!      destination surfaces is an intermediate mask surface
!      and source surface is transformed and not repeating. */
!   if (SURFACE_CLEAR_EXTERIOR (dst) && (!SURFACE_REPEAT (src))) {
      glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
!     
      gl->color_4us (0x0000, 0x0000, 0x0000, 0x0000);
      
      gl->begin (GLITZ_GL_QUADS);
- 
-     gl->vertex_2d (tl.x, tl.y);
-     gl->vertex_2d (0.0, tl.y);
-     gl->vertex_2d (0.0, 0.0);
-     gl->vertex_2d (tl.x, 0.0);   
- 
-     gl->vertex_2d (tl.x, tl.y);
-     gl->vertex_2d (tl.x, 0.0);
-     gl->vertex_2d (tr.x, 0.0);
-     gl->vertex_2d (tr.x, tr.y);
      
!     gl->vertex_2d (tr.x, tr.y);
!     gl->vertex_2d (tr.x, 0.0);
      gl->vertex_2d (dst->width, 0.0);
-     gl->vertex_2d (dst->width, tr.y);
- 
-     gl->vertex_2d (tr.x, tr.y);
-     gl->vertex_2d (dst->width, tr.y);
-     gl->vertex_2d (dst->width, br.y);
-     gl->vertex_2d (br.x, br.y);
-     
-     gl->vertex_2d (br.x, br.y);
-     gl->vertex_2d (dst->width, br.y);
      gl->vertex_2d (dst->width, dst->height);
-     gl->vertex_2d (br.x, dst->height);
- 
-     gl->vertex_2d (br.x, br.y);
-     gl->vertex_2d (br.x, dst->height);
-     gl->vertex_2d (bl.x, dst->height);
-     gl->vertex_2d (bl.x, bl.y);
- 
-     gl->vertex_2d (bl.x, bl.y);
-     gl->vertex_2d (bl.x, dst->height);
      gl->vertex_2d (0.0, dst->height);
!     gl->vertex_2d (0.0, bl.y);
! 
!     gl->vertex_2d (bl.x, bl.y);
!     gl->vertex_2d (0.0, bl.y);
!     gl->vertex_2d (0.0, tl.y);
!     gl->vertex_2d (tl.x, tl.y);
! 
      gl->end ();
    }
--- 729,774 ----
    }
  
!   if (list) {
!     int i;
!     unsigned int mask = *dst->stencil_mask & ~0x1;
!     
!     gl->end_list ();
!     
!     for (i = 0; i < dst->multi_sample->n_samples; i++) {
!       if ((i + 1) == dst->multi_sample->n_samples)
!         glitz_set_stencil_operator (gl, GLITZ_STENCIL_OPERATOR_CLIP,
!                                     mask | (i + 1));
!       else
!         glitz_set_stencil_operator (gl, GLITZ_STENCIL_OPERATOR_CLIP_EQUAL,
!                                     mask | (i + 1));
!       
!       glitz_render_enable (type, src, NULL, dst, texture, NULL,
!                            SHORT_MODULATE (dst->multi_sample->weights[i],
!                                            opacity));
!       
!       gl->call_list (list);
!     }
!     
!     gl->delete_lists (list, 1);
!   }
!   
!   glitz_render_disable (type, dst);
    
    glitz_texture_unbind (gl, texture);
  
!   if (SURFACE_CLEAR_EXTERIOR (dst)) {    
      glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
!     glitz_set_stencil_operator (dst->gl,
!                                 GLITZ_STENCIL_OPERATOR_CLIP_EQUAL, 0x0);
! 
      gl->color_4us (0x0000, 0x0000, 0x0000, 0x0000);
      
      gl->begin (GLITZ_GL_QUADS);
      
!     gl->vertex_2d (0.0, 0.0);
      gl->vertex_2d (dst->width, 0.0);
      gl->vertex_2d (dst->width, dst->height);
      gl->vertex_2d (0.0, dst->height);
!     
      gl->end ();
    }

Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** glitz.h	24 May 2004 07:16:42 -0000	1.11
--- glitz.h	11 Jun 2004 14:35:41 -0000	1.12
***************
*** 419,422 ****
--- 419,423 ----
  #define GLITZ_HINT_OFFSCREEN_MASK    (1L << 1)
  #define GLITZ_HINT_PROGRAMMATIC_MASK (1L << 2)
+ #define GLITZ_HINT_MULTISAMPLE_MASK  (1L << 3)
  
  unsigned long

Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_info.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** glitz_agl_info.c	9 May 2004 20:54:51 -0000	1.3
--- glitz_agl_info.c	11 Jun 2004 14:35:41 -0000	1.4
***************
*** 87,90 ****
--- 87,95 ----
    (glitz_gl_copy_tex_sub_image_2d_t) glCopyTexSubImage2D,
    (glitz_gl_get_integer_v_t) glGetIntegerv,
+   (glitz_gl_delete_lists_t) glDeleteLists,
+   (glitz_gl_gen_lists_t) glGenLists,
+   (glitz_gl_new_list_t) glNewList,
+   (glitz_gl_end_list_t) glEndList,
+   (glitz_gl_call_list_t) glCallList,
    
    (glitz_gl_active_texture_arb_t) glActiveTextureARB,

Index: glitz_gl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_gl.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_gl.h	28 Apr 2004 08:59:38 -0000	1.2
--- glitz_gl.h	11 Jun 2004 14:35:41 -0000	1.3
***************
*** 85,89 ****
--- 85,91 ----
  #define GLITZ_GL_DECR         0x1E03
  
+ #define GLITZ_GL_LESS       0x0201
  #define GLITZ_GL_EQUAL      0x0202
+ #define GLITZ_GL_LEQUAL     0x0203
  #define GLITZ_GL_ALWAYS     0x0207
  #define GLITZ_GL_DEPTH_TEST 0x0B71
***************
*** 129,132 ****
--- 131,136 ----
  #define GLITZ_GL_NICEST                      0x1102
  
+ #define GLITZ_GL_COMPILE 0x1300
+ 
  #define GLITZ_GL_TEXTURE_RECTANGLE_EXT 0x84F5
  
***************
*** 290,293 ****
--- 294,307 ----
  typedef glitz_gl_void_t (* glitz_gl_get_integer_v_t)
       (glitz_gl_enum_t pname, glitz_gl_int_t *params);
+ typedef glitz_gl_void_t (* glitz_gl_delete_lists_t)
+      (glitz_gl_uint_t list, glitz_gl_sizei_t range);
+ typedef glitz_gl_uint_t (* glitz_gl_gen_lists_t)
+      (glitz_gl_sizei_t range);
+ typedef glitz_gl_void_t (* glitz_gl_new_list_t)
+      (glitz_gl_uint_t list, glitz_gl_enum_t mode);
+ typedef glitz_gl_void_t (* glitz_gl_end_list_t)
+      (glitz_gl_void_t);
+ typedef glitz_gl_void_t (* glitz_gl_call_list_t)
+      (glitz_gl_uint_t list);
  typedef glitz_gl_void_t (* glitz_gl_active_texture_arb_t)
       (glitz_gl_enum_t);

Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_glx_info.c	28 May 2004 20:49:04 -0000	1.8
--- glitz_glx_info.c	11 Jun 2004 14:35:41 -0000	1.9
***************
*** 88,91 ****
--- 88,96 ----
    (glitz_gl_copy_tex_sub_image_2d_t) glCopyTexSubImage2D,
    (glitz_gl_get_integer_v_t) glGetIntegerv,
+   (glitz_gl_delete_lists_t) glDeleteLists,
+   (glitz_gl_gen_lists_t) glGenLists,
+   (glitz_gl_new_list_t) glNewList,
+   (glitz_gl_end_list_t) glEndList,
+   (glitz_gl_call_list_t) glCallList,
  
    (glitz_gl_active_texture_arb_t) 0,

Index: glitz_matrix.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_matrix.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_matrix.c	29 May 2004 20:45:48 -0000	1.5
--- glitz_matrix.c	11 Jun 2004 14:35:41 -0000	1.6
***************
*** 165,177 ****
  }
  
- void
- glitz_matrix_translate (glitz_matrix_t *matrix,
-                         double tx,
-                         double ty)
- {  
-   matrix->m[2][0] += tx;
-   matrix->m[2][1] += ty;
- }
- 
  /* This function is only used for convolution kernel normalization.
     I'm not sure that it does the right thing when kernel contains negative
--- 165,168 ----

Index: glitz_operator.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_operator.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glitz_operator.c	30 Mar 2004 17:07:19 -0000	1.1.1.1
--- glitz_operator.c	11 Jun 2004 14:35:41 -0000	1.2
***************
*** 99,131 ****
  
  void
! glitz_set_clip_operator (glitz_gl_proc_address_list_t *gl,
!                          glitz_int_clip_operator_t op,
!                          int mask)
  {
    gl->enable (GLITZ_GL_STENCIL_TEST);
!   
    switch (op) {
!   case GLITZ_INT_CLIP_OPERATOR_SET:
!     gl->clear_stencil (0x0);
!     gl->clear (GLITZ_GL_STENCIL_BUFFER_BIT);
!   case GLITZ_INT_CLIP_OPERATOR_UNION:
!     gl->stencil_func (GLITZ_GL_ALWAYS, mask, mask);
      gl->stencil_op (GLITZ_GL_REPLACE, GLITZ_GL_REPLACE, GLITZ_GL_REPLACE);
      break;
!   case GLITZ_INT_CLIP_OPERATOR_INTERSECT:
!     gl->stencil_func (GLITZ_GL_EQUAL, mask, mask);
!     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_REPLACE, GLITZ_GL_REPLACE);
      break;
!   case GLITZ_INT_CLIP_OPERATOR_INCR_INTERSECT:
!     gl->stencil_func (GLITZ_GL_EQUAL, mask - 0x1, mask - 0x1);
      gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_INCR, GLITZ_GL_INCR);
      break;
!   case GLITZ_INT_CLIP_OPERATOR_DECR_INTERSECT:
!     gl->stencil_func (GLITZ_GL_EQUAL, mask + 0x1, mask + 0x1);
!     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_DECR, GLITZ_GL_DECR);
      break;
!   case GLITZ_INT_CLIP_OPERATOR_CLIP:
!   default:
!     gl->stencil_func (GLITZ_GL_EQUAL, mask, mask);
      gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_KEEP, GLITZ_GL_KEEP);
      break;
--- 99,132 ----
  
  void
! glitz_set_stencil_operator (glitz_gl_proc_address_list_t *gl,
!                             glitz_stencil_operator_t op,
!                             unsigned int mask)
  {
    gl->enable (GLITZ_GL_STENCIL_TEST);
! 
    switch (op) {
!   case GLITZ_STENCIL_OPERATOR_SET:
!   case GLITZ_STENCIL_OPERATOR_UNION:
!     gl->stencil_func (GLITZ_GL_ALWAYS, ~0x0, ~0x0);
      gl->stencil_op (GLITZ_GL_REPLACE, GLITZ_GL_REPLACE, GLITZ_GL_REPLACE);
      break;
!   case GLITZ_STENCIL_OPERATOR_INTERSECT:
!     gl->stencil_func (GLITZ_GL_LESS, mask, ~0x0);
!     gl->stencil_op (GLITZ_GL_ZERO, GLITZ_GL_REPLACE, GLITZ_GL_REPLACE);
      break;
!   case GLITZ_STENCIL_OPERATOR_INCR_EQUAL:
!     gl->stencil_func (GLITZ_GL_EQUAL, mask, mask);
      gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_INCR, GLITZ_GL_INCR);
      break;
!   case GLITZ_STENCIL_OPERATOR_DECR_LESS:
!     gl->stencil_func (GLITZ_GL_LESS, mask, ~0x0);
!     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_REPLACE, GLITZ_GL_REPLACE);
      break;
!   case GLITZ_STENCIL_OPERATOR_CLIP_EQUAL:
!     gl->stencil_func (GLITZ_GL_EQUAL, mask, ~0x0);
!     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_KEEP, GLITZ_GL_KEEP);
!     break;
!   case GLITZ_STENCIL_OPERATOR_CLIP:
!     gl->stencil_func (GLITZ_GL_LEQUAL, mask, ~0x0);
      gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_KEEP, GLITZ_GL_KEEP);
      break;

Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_program.c	11 May 2004 08:48:53 -0000	1.7
--- glitz_program.c	11 Jun 2004 14:35:41 -0000	1.8
***************
*** 369,372 ****
--- 369,374 ----
    
    "TEX color, distance, texture[2], 1D;\n"
+ 
+   "MUL color, color, fragment.color.a;\n"
    
    /* pd operation */
***************
*** 438,441 ****
--- 440,445 ----
    "TEX color, distance, texture[2], 1D;\n"
  
+   "MUL color, color, fragment.color;\n"
+ 
    /* pd operation */
    "%s"
***************
*** 561,567 ****
                                     glitz_convolution_type_t type)
  {
!   char *solid_op_table[] = {
!     "MUL result.color, color, solid.a;\n",
!     "MUL result.color, solid, color.a;\n",
    };
    char program_buffer[1280];
--- 565,571 ----
                                     glitz_convolution_type_t type)
  {
!   static char *solid_op_table[] = {
!     "MUL result.color, color, fragment.color.a;\n",
!     "MUL result.color, fragment.color, color.a;\n",
    };
    char program_buffer[1280];
***************
*** 570,574 ****
  
    if (solid_offset) {
!     temporary = "PARAM solid = program.local[3];\n";
      operation = solid_op_table[solid_offset - 1];
    } else {
--- 574,578 ----
  
    if (solid_offset) {
!     temporary = "";
      operation = solid_op_table[solid_offset - 1];
    } else {
***************
*** 637,652 ****
  }
  
! static void
! glitz_program_enable_simple (glitz_gl_proc_address_list_t *gl,
!                              glitz_programs_t *programs,
!                              glitz_texture_t *src_texture,
!                              glitz_texture_t *mask_texture)
  {
    int offset;
  
-   /* This is done without fragment program */
-   if (mask_texture->internal_format == GLITZ_GL_LUMINANCE_ALPHA)
-     return;
- 
    offset = _glitz_program_offset (src_texture, mask_texture);
    
--- 641,652 ----
  }
  
! void
! glitz_program_enable_argb_argb (glitz_gl_proc_address_list_t *gl,
!                                 glitz_programs_t *programs,
!                                 glitz_texture_t *src_texture,
!                                 glitz_texture_t *mask_texture)
  {
    int offset;
  
    offset = _glitz_program_offset (src_texture, mask_texture);
    
***************
*** 662,666 ****
  }
  
! static void
  glitz_program_enable_convolution (glitz_gl_proc_address_list_t *gl,
                                    glitz_programs_t *programs,
--- 662,666 ----
  }
  
! void
  glitz_program_enable_convolution (glitz_gl_proc_address_list_t *gl,
                                    glitz_programs_t *programs,
***************
*** 670,674 ****
                                    glitz_texture_t *mask_texture,
                                    int offset,
!                                   int solid_offset)
  {
    glitz_texture_t *texture;
--- 670,675 ----
                                    glitz_texture_t *mask_texture,
                                    int offset,
!                                   int solid_offset,
!                                   unsigned short opacity)
  {
    glitz_texture_t *texture;
***************
*** 741,745 ****
                                      0.0);
  
!     if (solid_offset) {
        glitz_color_t *color;
        
--- 742,746 ----
                                      0.0);
  
!     if (solid_offset && mask) {
        glitz_color_t *color;
        
***************
*** 748,767 ****
        else
          color = &((glitz_programmatic_surface_t *) src)->u.solid.color;
!       
!       gl->program_local_param_4d_arb (GLITZ_GL_FRAGMENT_PROGRAM_ARB, 3,
!                                       (double) color->red / 65536.0,
!                                       (double) color->green / 65536.0,
!                                       (double) color->blue / 65536.0,
!                                       (double) color->alpha / 65536.0);
!     }
    }
  }
  
! static void
  glitz_program_enable_programmatic (glitz_surface_t *dst,
                                     glitz_programmatic_surface_t *surface,
                                     glitz_texture_t *src_texture,
                                     glitz_texture_t *mask_texture,
!                                    int offset)
  {
    int type_offset, add_offset;
--- 749,766 ----
        else
          color = &((glitz_programmatic_surface_t *) src)->u.solid.color;
! 
!       gl->color_4us (color->red, color->green, color->blue, color->alpha);
!     } else
!       gl->color_4us (opacity, opacity, opacity, opacity);
    }
  }
  
! void
  glitz_program_enable_programmatic (glitz_surface_t *dst,
                                     glitz_programmatic_surface_t *surface,
                                     glitz_texture_t *src_texture,
                                     glitz_texture_t *mask_texture,
!                                    int offset,
!                                    unsigned short opacity)
  {
    int type_offset, add_offset;
***************
*** 777,797 ****
    type_offset = offset + GLITZ_FRAGMENT_PROGRAM_TYPES * surface->type;
  
-   /* no fragment proram needed for solid programmatic surface and no mask */
-   if ((surface->type == GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) &&
-       (add_offset == GLITZ_PROGRAM_NOSRC_NOMASK_OFFSET)) {
-     glitz_programmatic_surface_bind (dst->gl, surface, dst->feature_mask);
-     return;
-   }
- 
-   /* no fragment proram needed for solid programmatic surface and
-      mask in lumniance alpha texture format */
-   if (dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK) {
-     if ((surface->type == GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) &&
-         (mask_texture->internal_format == GLITZ_GL_LUMINANCE_ALPHA)) {
-       glitz_programmatic_surface_bind (dst->gl, surface, dst->feature_mask);
-       return;
-     }
-   }
- 
    if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
      if (!programs->fragment_programmatic[type_offset])
--- 776,779 ----
***************
*** 804,964 ****
                                   programs->fragment_programmatic[type_offset]);
      
!       glitz_programmatic_surface_bind (dst->gl, surface, dst->feature_mask);
!     }
!   }
! }
! 
! glitz_program_type_t
! glitz_program_type (glitz_surface_t *dst,
!                     glitz_surface_t *src,
!                     glitz_surface_t *mask)
! {
!   glitz_program_type_t type = GLITZ_PROGRAM_TYPE_NOT_SUPPORTED;
!   
!   if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
! 
!     if (dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) {
!       if (src->convolution) {
!         if (mask && SURFACE_PROGRAMMATIC (mask) &&
!             ((glitz_programmatic_surface_t *) mask)->type ==
!             GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
!           if (dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) {
!             type = GLITZ_PROGRAM_TYPE_SRC_CONVOLUTION_AND_SOLID_MASK;
!             goto OK2;
!           } else {
!             type = GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC;
!             goto OK1;
!           }
!         }
!         type = GLITZ_PROGRAM_TYPE_SRC_CONVOLUTION;
!         goto OK1;
!       }
!     
!       if (mask && mask->convolution) {
!         if (SURFACE_PROGRAMMATIC (src) &&
!             ((glitz_programmatic_surface_t *) src)->type ==
!             GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
!           if (dst->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK) {
!             type = GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION_AND_SOLID_SRC;
!             goto OK2;
!           } else {
!             type = GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC;
!             goto OK1;
!           }
!         }
!         type = GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION;
!         goto OK1;
!       }
!     }
! 
!     if (SURFACE_PROGRAMMATIC (src)) {
!       type = GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC;
!       goto OK1;
!     }
!     
!     if (mask && SURFACE_PROGRAMMATIC (mask)) {
!       type = GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC;
!       goto OK1;
!     }
!   }
! 
!   if (SURFACE_SOLID (src)) {
!     type = GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC;
!     goto OK1;
!   }
! 
!   if (mask && SURFACE_SOLID (mask)) {
!     type = GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC;
!     goto OK1;
!   }
!   
!   if (mask && (!SURFACE_PROGRAMMATIC (mask))) {
!     if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
!       type = GLITZ_PROGRAM_TYPE_SIMPLE;
!     } else if ((mask->texture.internal_format == GLITZ_GL_LUMINANCE_ALPHA) &&
!                (dst->feature_mask & GLITZ_FEATURE_ARB_MULTITEXTURE_MASK)) {
!       type = GLITZ_PROGRAM_TYPE_SIMPLE;
!     } else
!       type = GLITZ_PROGRAM_TYPE_NOT_SUPPORTED;
!   } 
! 
!  OK1:
!   if ((SURFACE_PROGRAMMATIC (src) || src->convolution) &&
!       (mask && (SURFACE_PROGRAMMATIC (mask) || mask->convolution)))
!     return GLITZ_PROGRAM_TYPE_NOT_SUPPORTED;
!   
!  OK2:
!   return type;
! }
! 
! void
! glitz_program_enable (glitz_program_type_t type,
!                       glitz_surface_t *dst,
!                       glitz_surface_t *src,
!                       glitz_surface_t *mask,
!                       glitz_texture_t *src_texture,
!                       glitz_texture_t *mask_texture)
! {
!   switch (type) {
!   case GLITZ_PROGRAM_TYPE_SRC_CONVOLUTION:
!     glitz_program_enable_convolution (dst->gl, dst->programs,
!                                       src, mask, src_texture, mask_texture,
!                                       GLITZ_PROGRAM_SRC_OPERATION_OFFSET, 0);
!     break;
!   case GLITZ_PROGRAM_TYPE_SRC_CONVOLUTION_AND_SOLID_MASK:
!     glitz_program_enable_convolution (dst->gl, dst->programs,
!                                       src, mask, src_texture, mask_texture,
!                                       GLITZ_PROGRAM_SRC_OPERATION_OFFSET, 1);
!     break;
!   case GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION:
!     glitz_program_enable_convolution (dst->gl, dst->programs,
!                                       src, mask, src_texture, mask_texture,
!                                       GLITZ_PROGRAM_MASK_OPERATION_OFFSET, 0);
!     break;
!   case GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION_AND_SOLID_SRC:
!     glitz_program_enable_convolution (dst->gl, dst->programs,
!                                       src, mask, src_texture, mask_texture,
!                                       GLITZ_PROGRAM_MASK_OPERATION_OFFSET, 2);
!     break;
!   case GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC:
!     glitz_program_enable_programmatic (dst,
!                                        (glitz_programmatic_surface_t *) src,
!                                        src_texture, mask_texture,
!                                        GLITZ_PROGRAM_SRC_OPERATION_OFFSET);
!     break;
!   case GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC:
!     glitz_program_enable_programmatic (dst,
!                                        (glitz_programmatic_surface_t *) mask,
!                                        src_texture, mask_texture,
!                                        GLITZ_PROGRAM_MASK_OPERATION_OFFSET);
!     break;
!   case GLITZ_PROGRAM_TYPE_SIMPLE:
!     glitz_program_enable_simple (dst->gl, dst->programs,
!                                  src_texture, mask_texture);
!     break;
!   case GLITZ_PROGRAM_TYPE_NONE:
!   case GLITZ_PROGRAM_TYPE_NOT_SUPPORTED:
!     break;
!   }
! }
! 
! void
! glitz_program_disable (glitz_program_type_t type,
!                        glitz_surface_t *dst)
! {
!   if (dst->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
  
!     if (type == GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC ||
!         type == GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC) {
!       dst->gl->active_texture_arb (GLITZ_GL_TEXTURE2_ARB);
!       dst->gl->bind_texture (GLITZ_GL_TEXTURE_1D, 0);
!       dst->gl->disable (GLITZ_GL_TEXTURE_1D);
!       dst->gl->active_texture_arb (GLITZ_GL_TEXTURE0_ARB);
      }
-     
-     dst->gl->bind_program_arb (GLITZ_GL_FRAGMENT_PROGRAM_ARB, 0);
-     dst->gl->disable (GLITZ_GL_FRAGMENT_PROGRAM_ARB);
-     dst->gl->bind_program_arb (GLITZ_GL_VERTEX_PROGRAM_ARB, 0);
-     dst->gl->disable (GLITZ_GL_VERTEX_PROGRAM_ARB);
    }
  }
--- 786,794 ----
                                   programs->fragment_programmatic[type_offset]);
      
!       glitz_programmatic_surface_bind (dst->gl, surface, dst->feature_mask,
!                                        0xffff);
  
!       dst->gl->color_4us (opacity, opacity, opacity, opacity);
      }
    }
  }

Index: glitz_programmatic.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_programmatic.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_programmatic.c	24 May 2004 07:16:42 -0000	1.7
--- glitz_programmatic.c	11 Jun 2004 14:35:41 -0000	1.8
***************
*** 112,116 ****
  };
  
! glitz_programmatic_surface_t *
  _glitz_programmatic_surface_create (void)
  {
--- 112,116 ----
  };
  
! static glitz_programmatic_surface_t *
  _glitz_programmatic_surface_create (void)
  {
***************
*** 236,248 ****
  glitz_programmatic_surface_bind (glitz_gl_proc_address_list_t *gl,
                                   glitz_programmatic_surface_t *surface,
!                                  unsigned long feature_mask)
  {
    switch (surface->type) {
!   case GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE: {
!     gl->color_4us (surface->u.solid.color.red,
!                    surface->u.solid.color.green,
!                    surface->u.solid.color.blue,
!                    surface->u.solid.color.alpha);
!   } break;
    case GLITZ_PROGRAMMATIC_SURFACE_LINEAR_TYPE: {
      glitz_point_t p1, p2;
--- 236,255 ----
  glitz_programmatic_surface_bind (glitz_gl_proc_address_list_t *gl,
                                   glitz_programmatic_surface_t *surface,
!                                  unsigned long feature_mask,
!                                  unsigned short opacity)
  {
    switch (surface->type) {
!   case GLITZ_PROGRAMMATIC_SURFACE_SOLID_TYPE:
!     if (opacity != 0xffff) {
!       gl->color_4us (SHORT_MODULATE (surface->u.solid.color.red, opacity),
!                      SHORT_MODULATE (surface->u.solid.color.green, opacity),
!                      SHORT_MODULATE (surface->u.solid.color.blue, opacity),
!                      SHORT_MODULATE (surface->u.solid.color.alpha, opacity));
!     } else
!       gl->color_4us (surface->u.solid.color.red,
!                      surface->u.solid.color.green,
!                      surface->u.solid.color.blue,
!                      surface->u.solid.color.alpha);
!     break;
    case GLITZ_PROGRAMMATIC_SURFACE_LINEAR_TYPE: {
      glitz_point_t p1, p2;

Index: glitz_rect.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_rect.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glitz_rect.c	26 May 2004 13:37:52 -0000	1.4
--- glitz_rect.c	11 Jun 2004 14:35:41 -0000	1.5
***************
*** 73,77 ****
      return;
  
!   if (op == GLITZ_OPERATOR_SRC && (!dst->clip_mask)) {
      clear_mask = GLITZ_GL_COLOR_BUFFER_BIT;
      dst->gl->clear_color (color->red / (glitz_gl_clampf_t) 0xffff,
--- 73,77 ----
      return;
  
!   if (op == GLITZ_OPERATOR_SRC && (!*dst->stencil_mask)) {
      clear_mask = GLITZ_GL_COLOR_BUFFER_BIT;
      dst->gl->clear_color (color->red / (glitz_gl_clampf_t) 0xffff,
***************
*** 81,85 ****
    } else if (op == (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SET) {
      clear_mask = GLITZ_GL_STENCIL_BUFFER_BIT;
!     dst->gl->clear_stencil (0x1);
    } else {
      if (op == (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SRC)
--- 81,85 ----
    } else if (op == (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SET) {
      clear_mask = GLITZ_GL_STENCIL_BUFFER_BIT;
!     dst->gl->clear_stencil (*dst->stencil_mask);
    } else {
      if (op == (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SRC)

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

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

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glitz_surface.c	24 May 2004 07:16:42 -0000	1.12
--- glitz_surface.c	11 Jun 2004 14:35:41 -0000	1.13
***************
*** 61,64 ****
--- 61,65 ----
    surface->gl = gl;
    surface->draw_buffer = surface->read_buffer = GLITZ_GL_FRONT;
+   surface->stencil_mask = surface->stencil_masks;
  
    if (surface->gl) {
***************
*** 79,84 ****
      glitz_texture_fini (surface->gl, &surface->texture);
    
!   if (surface->transforms)
!     free (surface->transforms);
  
    if (surface->inverse_transform)
--- 80,85 ----
      glitz_texture_fini (surface->gl, &surface->texture);
    
!   if (surface->transform)
!     free (surface->transform);
  
    if (surface->inverse_transform)
***************
*** 139,142 ****
--- 140,147 ----
       GLITZ_FORMAT_MINIMUM_MASK. */
    switch (type) {
+   case GLITZ_INTERMEDIATE_RGBA_STENCIL:
+     templ.stencil_size = 8;
+     mask |= GLITZ_FORMAT_STENCIL_SIZE_MASK;
+     /* fall-through */
    case GLITZ_INTERMEDIATE_RGBA:
      templ.red_size = 8;
***************
*** 146,150 ****
               GLITZ_FORMAT_GREEN_SIZE_MASK |
               GLITZ_FORMAT_BLUE_SIZE_MASK);
!     /* fall through */
    case GLITZ_INTERMEDIATE_ALPHA:
      templ.alpha_size = 8;
--- 151,155 ----
               GLITZ_FORMAT_GREEN_SIZE_MASK |
               GLITZ_FORMAT_BLUE_SIZE_MASK);
!     /* fall-through */
    case GLITZ_INTERMEDIATE_ALPHA:
      templ.alpha_size = 8;
***************
*** 231,332 ****
  
  void
- glitz_surface_enable_program (glitz_program_type_t type,
-                               glitz_surface_t *surface,
-                               glitz_surface_t *src,
-                               glitz_surface_t *mask,
-                               glitz_texture_t *src_texture,
-                               glitz_texture_t *mask_texture)
- {
-   glitz_program_enable (type, surface, src, mask, src_texture, mask_texture);
- }
- 
- void
- glitz_surface_disable_program (glitz_program_type_t type,
-                                glitz_surface_t *surface)
- {
-   glitz_program_disable (type, surface);
- }
- 
- void
- glitz_surface_push_transform (glitz_surface_t *surface)
- {
-   static const glitz_matrix_t identity = {
-     {
-       { 1.0, 0.0, 0.0 },
-       { 0.0, 1.0, 0.0 },
-       { 0.0, 0.0, 1.0 }
-     }
-   };
-   
-   surface->n_transforms++;
-   
-   surface->transforms =
-     realloc (surface->transforms,
-              surface->n_transforms * sizeof (glitz_matrix_t));
- 
-   if (!surface->transforms)
-     return;
- 
-   if (!surface->inverse_transform)
-     surface->inverse_transform = malloc (sizeof (glitz_matrix_t));
-   
-   if (!surface->inverse_transform) {
-     free (surface->transforms);
-     surface->transforms = surface->transform = NULL;
-     return;
-   }
-   
-   if (surface->n_transforms > 1) {
-     surface->transforms[surface->n_transforms - 1] =
-       surface->transforms[surface->n_transforms - 2];
-   } else
-     surface->transforms[surface->n_transforms - 1] = identity;
-   
-   surface->transform = &surface->transforms[surface->n_transforms - 1];
- }
- 
- void
- glitz_surface_pop_transform (glitz_surface_t *surface)
- {
-   if (surface->n_transforms < 1)
-     return;
-   
-   surface->n_transforms--;
-   
-   surface->transforms =
-     realloc (surface->transforms,
-              surface->n_transforms * sizeof (glitz_matrix_t));
- 
-   if (surface->n_transforms)
-     surface->transform = &surface->transforms[surface->n_transforms - 1];
-   else
-     surface->transform = NULL;
- }
- 
- void
- glitz_surface_bounds (glitz_surface_t *surface,
-                       glitz_bounding_box_t *box)
- {
-   box->y1 = MINSHORT;
-   box->y2 = MAXSHORT;
-   box->x1 = MINSHORT;
-   box->x2 = MAXSHORT;
-   
-   if (SURFACE_PROGRAMMATIC (surface) ||
-       SURFACE_REPEAT (surface) ||
-       surface->transform)
-     return;
-     
-   box->x1 = 0;
-   box->y1 = 0;
-   box->x2 = surface->width;
-   box->y2 = surface->height;
- }
- 
- void
  glitz_surface_set_transform (glitz_surface_t *surface,
                               glitz_transform_t *transform)
  {
!   static const glitz_transform_t identity = {
      {
        { FIXED1, 0x00000, 0x00000 },
--- 236,243 ----
  
  void
  glitz_surface_set_transform (glitz_surface_t *surface,
                               glitz_transform_t *transform)
  {
!   static glitz_transform_t identity = {
      {
        { FIXED1, 0x00000, 0x00000 },
***************
*** 337,340 ****
--- 248,253 ----
  
    if (SURFACE_PROGRAMMATIC (surface)) {
+     if (transform == NULL)
+       transform = &identity;
      glitz_programmatic_surface_set_transform (surface, transform);
      return;
***************
*** 347,352 ****
    if (transform) {
      if (!surface->transform) {
!       glitz_surface_push_transform (surface);
!       if (!surface->transform) {
          glitz_surface_status_add (surface, GLITZ_STATUS_NO_MEMORY_MASK);
          return;
--- 260,273 ----
    if (transform) {
      if (!surface->transform) {
!       surface->transform = malloc (sizeof (glitz_matrix_t));
!       surface->inverse_transform = malloc (sizeof (glitz_matrix_t));
!       if ((!surface->transform) || (!surface->inverse_transform)) {
!         if (surface->transform)
!           free (surface->transform);
!         
!         if (surface->inverse_transform)
!           free (surface->inverse_transform);
!         
!         surface->transform = surface->inverse_transform = NULL;
          glitz_surface_status_add (surface, GLITZ_STATUS_NO_MEMORY_MASK);
          return;
***************
*** 365,373 ****
  
      if (glitz_matrix_invert (surface->transform)) {
!       glitz_surface_pop_transform (surface);
        glitz_surface_status_add (surface, GLITZ_STATUS_INVALID_MATRIX_MASK);
      }
!   } else
!     glitz_surface_pop_transform (surface);
  }
  slim_hidden_def(glitz_surface_set_transform);
--- 286,303 ----
  
      if (glitz_matrix_invert (surface->transform)) {
!       free (surface->transform);
!       free (surface->inverse_transform);
!       surface->transform = surface->inverse_transform = NULL;
        glitz_surface_status_add (surface, GLITZ_STATUS_INVALID_MATRIX_MASK);
      }
!   } else {
!     if (surface->transform)
!       free (surface->transform);
!     
!     if (surface->inverse_transform)
!       free (surface->inverse_transform);
!     
!     surface->transform = surface->inverse_transform = NULL;
!   }
  }
  slim_hidden_def(glitz_surface_set_transform);
***************
*** 532,535 ****
--- 462,467 ----
  
    surface->draw_buffer = _gl_buffer (buffer);
+   surface->stencil_mask =
+     &surface->stencil_masks[(buffer == GLITZ_BUFFER_FRONT)? 1: 0];
  }
  slim_hidden_def(glitz_surface_set_draw_buffer);
***************
*** 553,556 ****
--- 485,491 ----
    
    surface->backend->swap_buffers (surface);
+ 
+   memset (surface->stencil_masks, 0x0,
+           sizeof (unsigned int) * GLITZ_N_STENCIL_MASKS);
  }
  slim_hidden_def(glitz_surface_swap_buffers);
***************
*** 627,637 ****
      gl->draw_buffer (surface->draw_buffer);
  
!   if (surface->clip_mask)
!     glitz_set_clip_operator (gl, GLITZ_INT_CLIP_OPERATOR_CLIP,
!                              surface->clip_mask);
    else
      gl->disable (GLITZ_GL_STENCIL_TEST);
  }
  
  void
  glitz_surface_read_pixels (glitz_surface_t *surface,
--- 562,608 ----
      gl->draw_buffer (surface->draw_buffer);
  
!   if (*surface->stencil_mask)
!     glitz_set_stencil_operator (gl, GLITZ_STENCIL_OPERATOR_CLIP,
!                                 *surface->stencil_mask);
    else
      gl->disable (GLITZ_GL_STENCIL_TEST);
  }
  
+ /* This is supposed to be a 4x rotated grid multi-sample pattern. I'm not
+    sure it's actually correct. */
+ static glitz_sample_offset_t _4x_multi_sample_offsets[] = {
+   { -0.125, -0.375 },
+   {  0.375, -0.124 },
+   {  0.125,  0.375 },
+   { -0.375,  0.125 }
+ };
+ 
+ static unsigned short _4x_multi_sample_weights[] = {
+   0x4000, 0x8000, 0xbfff, 0xffff
+ };
+ 
+ static glitz_multi_sample_info_t _4x_multi_sample = {
+   _4x_multi_sample_offsets,
+   _4x_multi_sample_weights,
+   4
+ };
+ 
+ void
+ glitz_surface_enable_anti_aliasing (glitz_surface_t *surface)
+ {
+   if (surface->format->multisample.samples > 1)
+     return;
+ 
+   if (surface->polyedge == GLITZ_POLYEDGE_SMOOTH &&
+       surface->format->stencil_size >= 4)
+     surface->multi_sample = &_4x_multi_sample;
+ }
+ 
+ void
+ glitz_surface_disable_anti_aliasing (glitz_surface_t *surface)
+ {
+   surface->multi_sample = NULL;
+ }
+ 
  void
  glitz_surface_read_pixels (glitz_surface_t *surface,
***************
*** 932,988 ****
  
  void
- glitz_int_surface_clip_rectangles (glitz_surface_t *surface,
-                                    glitz_int_clip_operator_t op,
-                                    int mask,
-                                    const glitz_rectangle_t *rects,
-                                    int n_rects)
- {
-   static glitz_color_t color = { 0x0000, 0x0000, 0x0000, 0x0000 };
- 
-   if (n_rects == 0)
-     return;
- 
-   if ((op == GLITZ_INT_CLIP_OPERATOR_SET ||
-        op == GLITZ_INT_CLIP_OPERATOR_UNION) &&
-       (n_rects == 1 &&
-        rects->x <= 0 && rects->y <= 0 &&
-        rects->width >= surface->width &&
-        rects->height >= surface->height)) {
-     surface->clip_mask = 0x0;
-     return;
-   }
- 
-   if (surface->format->stencil_size < 1)
-     return;
- 
-   if (!glitz_surface_push_current (surface,
-                                    GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
-     glitz_surface_pop_current (surface);
-     return;
-   }
- 
-   glitz_set_clip_operator (surface->gl, op, mask);
-   
-   surface->gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE,
-                            GLITZ_GL_FALSE, GLITZ_GL_FALSE);
- 
-   glitz_int_fill_rectangles ((glitz_operator_t)
-                              ((op == GLITZ_INT_CLIP_OPERATOR_SET)?
-                               GLITZ_INT_OPERATOR_STENCIL_RECT_SET:
-                               GLITZ_INT_OPERATOR_STENCIL_RECT_SRC),
-                              surface,
-                              &color,
-                              rects,
-                              n_rects);
-   
-   surface->gl->color_mask (GLITZ_GL_TRUE, GLITZ_GL_TRUE,
-                            GLITZ_GL_TRUE, GLITZ_GL_TRUE);
-   
-   surface->clip_mask = mask;
- 
-   glitz_surface_pop_current (surface);
- }
- 
- void
  glitz_surface_clip_rectangles (glitz_surface_t *surface,
                                 glitz_clip_operator_t op,
--- 903,906 ----
***************
*** 990,1053 ****
                                 int n_rects)
  {
!   glitz_int_surface_clip_rectangles (surface, (glitz_int_clip_operator_t) op,
!                                      0x1, rects, n_rects);
  }
  slim_hidden_def(glitz_surface_clip_rectangles);
  
  void
- glitz_int_surface_clip_trapezoids (glitz_surface_t *surface,
-                                    glitz_int_clip_operator_t op,
-                                    int mask,
-                                    const glitz_trapezoid_t *traps,
-                                    int n_traps)
- {
-   static glitz_color_t color = { 0x0000, 0x0000, 0x0000, 0x0000 };
- 
-   if (n_traps == 0)
-     return;
- 
-   if ((op == GLITZ_INT_CLIP_OPERATOR_SET ||
-        op == GLITZ_INT_CLIP_OPERATOR_UNION) &&
-       (n_traps == 1 &&
-        FIXED_TO_INT (traps->top) <= 0 &&
-        FIXED_TO_INT (traps->bottom) >= surface->height &&
-        FIXED_TO_INT (traps->left.p1.x) <= 0 &&
-        FIXED_TO_INT (traps->left.p2.x) <= 0 &&
-        FIXED_TO_INT (traps->right.p1.x) >= surface->width &&
-        FIXED_TO_INT (traps->right.p2.x) >= surface->width)) {
-     surface->clip_mask = 0x0;
-     return;
-   }
-   
-   if (surface->format->stencil_size < 1)
-     return;
- 
-   if (!glitz_surface_push_current (surface,
-                                    GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
-     glitz_surface_pop_current (surface);
-     return;
-   }
- 
-   glitz_set_clip_operator (surface->gl, op, mask);
-   
-   surface->gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE,
-                            GLITZ_GL_FALSE, GLITZ_GL_FALSE);
- 
-   glitz_int_fill_trapezoids (GLITZ_OPERATOR_SRC,
-                              surface,
-                              0, 0,
-                              &color,
-                              traps,
-                              n_traps);
-     
-   surface->gl->color_mask (GLITZ_GL_TRUE, GLITZ_GL_TRUE,
-                            GLITZ_GL_TRUE, GLITZ_GL_TRUE);
- 
-   surface->clip_mask = mask;
- 
-   glitz_surface_pop_current (surface);
- }
- 
- void
  glitz_surface_clip_trapezoids (glitz_surface_t *surface,
                                 glitz_clip_operator_t op,
--- 908,917 ----
                                 int n_rects)
  {
!   glitz_stencil_rectangles (surface, (glitz_stencil_operator_t) op,
!                             rects, n_rects);
  }
  slim_hidden_def(glitz_surface_clip_rectangles);
  
  void
  glitz_surface_clip_trapezoids (glitz_surface_t *surface,
                                 glitz_clip_operator_t op,
***************
*** 1055,1107 ****
                                 int n_traps)
  {
!   glitz_int_surface_clip_trapezoids (surface, (glitz_int_clip_operator_t) op,
!                                      0x1, traps, n_traps);
  }
  slim_hidden_def(glitz_surface_clip_trapezoids);
  
  void
- glitz_int_surface_clip_triangles (glitz_surface_t *surface,
-                                   glitz_int_clip_operator_t op,
-                                   int mask,
-                                   glitz_triangle_type_t type,
-                                   const glitz_point_fixed_t *points,
-                                   int n_points)                               
- {
-   static glitz_color_t color = { 0x0000, 0x0000, 0x0000, 0x0000 };
- 
-   if (n_points < 3)
-     return;
-   
-   if (surface->format->stencil_size < 1)
-     return;
- 
-   if (!glitz_surface_push_current (surface,
-                                    GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
-     glitz_surface_pop_current (surface);
-     return;
-   }
-   
-   glitz_set_clip_operator (surface->gl, op, mask);
-   
-   surface->gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE,
-                            GLITZ_GL_FALSE, GLITZ_GL_FALSE);
- 
-   glitz_int_fill_triangles (GLITZ_OPERATOR_SRC,
-                             surface,
-                             type,
-                             0, 0,
-                             &color,                        
-                             points,
-                             n_points);
-   
-   surface->gl->color_mask (GLITZ_GL_TRUE, GLITZ_GL_TRUE,
-                            GLITZ_GL_TRUE, GLITZ_GL_TRUE);
- 
-   surface->clip_mask = mask;
- 
-   glitz_surface_pop_current (surface);
- }
- 
- void
  glitz_surface_clip_triangles (glitz_surface_t *surface,
                                glitz_clip_operator_t op,
--- 919,928 ----
                                 int n_traps)
  {
!   glitz_stencil_trapezoids (surface, (glitz_stencil_operator_t) op,
!                             traps, n_traps);
  }
  slim_hidden_def(glitz_surface_clip_trapezoids);
  
  void
  glitz_surface_clip_triangles (glitz_surface_t *surface,
                                glitz_clip_operator_t op,
***************
*** 1109,1117 ****
                                int n_tris)
  {
!   glitz_int_surface_clip_triangles (surface,
!                                     (glitz_int_clip_operator_t) op,
!                                     0x1,
!                                     GLITZ_TRIANGLE_TYPE_NORMAL,
!                                     (glitz_point_fixed_t *) tris, n_tris * 3);
  }
  slim_hidden_def(glitz_surface_clip_triangles);
--- 930,936 ----
                                int n_tris)
  {
!   glitz_stencil_triangles (surface, (glitz_stencil_operator_t) op,
!                            GLITZ_TRIANGLE_TYPE_NORMAL,
!                            (glitz_point_fixed_t *) tris, n_tris * 3);
  }
  slim_hidden_def(glitz_surface_clip_triangles);
***************
*** 1132,1138 ****
      (GLITZ_HINT_OFFSCREEN_MASK | GLITZ_HINT_PROGRAMMATIC_MASK);
  
!   if (surface->clip_mask)
      hint_mask |= GLITZ_HINT_CLIPPING_MASK;
    
    return hint_mask;
  }
--- 951,963 ----
      (GLITZ_HINT_OFFSCREEN_MASK | GLITZ_HINT_PROGRAMMATIC_MASK);
  
!   if (*surface->stencil_mask)
      hint_mask |= GLITZ_HINT_CLIPPING_MASK;
    
+   if ((!SURFACE_PROGRAMMATIC (surface)) &&
+       surface->polyedge == GLITZ_POLYEDGE_SMOOTH &&
+       surface->format->multisample.samples < 2 &&
+       surface->format->stencil_size >= 4)
+     hint_mask |= GLITZ_HINT_MULTISAMPLE_MASK;
+   
    return hint_mask;
  }

Index: glitz_trap.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_trap.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_trap.c	24 May 2004 07:16:42 -0000	1.5
--- glitz_trap.c	11 Jun 2004 14:35:41 -0000	1.6
***************
*** 106,118 ****
  {
    glitz_gl_vertex_2d_t vertex_2d;
!   
!   if (SURFACE_IMPLICIT_MASK (dst)) {
!     dst->gl->clear_color (0.0, 0.0, 0.0, 0.0);
!     dst->gl->clear (GLITZ_GL_COLOR_BUFFER_BIT);
!   }
  
    dst->gl->color_4us (color->red, color->green, color->blue, color->alpha);
  
    glitz_set_operator (dst->gl, op);
      
    dst->gl->begin (GLITZ_GL_QUADS);
--- 106,119 ----
  {
    glitz_gl_vertex_2d_t vertex_2d;
!   glitz_gl_uint_t list = 0;
  
    dst->gl->color_4us (color->red, color->green, color->blue, color->alpha);
  
    glitz_set_operator (dst->gl, op);
+ 
+   if (dst->multi_sample) {
+     list = dst->gl->gen_lists (1);
+     dst->gl->new_list (list, GLITZ_GL_COMPILE);
+   }
      
    dst->gl->begin (GLITZ_GL_QUADS);
***************
*** 141,146 ****
                                  (&traps->left, traps->bottom, 0)), bottom);
    }
!   
    dst->gl->end ();
  }
  
--- 142,163 ----
                                  (&traps->left, traps->bottom, 0)), bottom);
    }
! 
    dst->gl->end ();
+ 
+   if (list) {
+     int i;
+     
+     dst->gl->end_list ();
+ 
+     for (i = 0; i < dst->multi_sample->n_samples; i++) {
+       dst->gl->translate_d (dst->multi_sample->offsets[i].x,
+                             -dst->multi_sample->offsets[i].y, 0.0);
+       dst->gl->call_list (list);
+       dst->gl->translate_d (-dst->multi_sample->offsets[i].x,
+                             dst->multi_sample->offsets[i].y, 0.0);
+     }
+ 
+     dst->gl->delete_lists (list, 1);
+   }
  }
  
***************
*** 182,189 ****
    glitz_surface_t *mask;
    glitz_bounding_box_t trap_bounds;
-   glitz_bool_t use_mask;
    int x_dst, y_dst;
!   int x_offset, y_offset;
!   int width, height;
  
    if (n_traps == 0)
--- 199,204 ----
    glitz_surface_t *mask;
    glitz_bounding_box_t trap_bounds;
    int x_dst, y_dst;
!   glitz_rectangle_t rect;
  
    if (n_traps == 0)
***************
*** 193,289 ****
    y_dst = traps[0].left.p1.y >> 16;
  
!   if (dst->format->stencil_size > dst->clip_mask)
!     use_mask = 0;
!   else
!     use_mask = 1;
  
    glitz_trapezoid_bounds (n_traps, traps, &trap_bounds);
  
!   if (use_mask) {
!     glitz_bounding_box_t src_bounds, dst_bounds, bounds;
!     static glitz_color_t color = { 0xffff, 0xffff, 0xffff, 0xffff };
!     
!     glitz_surface_bounds (src, &src_bounds);
!     glitz_surface_bounds (dst, &dst_bounds);
! 
!     src_bounds.x1 += (x_dst - x_src);
!     src_bounds.y1 += (y_dst - y_src);
!     src_bounds.x2 += (x_dst - x_src);
!     src_bounds.y2 += (y_dst - y_src);
! 
!     glitz_intersect_bounding_box (&src_bounds, &trap_bounds, &bounds);
!     glitz_intersect_bounding_box (&dst_bounds, &bounds, &bounds);
! 
!     if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
!       return;
! 
!     mask = glitz_surface_create_intermediate (dst, GLITZ_INTERMEDIATE_ALPHA,
!                                               bounds.x2 - bounds.x1,
!                                               bounds.y2 - bounds.y1);
!     if (!mask)
!       return;
!     
!     mask->hint_mask |= GLITZ_INT_HINT_IMPLICIT_MASK_MASK;
! 
!     if (!glitz_surface_push_current (mask,
!                                      GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!       glitz_surface_pop_current (mask);
!       return;
!     }
! 
!     glitz_int_fill_trapezoids (GLITZ_OPERATOR_SRC,
!                                mask, -bounds.x1, -bounds.y1,
!                                &color, traps, n_traps);
! 
!     if (dst->polyopacity != 0xffff) {
!       glitz_rectangle_t rect;
!       glitz_color_t color;
! 
!       rect.x = rect.y = 0;
!       rect.width = mask->width;
!       rect.height = mask->height;
!       color.red = color.green = color.blue = color.alpha = dst->polyopacity;
!       glitz_int_fill_rectangles (GLITZ_OPERATOR_IN, mask, &color, &rect, 1);
!     }
! 
!     glitz_surface_dirty (mask, NULL);
!     glitz_surface_pop_current (mask);
!     
!     x_offset = bounds.x1;
!     y_offset = bounds.y1;
!     width = mask->width;
!     height = mask->height;
!   } else {
!     glitz_int_clip_operator_t clip_op;
!     
!     if (trap_bounds.x1 > dst->width || trap_bounds.y1 > dst->height ||
!         trap_bounds.x2 < 0 || trap_bounds.y2 < 0)
!       return;
! 
!     if (dst->clip_mask)
!       clip_op = GLITZ_INT_CLIP_OPERATOR_INCR_INTERSECT;
!     else
!       clip_op = GLITZ_INT_CLIP_OPERATOR_SET;
! 
!     glitz_int_surface_clip_trapezoids (dst,
!                                        clip_op,
!                                        dst->clip_mask + 0x1,
!                                        traps,
!                                        n_traps);
      
!     x_offset = trap_bounds.x1;
!     y_offset = trap_bounds.y1;
!     width = trap_bounds.x2 - trap_bounds.x1;
!     height = trap_bounds.y2 - trap_bounds.y1;
! 
!     if (dst->polyopacity != 0xffff) {
!       glitz_color_t color;
  
-       color.red = color.green = color.blue = color.alpha = dst->polyopacity;
-       mask = glitz_surface_create_solid (&color);
-     } else
-       mask = NULL;
-   }
-   
    glitz_composite (op,
                     src,
--- 208,240 ----
    y_dst = traps[0].left.p1.y >> 16;
  
!   if (dst->format->stencil_size < ((*dst->stencil_mask)? 2: 1)) {
!     glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
!     return;
!   }
  
    glitz_trapezoid_bounds (n_traps, traps, &trap_bounds);
+   if (trap_bounds.x1 > dst->width || trap_bounds.y1 > dst->height ||
+       trap_bounds.x2 < 0 || trap_bounds.y2 < 0)
+     return;
  
!   glitz_surface_enable_anti_aliasing (dst);
!   
!   glitz_stencil_trapezoids (dst,
!                             GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
!                             traps, n_traps);
!   
!   rect.x = trap_bounds.x1;
!   rect.y = trap_bounds.y1;
!   rect.width = trap_bounds.x2 - trap_bounds.x1;
!   rect.height = trap_bounds.y2 - trap_bounds.y1;
!   
!   if (dst->polyopacity != 0xffff) {
!     glitz_color_t color;
      
!     color.red = color.green = color.blue = color.alpha = dst->polyopacity;
!     mask = glitz_surface_create_solid (&color);
!   } else
!     mask = NULL;
  
    glitz_composite (op,
                     src,
***************
*** 293,316 ****
                     y_src + trap_bounds.y1 - y_dst,
                     0, 0,
!                    x_offset, y_offset,
!                    width, height);
  
    if (mask)
      glitz_surface_destroy (mask);
  
!   if (!use_mask) {
!     glitz_int_clip_operator_t clip_op;
!     static glitz_rectangle_t rect = { 0, 0, MAXSHORT, MAXSHORT };
!     
!     if (dst->clip_mask > 0x1)
!       clip_op = GLITZ_INT_CLIP_OPERATOR_DECR_INTERSECT;
!     else
!       clip_op = GLITZ_INT_CLIP_OPERATOR_SET;
  
!     glitz_int_surface_clip_rectangles (dst,
!                                        clip_op,
!                                        dst->clip_mask - 0x1,
!                                        &rect, 1);
!   }
  }
  slim_hidden_def(glitz_composite_trapezoids);
--- 244,258 ----
                     y_src + trap_bounds.y1 - y_dst,
                     0, 0,
!                    rect.x, rect.y,
!                    rect.width, rect.height);
  
    if (mask)
      glitz_surface_destroy (mask);
  
!   glitz_surface_disable_anti_aliasing (dst);
  
!   glitz_stencil_rectangles (dst,
!                             GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                             &rect, 1);
  }
  slim_hidden_def(glitz_composite_trapezoids);

Index: glitz_tri.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_tri.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_tri.c	24 May 2004 07:16:42 -0000	1.5
--- glitz_tri.c	11 Jun 2004 14:35:41 -0000	1.6
***************
*** 74,87 ****
  {
    glitz_gl_vertex_2d_t vertex_2d;
    
-   if (SURFACE_IMPLICIT_MASK (dst)) {
-     dst->gl->clear_color (0.0, 0.0, 0.0, 0.0);
-     dst->gl->clear (GLITZ_GL_COLOR_BUFFER_BIT);
-   }
- 
    dst->gl->color_4us (color->red, color->green, color->blue, color->alpha);
  
    glitz_set_operator (dst->gl, op);
  
    switch (type) {
    case GLITZ_TRIANGLE_TYPE_NORMAL:
--- 74,88 ----
  {
    glitz_gl_vertex_2d_t vertex_2d;
+   glitz_gl_uint_t list = 0;
    
    dst->gl->color_4us (color->red, color->green, color->blue, color->alpha);
  
    glitz_set_operator (dst->gl, op);
  
+   if (dst->multi_sample) {
+     list = dst->gl->gen_lists (1);
+     dst->gl->new_list (list, GLITZ_GL_COMPILE);
+   }
+ 
    switch (type) {
    case GLITZ_TRIANGLE_TYPE_NORMAL:
***************
*** 102,105 ****
--- 103,122 ----
    
    dst->gl->end ();
+ 
+   if (list) {
+     int i;
+     
+     dst->gl->end_list ();
+ 
+     for (i = 0; i < dst->multi_sample->n_samples; i++) {
+       dst->gl->translate_d (dst->multi_sample->offsets[i].x,
+                             -dst->multi_sample->offsets[i].y, 0.0);
+       dst->gl->call_list (list);
+       dst->gl->translate_d (-dst->multi_sample->offsets[i].x,
+                             dst->multi_sample->offsets[i].y, 0.0);
+     }
+ 
+     dst->gl->delete_lists (list, 1);
+   }
  }
  
***************
*** 148,254 ****
    glitz_surface_t *mask;
    glitz_bounding_box_t tri_bounds;
-   glitz_bool_t use_mask;
    int x_dst, y_dst;
!   int x_offset, y_offset;
!   int width, height;
  
    x_dst = points[0].x >> 16;
    y_dst = points[0].y >> 16;
  
!   if (dst->format->stencil_size > dst->clip_mask)
!     use_mask = 0;
!   else
!     use_mask = 1;
  
    glitz_point_fixed_bounds (n_points, points, &tri_bounds);
  
!   if (use_mask) {
!     glitz_bounding_box_t src_bounds, dst_bounds, bounds;
!     static glitz_color_t color = { 0xffff, 0xffff, 0xffff, 0xffff };
!     
!     glitz_surface_bounds (src, &src_bounds);
!     glitz_surface_bounds (dst, &dst_bounds);
! 
!     src_bounds.x1 += (x_dst - x_src);
!     src_bounds.y1 += (y_dst - y_src);
!     src_bounds.x2 += (x_dst - x_src);
!     src_bounds.y2 += (y_dst - y_src);
! 
!     glitz_intersect_bounding_box (&src_bounds, &tri_bounds, &bounds);
!     glitz_intersect_bounding_box (&dst_bounds, &bounds, &bounds);
! 
!     if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
!       return;
! 
!     mask = glitz_surface_create_intermediate (dst, GLITZ_INTERMEDIATE_ALPHA,
!                                               bounds.x2 - bounds.x1,
!                                               bounds.y2 - bounds.y1);
!     if (!mask)
!       return;
!     
!     mask->hint_mask |= GLITZ_INT_HINT_IMPLICIT_MASK_MASK;
! 
!     if (!glitz_surface_push_current (mask,
!                                      GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!       glitz_surface_pop_current (mask);
!       return;
!     }
! 
!     glitz_int_fill_triangles (GLITZ_OPERATOR_SRC,
!                               mask,
!                               type,
!                               -bounds.x1, -bounds.y1,
!                               &color, points, n_points);
! 
!     if (dst->polyopacity != 0xffff) {
!       glitz_rectangle_t rect;
!       glitz_color_t color;
!       
!       rect.x = rect.y = 0;
!       rect.width = mask->width;
!       rect.height = mask->height;
!       color.red = color.green = color.blue = color.alpha = dst->polyopacity;
!       glitz_int_fill_rectangles (GLITZ_OPERATOR_IN, mask, &color, &rect, 1);
!     }
! 
!     glitz_surface_dirty (mask, NULL);
!     glitz_surface_pop_current (mask);
  
!     x_offset = bounds.x1;
!     y_offset = bounds.y1;
!     width = mask->width;
!     height = mask->height;
!   } else {
!     glitz_int_clip_operator_t clip_op;
      
!     if (tri_bounds.x1 > dst->width || tri_bounds.y1 > dst->height ||
!         tri_bounds.x2 < 0 || tri_bounds.y2 < 0)
!       return;
! 
!     if (dst->clip_mask)
!       clip_op = GLITZ_INT_CLIP_OPERATOR_INCR_INTERSECT;
!     else
!       clip_op = GLITZ_INT_CLIP_OPERATOR_SET;
! 
!     glitz_int_surface_clip_triangles (dst,
!                                       clip_op,
!                                       dst->clip_mask + 0x1,
!                                       type,
!                                       points,
!                                       n_points);
      
!     x_offset = tri_bounds.x1;
!     y_offset = tri_bounds.y1;
!     width = tri_bounds.x2 - tri_bounds.x1;
!     height = tri_bounds.y2 - tri_bounds.y1;
! 
!     if (dst->polyopacity != 0xffff) {
!       glitz_color_t color;
! 
!       color.red = color.green = color.blue = color.alpha = dst->polyopacity;
!       mask = glitz_surface_create_solid (&color);
!     } else
!       mask = NULL;
!   }
  
    glitz_composite (op,
--- 165,205 ----
    glitz_surface_t *mask;
    glitz_bounding_box_t tri_bounds;
    int x_dst, y_dst;
!   glitz_rectangle_t rect;
  
    x_dst = points[0].x >> 16;
    y_dst = points[0].y >> 16;
  
!   if (dst->format->stencil_size < ((*dst->stencil_mask)? 2: 1)) {
!     glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
!     return;
!   }
  
    glitz_point_fixed_bounds (n_points, points, &tri_bounds);
  
!   if (tri_bounds.x1 > dst->width || tri_bounds.y1 > dst->height ||
!       tri_bounds.x2 < 0 || tri_bounds.y2 < 0)
!     return;
  
!   glitz_surface_enable_anti_aliasing (dst);
!   
!   glitz_stencil_triangles (dst,
!                            GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
!                            type,
!                            points,
!                            n_points);
      
!   rect.x = tri_bounds.x1;
!   rect.y = tri_bounds.y1;
!   rect.width = tri_bounds.x2 - tri_bounds.x1;
!   rect.height = tri_bounds.y2 - tri_bounds.y1;
!   
!   if (dst->polyopacity != 0xffff) {
!     glitz_color_t color;
      
!     color.red = color.green = color.blue = color.alpha = dst->polyopacity;
!     mask = glitz_surface_create_solid (&color);
!   } else
!     mask = NULL;
  
    glitz_composite (op,
***************
*** 259,282 ****
                     y_src + tri_bounds.y1 - y_dst,
                     0, 0,
!                    x_offset, y_offset,
!                    width, height);
  
    if (mask)
      glitz_surface_destroy (mask);
-   
-   if (!use_mask) {
-     glitz_int_clip_operator_t clip_op;
-     static glitz_rectangle_t rect = { 0, 0, MAXSHORT, MAXSHORT };
-     
-     if (dst->clip_mask > 0x1)
-       clip_op = GLITZ_INT_CLIP_OPERATOR_DECR_INTERSECT;
-     else
-       clip_op = GLITZ_INT_CLIP_OPERATOR_SET;
  
!     glitz_int_surface_clip_rectangles (dst,
!                                        clip_op,
!                                        dst->clip_mask - 0x1,
!                                        &rect, 1);
!   }
  }
  
--- 210,224 ----
                     y_src + tri_bounds.y1 - y_dst,
                     0, 0,
!                    rect.x, rect.y,
!                    rect.width, rect.height);
  
    if (mask)
      glitz_surface_destroy (mask);
  
!   glitz_surface_disable_anti_aliasing (dst);
!     
!   glitz_stencil_rectangles (dst,
!                             GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                             &rect, 1);
  }
  

Index: glitz_util.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_util.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glitz_util.c	13 May 2004 00:47:32 -0000	1.4
--- glitz_util.c	11 Jun 2004 14:35:41 -0000	1.5
***************
*** 80,94 ****
  }
  
- void
- glitz_union_bounding_box_double (glitz_bounding_box_double_t *box1,
-                                  glitz_bounding_box_double_t *box2,
-                                  glitz_bounding_box_double_t *return_box)
- {
-   return_box->x1 = (box1->x1 <= box2->x1)? box1->x1: box2->x1;
-   return_box->x2 = (box1->x2 >= box2->x2)? box1->x2: box2->x2;
-   return_box->y1 = (box1->y1 <= box2->y1)? box1->y1: box2->y1;
-   return_box->y2 = (box1->y2 >= box2->y2)? box1->y2: box2->y2;
- }
- 
  static int
  big_endian (void)
--- 80,83 ----

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** glitzint.h	2 Jun 2004 18:28:24 -0000	1.17
--- glitzint.h	11 Jun 2004 14:35:41 -0000	1.18
***************
*** 134,138 ****
    glitz_gl_copy_tex_sub_image_2d_t copy_tex_sub_image_2d;
    glitz_gl_get_integer_v_t get_integer_v;
! 
    glitz_gl_active_texture_arb_t active_texture_arb;
    glitz_gl_multi_tex_coord_2d_arb_t multi_tex_coord_2d_arb;
--- 134,143 ----
    glitz_gl_copy_tex_sub_image_2d_t copy_tex_sub_image_2d;
    glitz_gl_get_integer_v_t get_integer_v;
!   glitz_gl_delete_lists_t delete_lists;
!   glitz_gl_gen_lists_t gen_lists;
!   glitz_gl_new_list_t new_list;
!   glitz_gl_end_list_t end_list;
!   glitz_gl_call_list_t call_list;
!   
    glitz_gl_active_texture_arb_t active_texture_arb;
    glitz_gl_multi_tex_coord_2d_arb_t multi_tex_coord_2d_arb;
***************
*** 153,166 ****
  
  typedef enum {
!   GLITZ_PROGRAM_TYPE_NONE,
!   GLITZ_PROGRAM_TYPE_NOT_SUPPORTED,
!   GLITZ_PROGRAM_TYPE_SRC_CONVOLUTION,
!   GLITZ_PROGRAM_TYPE_SRC_CONVOLUTION_AND_SOLID_MASK,
!   GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION,
!   GLITZ_PROGRAM_TYPE_MASK_CONVOLUTION_AND_SOLID_SRC,
!   GLITZ_PROGRAM_TYPE_SRC_PROGRAMMATIC,
!   GLITZ_PROGRAM_TYPE_MASK_PROGRAMMATIC,
!   GLITZ_PROGRAM_TYPE_SIMPLE
! } glitz_program_type_t;
  
  #define GLITZ_PROGRAMMATIC_SURFACE_NUM \
--- 158,174 ----
  
  typedef enum {
!   GLITZ_RENDER_TYPE_NOT_SUPPORTED = 0,
!   GLITZ_RENDER_TYPE_SOLID,
!   GLITZ_RENDER_TYPE_SOLID_A,
!   GLITZ_RENDER_TYPE_ARGB,
!   GLITZ_RENDER_TYPE_ARGB_A,
!   GLITZ_RENDER_TYPE_ARGB_ARGB,
!   GLITZ_RENDER_TYPE_SRC_CONVOLUTION,
!   GLITZ_RENDER_TYPE_SRC_CONVOLUTION_AND_SOLID_MASK,
!   GLITZ_RENDER_TYPE_MASK_CONVOLUTION,
!   GLITZ_RENDER_TYPE_MASK_CONVOLUTION_AND_SOLID_SRC,
!   GLITZ_RENDER_TYPE_SRC_PROGRAMMATIC,
!   GLITZ_RENDER_TYPE_MASK_PROGRAMMATIC
! } glitz_render_type_t;
  
  #define GLITZ_PROGRAMMATIC_SURFACE_NUM \
***************
*** 276,283 ****
  } glitz_surface_backend_t;
  
! #define GLITZ_INT_HINT_REPEAT_MASK               (1L << 4)
! #define GLITZ_INT_HINT_IMPLICIT_MASK_MASK        (1L << 5)
! #define GLITZ_INT_HINT_DIRTY_MASK                (1L << 6)
! #define GLITZ_INT_HINT_CLEAR_EXTERIOR_MASK       (1L << 7)
  
  #define SURFACE_PROGRAMMATIC(surface) \
--- 284,290 ----
  } glitz_surface_backend_t;
  
! #define GLITZ_INT_HINT_REPEAT_MASK         (1L << 5)
! #define GLITZ_INT_HINT_DIRTY_MASK          (1L << 6)
! #define GLITZ_INT_HINT_CLEAR_EXTERIOR_MASK (1L << 7)
  
  #define SURFACE_PROGRAMMATIC(surface) \
***************
*** 292,298 ****
    (surface->hint_mask & GLITZ_INT_HINT_REPEAT_MASK)
  
- #define SURFACE_IMPLICIT_MASK(surface) \
-   (surface->hint_mask & GLITZ_INT_HINT_IMPLICIT_MASK_MASK)
- 
  #define SURFACE_DIRTY(surface) \
    (surface->hint_mask & GLITZ_INT_HINT_DIRTY_MASK)
--- 299,302 ----
***************
*** 301,304 ****
--- 305,322 ----
    (surface->hint_mask & GLITZ_INT_HINT_CLEAR_EXTERIOR_MASK)
  
+ typedef struct _glitz_sample_offset {
+   double x;
+   double y;
+ } glitz_sample_offset_t;
+ 
+ typedef struct _glitz_multi_sample_info {
+   glitz_sample_offset_t *offsets;
+   unsigned short *weights;
+   int n_samples;
+ } glitz_multi_sample_info_t;
+ 
+ /* GLITZ_BUFFER_BACK and GLITZ_BUFFER_FRONT */
+ #define GLITZ_N_STENCIL_MASKS 2
+ 
  struct _glitz_surface {
    const glitz_surface_backend_t *backend;
***************
*** 314,319 ****
    glitz_matrix_t *transform;
    glitz_matrix_t *inverse_transform;
-   glitz_matrix_t *transforms;
-   unsigned int n_transforms;
    int width, height;
    glitz_bounding_box_t dirty_box;
--- 332,335 ----
***************
*** 321,329 ****
    glitz_programs_t *programs;
    glitz_matrix_t *convolution;
!   unsigned int clip_mask;
    unsigned long hint_mask;
    unsigned short polyopacity;
    glitz_gl_enum_t draw_buffer;
    glitz_gl_enum_t read_buffer;
  };
  
--- 337,347 ----
    glitz_programs_t *programs;
    glitz_matrix_t *convolution;
!   unsigned int stencil_masks[GLITZ_N_STENCIL_MASKS];
!   unsigned int *stencil_mask;
    unsigned long hint_mask;
    unsigned short polyopacity;
    glitz_gl_enum_t draw_buffer;
    glitz_gl_enum_t read_buffer;
+   glitz_multi_sample_info_t *multi_sample;
  };
  
***************
*** 389,397 ****
  glitz_matrix_invert (glitz_matrix_t *matrix);
  
- extern void __internal_linkage
- glitz_matrix_translate (glitz_matrix_t *matrix,
-                         double tx,
-                         double ty);
- 
  extern glitz_status_t __internal_linkage
  glitz_matrix_normalize (glitz_matrix_t *matrix);
--- 407,410 ----
***************
*** 405,421 ****
  glitz_set_operator (glitz_gl_proc_address_list_t *gl, glitz_operator_t op);
  
! typedef enum glitz_int_clip_operator {
!   GLITZ_INT_CLIP_OPERATOR_SET = GLITZ_CLIP_OPERATOR_SET,
!   GLITZ_INT_CLIP_OPERATOR_UNION = GLITZ_CLIP_OPERATOR_UNION,
!   GLITZ_INT_CLIP_OPERATOR_INTERSECT = GLITZ_CLIP_OPERATOR_INTERSECT,
!   GLITZ_INT_CLIP_OPERATOR_INCR_INTERSECT,
!   GLITZ_INT_CLIP_OPERATOR_DECR_INTERSECT,
!   GLITZ_INT_CLIP_OPERATOR_CLIP
! } glitz_int_clip_operator_t;
  
  extern void __internal_linkage
! glitz_set_clip_operator (glitz_gl_proc_address_list_t *gl,
!                          glitz_int_clip_operator_t op,
!                          int mask);
  
  void
--- 418,435 ----
  glitz_set_operator (glitz_gl_proc_address_list_t *gl, glitz_operator_t op);
  
! typedef enum glitz_stencil_operator {
!   GLITZ_STENCIL_OPERATOR_SET = GLITZ_CLIP_OPERATOR_SET,
!   GLITZ_STENCIL_OPERATOR_UNION = GLITZ_CLIP_OPERATOR_UNION,
!   GLITZ_STENCIL_OPERATOR_INTERSECT = GLITZ_CLIP_OPERATOR_INTERSECT,
!   GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
!   GLITZ_STENCIL_OPERATOR_DECR_LESS,
!   GLITZ_STENCIL_OPERATOR_CLIP_EQUAL,
!   GLITZ_STENCIL_OPERATOR_CLIP
! } glitz_stencil_operator_t;
  
  extern void __internal_linkage
! glitz_set_stencil_operator (glitz_gl_proc_address_list_t *gl,
!                             glitz_stencil_operator_t op,
!                             unsigned int mask);
  
  void
***************
*** 541,560 ****
  
  extern void __internal_linkage
- glitz_surface_bounds (glitz_surface_t *surface,
-                       glitz_bounding_box_t *box);
- 
- extern void __internal_linkage
- glitz_surface_enable_program (glitz_program_type_t type,
-                               glitz_surface_t *surface,
-                               glitz_surface_t *src,
-                               glitz_surface_t *mask,
-                               glitz_texture_t *src_texture,
-                               glitz_texture_t *mask_texture);
- 
- extern void __internal_linkage
- glitz_surface_disable_program (glitz_program_type_t type,
-                                glitz_surface_t *surface);
- 
- extern void __internal_linkage
  glitz_surface_dirty (glitz_surface_t *surface,
                       glitz_bounding_box_t *box);
--- 555,558 ----
***************
*** 566,569 ****
--- 564,573 ----
  glitz_surface_setup_environment (glitz_surface_t *surface);
  
+ extern void __internal_linkage
+ glitz_surface_enable_anti_aliasing (glitz_surface_t *surface);
+ 
+ extern void __internal_linkage
+ glitz_surface_disable_anti_aliasing (glitz_surface_t *surface);
+ 
  extern glitz_status_t __internal_linkage
  glitz_status_pop_from_mask (unsigned long *mask);
***************
*** 571,575 ****
  typedef enum {
    GLITZ_INTERMEDIATE_ALPHA,
!   GLITZ_INTERMEDIATE_RGBA
  } glitz_intermediate_t;
  
--- 575,580 ----
  typedef enum {
    GLITZ_INTERMEDIATE_ALPHA,
!   GLITZ_INTERMEDIATE_RGBA,
!   GLITZ_INTERMEDIATE_RGBA_STENCIL
  } glitz_intermediate_t;
  
***************
*** 580,605 ****
                                     int height);
  
- extern void __internal_linkage
- glitz_int_surface_clip_rectangles (glitz_surface_t *surface,
-                                    glitz_int_clip_operator_t op,
-                                    int mask,
-                                    const glitz_rectangle_t *rects,
-                                    int n_rects);
- 
- extern void __internal_linkage
- glitz_int_surface_clip_trapezoids (glitz_surface_t *surface,
-                                    glitz_int_clip_operator_t op,
-                                    int mask,
-                                    const glitz_trapezoid_t *traps,
-                                    int n_traps);
- 
- extern void __internal_linkage
- glitz_int_surface_clip_triangles (glitz_surface_t *surface,
-                                   glitz_int_clip_operator_t op,
-                                   int mask,
-                                   glitz_triangle_type_t type,
-                                   const glitz_point_fixed_t *points,
-                                   int n_points);
- 
  glitz_format_t *
  glitz_format_find (glitz_format_t *formats,
--- 585,588 ----
***************
*** 618,638 ****
  glitz_format_calculate_pixel_transfer_info (glitz_format_t *format);
  
- extern glitz_program_type_t __internal_linkage
- glitz_program_type (glitz_surface_t *dst,
-                     glitz_surface_t *src,
-                     glitz_surface_t *mask);
- 
- extern void __internal_linkage
- glitz_program_enable (glitz_program_type_t type,
-                       glitz_surface_t *dst,
-                       glitz_surface_t *src,
-                       glitz_surface_t *mask,
-                       glitz_texture_t *src_texture,
-                       glitz_texture_t *mask_texture);
- 
- extern void __internal_linkage
- glitz_program_disable (glitz_program_type_t type,
-                        glitz_surface_t *dst);
- 
  void
  glitz_programs_fini (glitz_gl_proc_address_list_t *gl,
--- 601,604 ----
***************
*** 647,651 ****
  glitz_programmatic_surface_bind (glitz_gl_proc_address_list_t *proc_address,
                                   glitz_programmatic_surface_t *surface,
!                                  unsigned long feature_mask);
  
  extern glitz_surface_t *__internal_linkage
--- 613,618 ----
  glitz_programmatic_surface_bind (glitz_gl_proc_address_list_t *proc_address,
                                   glitz_programmatic_surface_t *surface,
!                                  unsigned long feature_mask,
!                                  unsigned short opacity);
  
  extern glitz_surface_t *__internal_linkage
***************
*** 701,704 ****
--- 668,733 ----
                            int n_points);
  
+ extern void __internal_linkage
+ glitz_program_enable_argb_argb (glitz_gl_proc_address_list_t *gl,
+                                 glitz_programs_t *programs,
+                                 glitz_texture_t *src_texture,
+                                 glitz_texture_t *mask_texture);
+ 
+ extern void __internal_linkage
+ glitz_program_enable_convolution (glitz_gl_proc_address_list_t *gl,
+                                   glitz_programs_t *programs,
+                                   glitz_surface_t *src,
+                                   glitz_surface_t *mask,
+                                   glitz_texture_t *src_texture,
+                                   glitz_texture_t *mask_texture,
+                                   int offset,
+                                   int solid_offset,
+                                   unsigned short opacity);
+ 
+ extern void __internal_linkage
+ glitz_program_enable_programmatic (glitz_surface_t *dst,
+                                    glitz_programmatic_surface_t *surface,
+                                    glitz_texture_t *src_texture,
+                                    glitz_texture_t *mask_texture,
+                                    int offset,
+                                    unsigned short opacity);
+ 
+ extern void __internal_linkage
+ glitz_stencil_rectangles (glitz_surface_t *dst,
+                           glitz_stencil_operator_t op,
+                           const glitz_rectangle_t *rects,
+                           int n_rects);
+ 
+ extern void __internal_linkage
+ glitz_stencil_trapezoids (glitz_surface_t *dst,
+                           glitz_stencil_operator_t op,
+                           const glitz_trapezoid_t *traps,
+                           int n_traps);
+ 
+ extern void __internal_linkage
+ glitz_stencil_triangles (glitz_surface_t *dst,
+                          glitz_stencil_operator_t op,
+                          glitz_triangle_type_t type,
+                          const glitz_point_fixed_t *points,
+                          int n_points);
+ 
+ extern glitz_render_type_t __internal_linkage
+ glitz_render_type (glitz_surface_t *dst,
+                    glitz_surface_t *src,
+                    glitz_surface_t *mask);
+ 
+ extern void __internal_linkage
+ glitz_render_enable (glitz_render_type_t type,
+                      glitz_surface_t *src,
+                      glitz_surface_t *mask,
+                      glitz_surface_t *dst,
+                      glitz_texture_t *src_texture,
+                      glitz_texture_t *mask_texture,
+                      unsigned short opacity);
+ 
+ extern void __internal_linkage
+ glitz_render_disable (glitz_render_type_t type,
+                       glitz_surface_t *dst);
+ 
  #define MAXSHORT SHRT_MAX
  #define MINSHORT SHRT_MIN
***************
*** 743,751 ****
  #define INT_TO_FIXED(i) ((glitz_fixed) (i) << FIXED_BITS)
  #define FIXED_E ((glitz_fixed) 1)
! #define FIXED1 (INT_TO_FIXED(1))
  #define FIXED1_MINUS_E (FIXED1 - FIXED_E)
  #define FIXED_FRAC(f) ((f) & FIXED1_MINUS_E)
  #define FIXED_FLOOR(f) ((f) & ~FIXED1_MINUS_E)
! #define FIXED_CEIL(f) FIXED_FLOOR((f) + FIXED1_MINUS_E)
  
  #define FIXED_FRACTION(f) ((f) & FIXED1_MINUS_E)
--- 772,780 ----
  #define INT_TO_FIXED(i) ((glitz_fixed) (i) << FIXED_BITS)
  #define FIXED_E ((glitz_fixed) 1)
! #define FIXED1 (INT_TO_FIXED (1))
  #define FIXED1_MINUS_E (FIXED1 - FIXED_E)
  #define FIXED_FRAC(f) ((f) & FIXED1_MINUS_E)
  #define FIXED_FLOOR(f) ((f) & ~FIXED1_MINUS_E)
! #define FIXED_CEIL(f) FIXED_FLOOR ((f) + FIXED1_MINUS_E)
  
  #define FIXED_FRACTION(f) ((f) & FIXED1_MINUS_E)
***************
*** 755,758 ****
--- 784,790 ----
  #define DOUBLE_TO_FIXED(f) ((int) ((f) * 65536))
  
+ #define SHORT_MODULATE(s1, s2) \
+   ((unsigned short) (((unsigned int) s1 * s2) / 0xffff))
+ 
  typedef void (*glitz_function_pointer_t) (void);
  





More information about the cairo-commit mailing list