[cairo-commit] glitz/src Makefile.am, 1.5, 1.6 glitz.c, 1.19, 1.20 glitz.h, 1.17, 1.18 glitz_agl_extension.c, 1.5, 1.6 glitz_agl_format.c, 1.5, 1.6 glitz_agl_info.c, 1.8, 1.9 glitz_agl_pbuffer.c, 1.5, 1.6 glitz_agl_surface.c, 1.14, 1.15 glitz_aglint.h, 1.8, 1.9 glitz_compose.c, 1.1, 1.2 glitz_filter.c, 1.1, 1.2 glitz_gl.h, 1.6, 1.7 glitz_glx_context.c, 1.10, 1.11 glitz_glx_extension.c, 1.8, 1.9 glitz_glx_format.c, 1.8, 1.9 glitz_glx_info.c, 1.13, 1.14 glitz_glx_surface.c, 1.16, 1.17 glitz_glxint.h, 1.12, 1.13 glitz_matrix.c, 1.7, NONE glitz_pixel.c, 1.3, 1.4 glitz_program.c, 1.10, 1.11 glitz_rect.c, 1.6, 1.7 glitz_stencil.c, 1.2, 1.3 glitz_surface.c, 1.17, 1.18 glitz_trap.c, 1.7, 1.8 glitz_tri.c, 1.7, 1.8 glitz_util.c, 1.7, 1.8 glitzint.h, 1.21, 1.22

David Reveman commit at pdx.freedesktop.org
Wed Aug 18 05:30:27 PDT 2004


Committed by: davidr

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

Modified Files:
	Makefile.am glitz.c glitz.h glitz_agl_extension.c 
	glitz_agl_format.c glitz_agl_info.c glitz_agl_pbuffer.c 
	glitz_agl_surface.c glitz_aglint.h glitz_compose.c 
	glitz_filter.c glitz_gl.h glitz_glx_context.c 
	glitz_glx_extension.c glitz_glx_format.c glitz_glx_info.c 
	glitz_glx_surface.c glitz_glxint.h glitz_pixel.c 
	glitz_program.c glitz_rect.c glitz_stencil.c glitz_surface.c 
	glitz_trap.c glitz_tri.c glitz_util.c glitzint.h 
Removed Files:
	glitz_matrix.c 
Log Message:
New trapezoid type and new filters

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/glitz/src/Makefile.am,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** Makefile.am	9 Aug 2004 22:57:35 -0000	1.5
--- Makefile.am	18 Aug 2004 12:30:24 -0000	1.6
***************
*** 35,39 ****
  	glitz_tri.c \
  	glitz_status.c \
- 	glitz_matrix.c \
  	glitz_util.c \
  	glitz_format.c \
--- 35,38 ----

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** glitz.c	9 Aug 2004 22:57:35 -0000	1.19
--- glitz.c	18 Aug 2004 12:30:24 -0000	1.20
***************
*** 30,33 ****
--- 30,39 ----
  #include "glitzint.h"
  
+ #define SET_COLOR(color, set_red, set_green, set_blue, set_alpha) \
+   (color).red = (set_red); \
+   (color).green = (set_green); \
+   (color).blue = (set_blue); \
+   (color).alpha = (set_alpha)
+ 
  glitz_gl_uint_t _texture_units[] = {
    GLITZ_GL_TEXTURE0,
***************
*** 41,52 ****
  } glitz_texture_unit_t;
  
- typedef enum {
-   GLITZ_REPEAT_NONE = 0,
-   GLITZ_REPEAT_SOUTHEAST,
-   GLITZ_REPEAT_SOUTHWEST,
-   GLITZ_REPEAT_NORTHEAST,
-   GLITZ_REPEAT_NORTHWEST
- } glitz_repeat_direction_t;
- 
  void
  glitz_composite (glitz_operator_t op,
--- 47,50 ----
***************
*** 67,74 ****
    glitz_bounding_box_t rect;
    glitz_composite_op_t comp_op;
!   glitz_gl_uint_t list = 0;
!   int i, texture_nr = -1;
    glitz_texture_t *stexture, *mtexture;
    glitz_texture_unit_t textures[3];
  
    if (width <= 0 || height <= 0)
--- 65,75 ----
    glitz_bounding_box_t rect;
    glitz_composite_op_t comp_op;
!   int i, passes, texture_nr = -1;
    glitz_texture_t *stexture, *mtexture;
    glitz_texture_unit_t textures[3];
+   glitz_point_t t0_tl, t0_br, t1_tl, t1_br;
+   glitz_gl_enum_t t0 = 0x0, t1 = 0x0;
+   glitz_point_t *tl, *br;
+   glitz_color_t alpha_mask;
  
    if (width <= 0 || height <= 0)
***************
*** 83,86 ****
--- 84,125 ----
    src = comp_op.src;
    mask = comp_op.mask;
+ 
+   if (src && 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 && 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);
+   }
    
    if (comp_op.type == GLITZ_COMBINE_TYPE_INTERMEDIATE) {
***************
*** 166,321 ****
    rect.x2 = rect.x1 + width;
    rect.y2 = rect.y1 + height;
- 
-   if (comp_op.hw_wrap) {
-     glitz_point_t t0_tl, t0_br, t1_tl, t1_br;
-     glitz_gl_enum_t t0 = 0x0, t1 = 0x0;
-     glitz_point_t *tl, *br;
      
!     if (mtexture) {
!       textures[0].texture = mtexture;
!       textures[0].unit = _texture_units[0];
!       texture_nr = 0;
        
!       glitz_texture_bind (gl, mtexture);
! 
!       tl = &t0_tl;
!       br = &t0_br;
!       t0 = textures[0].unit;
! 
        if (SURFACE_WINDOW_SPACE_TEXCOORDS (mask)) {
!         tl->x = x_mask;
!         tl->y = y_mask;
!         br->x = x_mask + width;
!         br->y = y_mask + height;
        } else {
-         glitz_texture_tex_coord (mtexture, x_mask, y_mask, &tl->x, &tl->y);
-         glitz_texture_tex_coord (mtexture, x_mask + width, y_mask + height,
-                                  &br->x, &br->y);
-       }
-       
-       gl->matrix_mode (GLITZ_GL_TEXTURE);
-       gl->load_identity ();
-       
-       if (mask->transform) {
-         if (SURFACE_WINDOW_SPACE_TEXCOORDS (mask)) {
-           gl->mult_matrix_d (mask->transform->m);
-         } else {
            gl->scale_d (1.0, -1.0, 1.0);
            gl->translate_d (0.0, -mtexture->texcoord_height, 0.0);
            gl->mult_matrix_d (mask->transform->m_norm);
-         }
-         
-         if (SURFACE_LINEAR_TRANSFORM (mask))
-           glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_LINEAR);
-         else
-           glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_NEAREST);
-       } else {
-         if (!SURFACE_WINDOW_SPACE_TEXCOORDS (mask)) {
-           tl->y = mtexture->texcoord_height - tl->y;
-           br->y = mtexture->texcoord_height - br->y;
-         }
-         
-         if (SURFACE_LINEAR_NON_TRANSFORM (mask))
-           glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_LINEAR);
-         else
-           glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_NEAREST);
        }
        
!       if (SURFACE_REPEAT (mask)) {
!         if (SURFACE_MIRRORED (mask))
!           glitz_texture_ensure_wrap (gl, mtexture, GLITZ_GL_MIRRORED_REPEAT);
!         else
!           glitz_texture_ensure_wrap (gl, mtexture, GLITZ_GL_REPEAT);
!       } else {
!         if (SURFACE_PAD (mask))
!           glitz_texture_ensure_wrap (gl, mtexture, GLITZ_GL_CLAMP_TO_EDGE);
!         else
!           glitz_texture_ensure_wrap (gl, mtexture, GLITZ_GL_CLAMP_TO_BORDER);
        }
      }
      
!     if (stexture) {
!       int last_texture_nr = comp_op.combine->texture_units - 1;
!       
!       while (texture_nr < last_texture_nr) {
!         textures[++texture_nr].texture = stexture;
!         textures[texture_nr].unit = _texture_units[texture_nr];
!         if (texture_nr > 0)
!           gl->active_texture (textures[texture_nr].unit);
!         glitz_texture_bind (gl, stexture);
!       }
  
!       if (t0) {
!         tl = &t1_tl;
!         br = &t1_br;
!         t1 = textures[texture_nr].unit;
!       } else {
!         tl = &t0_tl;
!         br = &t0_br;
!         t0 = textures[texture_nr].unit;
!       }
  
        if (SURFACE_WINDOW_SPACE_TEXCOORDS (src)) {
!         tl->x = x_src;
!         tl->y = y_src;
!         br->x = x_src + width;
!         br->y = y_src + height;
        } else {
!         glitz_texture_tex_coord (stexture, x_src, y_src, &tl->x, &tl->y);
!         glitz_texture_tex_coord (stexture, x_src + width, y_src + height,
!                                  &br->x, &br->y);
        }
  
!       gl->matrix_mode (GLITZ_GL_TEXTURE);
!       gl->load_identity ();
! 
!       if (src->transform) {
!         if (SURFACE_WINDOW_SPACE_TEXCOORDS (src)) {
!           gl->mult_matrix_d (src->transform->m);
!         } else {
!           gl->scale_d (1.0, -1.0, 1.0);
!           gl->translate_d (0.0, -stexture->texcoord_height, 0.0);
!           gl->mult_matrix_d (src->transform->m_norm);
!         }
! 
!         if (SURFACE_LINEAR_TRANSFORM (src))
!           glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_LINEAR);
!         else
!           glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_NEAREST);
!       } else {
!         if (!SURFACE_WINDOW_SPACE_TEXCOORDS (src)) {
!           tl->y = stexture->texcoord_height - tl->y;
!           br->y = stexture->texcoord_height - br->y;
!         }
!     
!         if (SURFACE_LINEAR_NON_TRANSFORM (src))
!           glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_LINEAR);
!         else
!           glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_NEAREST);
        }
        
!       if (SURFACE_REPEAT (src)) {
!         if (SURFACE_MIRRORED (src))
!           glitz_texture_ensure_wrap (gl, stexture, GLITZ_GL_MIRRORED_REPEAT);
!         else
!           glitz_texture_ensure_wrap (gl, stexture, GLITZ_GL_REPEAT);
!       } else {
!         if (SURFACE_PAD (src))
!           glitz_texture_ensure_wrap (gl, stexture, GLITZ_GL_CLAMP_TO_EDGE);
!         else
!           glitz_texture_ensure_wrap (gl, stexture, GLITZ_GL_CLAMP_TO_BORDER);
!       }
      }
  
!     glitz_set_operator (gl, op);
  
!     if (dst->multi_sample || comp_op.component_alpha) {
!       list = gl->gen_lists (1);
!       gl->new_list (list, GLITZ_GL_COMPILE);
!     } else
!       glitz_composite_enable (&comp_op);
      
      gl->begin (GLITZ_GL_QUADS);
! 
      if (t0) gl->tex_coord_2d (t0_tl.x, t0_tl.y);
      if (t1) gl->multi_tex_coord_2d (t1, t1_tl.x, t1_tl.y);
--- 205,387 ----
    rect.x2 = rect.x1 + width;
    rect.y2 = rect.y1 + height;
      
!   if (mtexture) {
!     textures[0].texture = mtexture;
!     textures[0].unit = _texture_units[0];
!     texture_nr = 0;
!     
!     glitz_texture_bind (gl, mtexture);
!     
!     tl = &t0_tl;
!     br = &t0_br;
!     t0 = textures[0].unit;
        
!     if (SURFACE_WINDOW_SPACE_TEXCOORDS (mask)) {
!       tl->x = x_mask;
!       tl->y = y_mask;
!       br->x = x_mask + width;
!       br->y = y_mask + height;
!     } else {
!       glitz_texture_tex_coord (mtexture, x_mask, y_mask, &tl->x, &tl->y);
!       glitz_texture_tex_coord (mtexture, x_mask + width, y_mask + height,
!                                &br->x, &br->y);
!     }
!     
!     gl->matrix_mode (GLITZ_GL_TEXTURE);
!     gl->load_identity ();
!     
!     if (mask->transform) {
        if (SURFACE_WINDOW_SPACE_TEXCOORDS (mask)) {
!         gl->mult_matrix_d (mask->transform->m);
        } else {
            gl->scale_d (1.0, -1.0, 1.0);
            gl->translate_d (0.0, -mtexture->texcoord_height, 0.0);
            gl->mult_matrix_d (mask->transform->m_norm);
        }
        
!       if (SURFACE_LINEAR_TRANSFORM_FILTER (mask))
!         glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_LINEAR);
!       else
!         glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_NEAREST);
!     } else {
!       if (!SURFACE_WINDOW_SPACE_TEXCOORDS (mask)) {
!         tl->y = mtexture->texcoord_height - tl->y;
!         br->y = mtexture->texcoord_height - br->y;
        }
+       
+       glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_NEAREST);
      }
      
!     if (SURFACE_REPEAT (mask)) {
!       if (SURFACE_MIRRORED (mask))
!         glitz_texture_ensure_wrap (gl, mtexture, GLITZ_GL_MIRRORED_REPEAT);
!       else
!         glitz_texture_ensure_wrap (gl, mtexture, GLITZ_GL_REPEAT);
!     } else {
!       if (SURFACE_PAD (mask) || SURFACE_CLIP (mask))
!         glitz_texture_ensure_wrap (gl, mtexture, GLITZ_GL_CLAMP_TO_EDGE);
!       else
!         glitz_texture_ensure_wrap (gl, mtexture, GLITZ_GL_CLAMP_TO_BORDER);
!     }
!   }
!     
!   if (stexture) {
!     int last_texture_nr = comp_op.combine->texture_units - 1;
!     
!     while (texture_nr < last_texture_nr) {
!       textures[++texture_nr].texture = stexture;
!       textures[texture_nr].unit = _texture_units[texture_nr];
!       if (texture_nr > 0)
!         gl->active_texture (textures[texture_nr].unit);
!       glitz_texture_bind (gl, stexture);
!     }
!     
!     if (t0) {
!       tl = &t1_tl;
!       br = &t1_br;
!       t1 = textures[texture_nr].unit;
!     } else {
!       tl = &t0_tl;
!       br = &t0_br;
!       t0 = textures[texture_nr].unit;
!     }
!     
!     if (SURFACE_WINDOW_SPACE_TEXCOORDS (src)) {
!       tl->x = x_src;
!       tl->y = y_src;
!       br->x = x_src + width;
!       br->y = y_src + height;
!     } else {
!       glitz_texture_tex_coord (stexture, x_src, y_src, &tl->x, &tl->y);
!       glitz_texture_tex_coord (stexture, x_src + width, y_src + height,
!                                &br->x, &br->y);
!     }
  
!     gl->matrix_mode (GLITZ_GL_TEXTURE);
!     gl->load_identity ();
  
+     if (src->transform) {
        if (SURFACE_WINDOW_SPACE_TEXCOORDS (src)) {
!         gl->mult_matrix_d (src->transform->m);
        } else {
!         gl->scale_d (1.0, -1.0, 1.0);
!         gl->translate_d (0.0, -stexture->texcoord_height, 0.0);
!         gl->mult_matrix_d (src->transform->m_norm);
        }
  
!       if (SURFACE_LINEAR_TRANSFORM_FILTER (src))
!         glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_LINEAR);
!       else
!         glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_NEAREST);
!     } else {
!       if (!SURFACE_WINDOW_SPACE_TEXCOORDS (src)) {
!         tl->y = stexture->texcoord_height - tl->y;
!         br->y = stexture->texcoord_height - br->y;
        }
+     
+       glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_NEAREST);
+     }
        
!     if (SURFACE_REPEAT (src)) {
!       if (SURFACE_MIRRORED (src))
!         glitz_texture_ensure_wrap (gl, stexture, GLITZ_GL_MIRRORED_REPEAT);
!       else
!         glitz_texture_ensure_wrap (gl, stexture, GLITZ_GL_REPEAT);
!     } else {
!       if (SURFACE_PAD (src) || SURFACE_CLIP (src))
!         glitz_texture_ensure_wrap (gl, stexture, GLITZ_GL_CLAMP_TO_EDGE);
!       else
!         glitz_texture_ensure_wrap (gl, stexture, GLITZ_GL_CLAMP_TO_BORDER);
      }
+   }
  
!   glitz_set_operator (gl, op);
  
!   if (dst->multi_sample)
!     passes = dst->multi_sample->n_samples;
!   else if (comp_op.component_alpha)
!     passes = comp_op.component_alpha;
!   else
!     passes = 1;
! 
!   alpha_mask = comp_op.alpha_mask;
! 
!   for (i = 0; i < passes; i++) {
!     if (dst->multi_sample) {
!       if ((i + 1) == passes)
!         glitz_set_stencil_operator (gl, GLITZ_STENCIL_OPERATOR_CLIP,
!                                     (*dst->stencil_mask & ~0x1) | (i + 1));
!       else
!         glitz_set_stencil_operator (gl, GLITZ_STENCIL_OPERATOR_CLIP_EQUAL,
!                                     (*dst->stencil_mask & ~0x1) | (i + 1));
! 
!       SET_COLOR (comp_op.alpha_mask, 0x0, 0x0, 0x0,
!                  SHORT_MULT (dst->multi_sample->weights[i], alpha_mask.alpha));
!       
!     } else if (comp_op.component_alpha) {
!       switch (i) {
!       case 0:
!         SET_COLOR (comp_op.alpha_mask, alpha_mask.red, 0x0, 0x0, 0x0);
!         gl->color_mask (1, 0, 0, 0);
!         break;
!       case 1:
!         SET_COLOR (comp_op.alpha_mask, 0x0, 0x0, alpha_mask.blue, 0x0);
!         gl->color_mask (0, 0, 1, 0);
!         break;
!       case 2:
!         SET_COLOR (comp_op.alpha_mask, 0x0, alpha_mask.green, 0x0, 0x0);
!         gl->color_mask (0, 1, 0, (passes == 4)? 0: 1);
!         break;
!       case 3:
!         SET_COLOR (comp_op.alpha_mask, 0x0, 0x0, 0x0, alpha_mask.alpha);
!         gl->color_mask (0, 0, 0, 1);
!         break;
!       }
!     }
!   
!     glitz_composite_enable (&comp_op);
      
      gl->begin (GLITZ_GL_QUADS);
!     
      if (t0) gl->tex_coord_2d (t0_tl.x, t0_tl.y);
      if (t1) gl->multi_tex_coord_2d (t1, t1_tl.x, t1_tl.y);
***************
*** 325,329 ****
      if (t1) gl->multi_tex_coord_2d (t1, t1_br.x, t1_tl.y);
      gl->vertex_2d (rect.x2, rect.y1);
!     
      if (t0) gl->tex_coord_2d (t0_br.x, t0_br.y);
      if (t1) gl->multi_tex_coord_2d (t1, t1_br.x, t1_br.y);
--- 391,395 ----
      if (t1) gl->multi_tex_coord_2d (t1, t1_br.x, t1_tl.y);
      gl->vertex_2d (rect.x2, rect.y1);
!   
      if (t0) gl->tex_coord_2d (t0_br.x, t0_br.y);
      if (t1) gl->multi_tex_coord_2d (t1, t1_br.x, t1_br.y);
***************
*** 335,630 ****
      
      gl->end ();
- 
-   } else {
- 
-     /*
-       This is a fall-back case that is used when texture is not
-       repeatable or GL_ARB_texture_border_clamp extension is missing.
-       It's slow and there are several problems with it. These are the
-       most critical ones:
-        
-       1. the complete destination area might not be rasterized when
-       source surface is non-repeating. (can be fixed)
-       
-       2. surface border colors are never correct. (cannot be fixed)
-       
-       3. really evil transformations are very slow and can possibly
-       loop almost forever. (hard to fix)
- 
-       Due to these problems a surface correctness hint is available
-       and when set to QUALITY, glitz will never use this fall-back case
-       and instead report that the desired operation is not supported.
- 
-       The best would be to remove this code, but as that would make
-       GL_ARB_texture_border_clamp a required extension and REPEAT and
-       REFLECT fill types with NPOT textures would require NPOT texture
-       support, this is not yet possible.
-     */
-     
-     glitz_point_t tl, bl, br, tr;
-     glitz_point_t base_tl, base_bl, base_br, base_tr;
-     int surface_width, surface_height, surface_x, surface_y,
-       x_dir, y_dir, continue_y, continue_x, x_is_ok, y_is_ok,
-       in_destination_area;
-     double save_base_x1, save_base_x2, min, max;
-     glitz_repeat_direction_t repeat_direction;
-     glitz_bool_t repeat;
-     glitz_matrix_t *transform;
-     glitz_texture_t *texture;
- 
-     if (stexture) {
-       textures[0].texture = texture = stexture;
-       textures[0].unit = _texture_units[0];
-       texture_nr = 0;
- 
-       glitz_texture_bind (gl, stexture);
- 
-       if (src->transform && SURFACE_LINEAR_TRANSFORM (src))
-         glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_LINEAR);
-       else
-         glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_NEAREST);
- 
-       repeat = SURFACE_REPEAT (src);
-       transform = glitz_surface_get_affine_transform (src);
-       surface_width = src->width;
-       surface_height = src->height;
-       surface_x = x_src;
-       surface_y = y_src;
-     } else {
-       textures[0].texture = texture = mtexture;
-       textures[0].unit = _texture_units[0];
-       texture_nr = 0;
- 
-       glitz_texture_bind (gl, mtexture);
- 
-       if (mask->transform && SURFACE_LINEAR_TRANSFORM (mask))
-         glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_LINEAR);
-       else
-         glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_NEAREST);
- 
-       repeat = SURFACE_REPEAT (mask);
-       transform = glitz_surface_get_affine_transform (mask);
-       surface_width = mask->width;
-       surface_height = mask->height;
-       surface_x = x_mask;
-       surface_y = y_mask;
-     }
- 
-     gl->matrix_mode (GLITZ_GL_TEXTURE);
-     gl->load_identity ();
-     
-     glitz_texture_ensure_wrap (gl, texture, GLITZ_GL_CLAMP_TO_EDGE);
- 
-     gl->enable (GLITZ_GL_SCISSOR_TEST);
-     gl->scissor (rect.x1, dst->height - (rect.y1 + height), width, height);
-     dst->update_mask |= GLITZ_UPDATE_SCISSOR_MASK;
-     
-     glitz_set_operator (gl, op);
-     
-     base_bl.x = base_tl.x = 0;
-     base_tr.y = base_tl.y = 0;
-     base_tr.x = base_br.x = surface_width;
-     base_bl.y = base_br.y = surface_height;
- 
-     /* Start repeating in southeast direction */
-     repeat_direction = GLITZ_REPEAT_SOUTHEAST;
-     x_dir = y_dir = 1;
-     
-     if (dst->multi_sample || comp_op.component_alpha) {
-       list = gl->gen_lists (1);
-       gl->new_list (list, GLITZ_GL_COMPILE);
-     } else
-       glitz_composite_enable (&comp_op);
-     
-     while (repeat_direction) {
-       save_base_x1 = base_tl.x;
-       save_base_x2 = base_tr.x;
-       
-       do {
-         continue_y = continue_x = in_destination_area = 0;
-         do {
-           bl = base_bl;
-           br = base_br;
-           tl = base_tl;
-           tr = base_tr;
-         
-           if (transform) {
-             glitz_matrix_transform_point (transform, &tl.x, &tl.y);
-             glitz_matrix_transform_point (transform, &bl.x, &bl.y);
-             glitz_matrix_transform_point (transform, &tr.x, &tr.y);
-             glitz_matrix_transform_point (transform, &br.x, &br.y);
-           }
-     
-           tl.x += x_dst - surface_x;
-           bl.x += x_dst - surface_x;
-           tr.x += x_dst - surface_x;
-           br.x += x_dst - surface_x;
-           
-           tl.y += y_dst - surface_y;
-           bl.y += y_dst - surface_y;
-           tr.y += y_dst - surface_y;
-           br.y += y_dst - surface_y;
- 
-           min = MIN (tl.x, MIN (bl.x, MIN (tr.x, br.x)));
-           max = MAX (tl.x, MAX (bl.x, MAX (tr.x, br.x)));
-           
-           if ((min > (x_dst + width)) || (max < x_dst))
-             x_is_ok = 0;
-           else
-             x_is_ok = 1;
- 
-           min = MIN (tl.y, MIN (bl.y, MIN (tr.y, br.y)));
-           max = MAX (tl.y, MAX (bl.y, MAX (tr.y, br.y)));
- 
-           if ((min > (y_dst + height)) || (max < y_dst))
-             y_is_ok = 0;
-           else
-             y_is_ok = 1;
- 
-           if (x_is_ok && y_is_ok) {
-             gl->begin (GLITZ_GL_QUADS);
-             gl->tex_coord_2d (0.0, texture->texcoord_height);
-             gl->vertex_2d (tl.x, tl.y);
-             gl->tex_coord_2d (texture->texcoord_width,
-                               texture->texcoord_height);
-             gl->vertex_2d (tr.x, tr.y);
-             gl->tex_coord_2d (texture->texcoord_width, 0.0);
-             gl->vertex_2d (br.x, br.y);
-             gl->tex_coord_2d (0.0, 0.0);
-             gl->vertex_2d (bl.x, bl.y);
-             gl->end ();
-             in_destination_area = 1;
-           }
- 
-           if (repeat) {
-             base_bl.x += surface_width * x_dir;
-             base_tl.x += surface_width * x_dir;
-             base_tr.x += surface_width * x_dir;
-             base_br.x += surface_width * x_dir;
- 
-             if (y_is_ok)
-               continue_y = 1;
- 
-             if (in_destination_area)
-               continue_x = (x_is_ok && y_is_ok);
-             else
-               continue_x = (x_is_ok || y_is_ok);
-           }
-         } while (repeat && continue_x);
- 
-         if (repeat) {
-           base_bl.y += surface_height * y_dir;
-           base_tl.y += surface_height * y_dir;
-           base_tr.y += surface_height * y_dir;
-           base_br.y += surface_height * y_dir;
- 
-           base_tl.x = base_bl.x = save_base_x1;
-           base_tr.x = base_br.x = save_base_x2;
-         }
-       } while (repeat && continue_y);
      
-       if (transform && repeat) {
-         switch (repeat_direction) {
-         case GLITZ_REPEAT_SOUTHEAST:
-           y_dir = -1;
-           base_tl.y = base_tr.y = -surface_height;
-           base_bl.y = base_br.y = 0.0;
-           repeat_direction = GLITZ_REPEAT_SOUTHWEST;
-           break;
-         case GLITZ_REPEAT_SOUTHWEST:
-           x_dir = -1;
-           base_tl.y = base_tr.y = -surface_height;
-           base_bl.y = base_br.y = 0.0;
-           base_tl.x = base_bl.x = -surface_width;
-           base_tr.x = base_br.x = 0.0;
-           repeat_direction = GLITZ_REPEAT_NORTHEAST;
-           break;
-         case GLITZ_REPEAT_NORTHEAST:
-           y_dir = 1;
-           base_tl.y = base_tr.y = 0.0;
-           base_bl.y = base_br.y = surface_height;
-           base_tl.x = base_bl.x = -surface_width;
-           base_tr.x = base_br.x = 0.0;
-           repeat_direction = GLITZ_REPEAT_NORTHWEST;
-           break;
-         case GLITZ_REPEAT_NORTHWEST:
-           repeat_direction = GLITZ_REPEAT_NONE;
-           break;
-         case GLITZ_REPEAT_NONE:
-           break;
-         }
-       } else
-         repeat_direction = GLITZ_REPEAT_NONE;
-     }
    }
  
!   if (list) {
!     gl->end_list ();
!     
!     if (dst->multi_sample) {
!       unsigned int mask = *dst->stencil_mask & ~0x1;
!       unsigned short alpha, opacity;
!       int i;
!     
!       glitz_composite_op_get_alpha_mask (&comp_op, NULL, NULL, NULL, &opacity);
!     
!       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));
!         
!         alpha = SHORT_MULT (dst->multi_sample->weights[i], opacity);
!         glitz_composite_op_set_alpha_mask (&comp_op, 0x0, 0x0, 0x0, alpha);
!         
!         glitz_composite_enable (&comp_op);
!         
!         gl->call_list (list);
!       }
!     } else {
!       glitz_color_t alpha_mask;
!       
!       glitz_composite_op_get_alpha_mask (&comp_op,
!                                          &alpha_mask.red,
!                                          &alpha_mask.green,
!                                          &alpha_mask.blue,
!                                          &alpha_mask.alpha);
!       
!       glitz_composite_op_set_alpha_mask (&comp_op, alpha_mask.red, 0, 0, 0);
!       glitz_composite_enable (&comp_op);
!       gl->color_mask (1, 0, 0, 0);
!       gl->call_list (list);
! 
!       glitz_composite_op_set_alpha_mask (&comp_op, 0, 0, alpha_mask.blue, 0);
!       glitz_composite_enable (&comp_op);
!       gl->color_mask (0, 0, 1, 0);
!       gl->call_list (list);
!       
!       if (comp_op.component_alpha == GLITZ_COMPONENT_ALPHA_ARGB) {
!         glitz_composite_op_set_alpha_mask (&comp_op,
!                                            0, alpha_mask.green, 0, 0);
!         glitz_composite_enable (&comp_op);
!         gl->color_mask (0, 1, 0, 0);
!         gl->call_list (list);
! 
!         glitz_composite_op_set_alpha_mask (&comp_op,
!                                            0, 0, 0, alpha_mask.alpha);
!         glitz_composite_enable (&comp_op);
!         gl->color_mask (0, 0, 0, 1);
!         gl->call_list (list);
!       } else {
!         glitz_composite_op_set_alpha_mask (&comp_op,
!                                            0, alpha_mask.green, 0, 0);
!         glitz_composite_enable (&comp_op);
!         gl->color_mask (0, 1, 0, 1);
!         gl->call_list (list);
!       }
!       gl->color_mask (1, 1, 1, 1);
!     }
!     
!     gl->delete_lists (list, 1);
!   }
  
    glitz_composite_disable (&comp_op);
--- 401,409 ----
      
      gl->end ();
      
    }
  
!   if (comp_op.component_alpha)
!     gl->color_mask (1, 1, 1, 1);
  
    glitz_composite_disable (&comp_op);

Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** glitz.h	9 Aug 2004 22:57:35 -0000	1.17
--- glitz.h	18 Aug 2004 12:30:24 -0000	1.18
***************
*** 55,62 ****
  } glitz_point_fixed_t;
  
- typedef struct _glitz_line_fixed_t {
-   glitz_point_fixed_t p1, p2;
- } glitz_line_fixed_t;
- 
  typedef struct _glitz_rectangle_t {
    short x, y;
--- 55,58 ----
***************
*** 68,74 ****
  } glitz_triangle_t;
  
  typedef struct _glitz_trapezoid_t {
!   glitz_fixed16_16_t top, bottom;
!   glitz_line_fixed_t left, right;
  } glitz_trapezoid_t;
  
--- 64,73 ----
  } glitz_triangle_t;
  
+ typedef struct _glitz_span_fixed_t {
+   glitz_fixed16_16_t left, right, y;
+ } glitz_span_fixed_t;
+   
  typedef struct _glitz_trapezoid_t {
!   glitz_span_fixed_t top, bottom;
  } glitz_trapezoid_t;
  
***************
*** 77,84 ****
  } glitz_transform_t;
  
- typedef struct _glitz_convolution_t {
-   glitz_fixed16_16_t matrix[3][3];
- } glitz_convolution_t;
- 
  typedef struct {
    unsigned short red;
--- 76,79 ----
***************
*** 111,114 ****
--- 106,110 ----
    GLITZ_FILTER_BILINEAR,
    GLITZ_FILTER_CONVOLUTION,
+   GLITZ_FILTER_GAUSSIAN,
    GLITZ_FILTER_LINEAR_GRADIENT,
    GLITZ_FILTER_RADIAL_GRADIENT
***************
*** 138,156 ****
  
  #define GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK        (1L <<  0)
! #define GLITZ_FEATURE_CONVOLUTION_FILTER_MASK       (1L <<  1)
! #define GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK        (1L <<  2)
! #define GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK (1L <<  3)
! #define GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK  (1L <<  4)
! #define GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK     (1L <<  5)
! #define GLITZ_FEATURE_MULTISAMPLE_MASK              (1L <<  6)
! #define GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK    (1L <<  7)
! #define GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK  (1L <<  8)
! #define GLITZ_FEATURE_MULTITEXTURE_MASK             (1L <<  9)
! #define GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK      (1L << 10)
! #define GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK         (1L << 11)  
! #define GLITZ_FEATURE_VERTEX_PROGRAM_MASK           (1L << 12)
! #define GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 13)
! #define GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 14)
! #define GLITZ_FEATURE_COMPONENT_ALPHA_MASK          (1L << 15)
  
  typedef enum {
--- 134,151 ----
  
  #define GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK        (1L <<  0)
! #define GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK        (1L <<  1)
! #define GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK (1L <<  2)
! #define GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK  (1L <<  3)
! #define GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK     (1L <<  4)
! #define GLITZ_FEATURE_MULTISAMPLE_MASK              (1L <<  5)
! #define GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK    (1L <<  6)
! #define GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK  (1L <<  7)
! #define GLITZ_FEATURE_MULTITEXTURE_MASK             (1L <<  8)
! #define GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK      (1L <<  9)
! #define GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK         (1L << 10)  
! #define GLITZ_FEATURE_VERTEX_PROGRAM_MASK           (1L << 11)
! #define GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 12)
! #define GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 13)
! #define GLITZ_FEATURE_COMPONENT_ALPHA_MASK          (1L << 14)
  
  typedef enum {
***************
*** 232,235 ****
--- 227,231 ----
  
  typedef enum {
+   GLITZ_FILL_CLIP,
    GLITZ_FILL_TRANSPARENT,
    GLITZ_FILL_NEAREST,
***************
*** 246,258 ****
                                     glitz_bool_t component_alpha);
  
- typedef enum {
-   GLITZ_CORRECTNESS_HINT_CAPABILITY,
-   GLITZ_CORRECTNESS_HINT_QUALITY
- } glitz_correctness_hint_t;
-   
- void
- glitz_surface_set_correctness_hint (glitz_surface_t *surface,
-                                     glitz_correctness_hint_t hint);
- 
  void
  glitz_surface_set_filter (glitz_surface_t *surface,
--- 242,245 ----
***************
*** 265,272 ****
                              glitz_polyedge_t polyedge);
  
- void
- glitz_surface_set_polyopacity (glitz_surface_t *surface,
-                                unsigned short polyopacity);
- 
  typedef enum {
    GLITZ_POLYEDGE_SMOOTH_HINT_FAST,
--- 252,255 ----
***************
*** 288,291 ****
--- 271,276 ----
  glitz_surface_clip_rectangles (glitz_surface_t *surface,
                                 glitz_clip_operator_t op,
+                                int x_offset,
+                                int y_offset,
                                 const glitz_rectangle_t *rects,
                                 int n_rects);
***************
*** 294,297 ****
--- 279,284 ----
  glitz_surface_clip_trapezoids (glitz_surface_t *surface,
                                 glitz_clip_operator_t op,
+                                int x_offset,
+                                int y_offset,
                                 const glitz_trapezoid_t *traps,
                                 int n_traps);
***************
*** 300,303 ****
--- 287,292 ----
  glitz_surface_clip_triangles (glitz_surface_t *surface,
                                glitz_clip_operator_t op,
+                               int x_offset,
+                               int y_offset,
                                const glitz_triangle_t *tris,
                                int n_tris);
***************
*** 483,486 ****
--- 472,477 ----
  glitz_fill_rectangles (glitz_operator_t op,
                         glitz_surface_t *dst,
+                        int x_offset,
+                        int y_offset,
                         const glitz_color_t *color,
                         const glitz_rectangle_t *rects,
***************
*** 493,496 ****
--- 484,489 ----
  glitz_fill_trapezoids (glitz_operator_t op,
                         glitz_surface_t *dst,
+                        int x_offset,
+                        int y_offset,
                         const glitz_color_t *color,
                         const glitz_trapezoid_t *traps,
***************
*** 498,501 ****
--- 491,501 ----
  
  void
+ glitz_add_trapezoids (glitz_surface_t *dst,
+                       int x_offset,
+                       int y_offset,
+                       const glitz_trapezoid_t *traps,
+                       int n_traps);
+ 
+ void
  glitz_composite_trapezoids (glitz_operator_t op,
                              glitz_surface_t *src,
***************
*** 503,506 ****
--- 503,509 ----
                              int x_src,
                              int y_src,
+                             int x_offset,
+                             int y_offset,
+                             unsigned short opacity,
                              const glitz_trapezoid_t *traps,
                              int n_traps);
***************
*** 509,512 ****
--- 512,517 ----
  glitz_color_trapezoids (glitz_operator_t op,
                          glitz_surface_t *dst,
+                         int x_offset,
+                         int y_offset,
                          const glitz_color_trapezoid_t *color_traps,
                          int n_color_traps);
***************
*** 518,524 ****
--- 523,538 ----
  glitz_fill_triangles (glitz_operator_t op,
                        glitz_surface_t *dst,
+                       int x_offset,
+                       int y_offset,
                        const glitz_color_t *color,
                        const glitz_triangle_t *tris,
                        int n_tris);
+ 
+ void
+ glitz_add_triangles (glitz_surface_t *dst,
+                      int x_offset,
+                      int y_offset,
+                      const glitz_triangle_t *tris,
+                      int n_tris);
    
  void
***************
*** 528,531 ****
--- 542,548 ----
                             int x_src,
                             int y_src,
+                            int x_offset,
+                            int y_offset,
+                            unsigned short opacity,
                             const glitz_triangle_t *tris,
                             int n_tris);
***************
*** 537,544 ****
                             int x_src,
                             int y_src,
                             const glitz_point_fixed_t *points,
                             int n_points);
  
!   void
  glitz_composite_tri_fan (glitz_operator_t op,
                           glitz_surface_t *src,
--- 554,564 ----
                             int x_src,
                             int y_src,
+                            int x_offset,
+                            int y_offset,
+                            unsigned short opacity,
                             const glitz_point_fixed_t *points,
                             int n_points);
  
! void
  glitz_composite_tri_fan (glitz_operator_t op,
                           glitz_surface_t *src,
***************
*** 546,549 ****
--- 566,572 ----
                           int x_src,
                           int y_src,
+                          int x_offset,
+                          int y_offset,
+                          unsigned short opacity,
                           const glitz_point_fixed_t *points,
                           int n_points);
***************
*** 552,555 ****
--- 575,580 ----
  glitz_color_triangles (glitz_operator_t op,
                         glitz_surface_t *dst,
+                        int x_offset,
+                        int y_offset,
                         const glitz_color_triangle_t *color_tris,
                         int n_color_tris);

Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_extension.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_agl_extension.c	9 Aug 2004 22:57:35 -0000	1.5
--- glitz_agl_extension.c	18 Aug 2004 12:30:24 -0000	1.6
***************
*** 138,156 ****
      
      if (thread_info->agl_feature_mask &
!         GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK) {
!       glitz_gl_uint_t texture_indirections;
! 
        thread_info->feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
-     
-       _glitz_agl_gl_proc_address.get_program_iv
-         (GLITZ_GL_FRAGMENT_PROGRAM,
-          GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS,
-          &texture_indirections);
-       
-       /* Convolution filter programs require support for at least nine
-          texture indirections. */
-       if (texture_indirections >= 9)
-         thread_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
-     }
    }
    
--- 138,143 ----
      
      if (thread_info->agl_feature_mask &
!         GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK)
        thread_info->feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
    }
    

Index: glitz_agl_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_format.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_agl_format.c	9 Aug 2004 22:57:35 -0000	1.5
--- glitz_agl_format.c	18 Aug 2004 12:30:24 -0000	1.6
***************
*** 212,221 ****
      if (format[i]->alpha_size)
        score[i] += 10;
-     if (format[i]->depth_size)
-       score[i] += 5;
      if (format[i]->stencil_size)
!       score[i] += 10;
      if (format[i]->multisample.supported) 
!       score[i] += (10 + format[i]->multisample.samples);
    }
    
--- 212,219 ----
      if (format[i]->alpha_size)
        score[i] += 10;
      if (format[i]->stencil_size)
!       score[i] += (10 + format[i]->stencil_size);
      if (format[i]->multisample.supported) 
!       score[i] -= (10 - format[i]->multisample.samples);
    }
    
***************
*** 337,354 ****
    }
  
-   if (!glitz_format_find_standard (thread_info->formats,
-                                    thread_info->n_formats,
-                                    GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
-                                    GLITZ_STANDARD_ARGB32)) {
-     
-     thread_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
-   }
- 
    qsort (thread_info->formats, thread_info->n_formats,
           sizeof (glitz_format_t), _glitz_agl_format_compare);
  
    glitz_format_for_each_texture_format (&_glitz_agl_add_texture_format,
! 					&_glitz_agl_gl_proc_address,
! 					(void *) thread_info);
    
    _glitz_move_out_ids (thread_info);
--- 335,344 ----
    }
  
    qsort (thread_info->formats, thread_info->n_formats,
           sizeof (glitz_format_t), _glitz_agl_format_compare);
  
    glitz_format_for_each_texture_format (&_glitz_agl_add_texture_format,
!                                         &_glitz_agl_gl_proc_address,
!                                         (void *) thread_info);
    
    _glitz_move_out_ids (thread_info);

Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_info.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_agl_info.c	9 Aug 2004 22:57:35 -0000	1.8
--- glitz_agl_info.c	18 Aug 2004 12:30:24 -0000	1.9
***************
*** 91,99 ****
    (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_t) glActiveTextureARB,
--- 91,94 ----

Index: glitz_agl_pbuffer.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_pbuffer.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_agl_pbuffer.c	21 Jun 2004 21:26:56 -0000	1.5
--- glitz_agl_pbuffer.c	18 Aug 2004 12:30:24 -0000	1.6
***************
*** 46,67 ****
  
  void 
- glitz_agl_pbuffer_bind (AGLPbuffer pbuffer,
-                         AGLContext context,
-                         glitz_texture_t *texture,
-                         glitz_gl_enum_t buffer)
- {
-   if (!texture->allocated) {
-     _glitz_agl_gl_proc_address.gen_textures (1, &texture->name);
-     texture->allocated = 1;
-   }
-   
-   glitz_texture_bind (&_glitz_agl_gl_proc_address, texture);
- 
-   aglTexImagePBuffer (context, pbuffer, buffer);
-   
-   glitz_texture_unbind (&_glitz_agl_gl_proc_address, texture);
- }
- 
- void 
  glitz_agl_pbuffer_destroy (AGLPbuffer pbuffer)
  {
--- 46,49 ----

Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** glitz_agl_surface.c	9 Aug 2004 22:57:35 -0000	1.14
--- glitz_agl_surface.c	18 Aug 2004 12:30:24 -0000	1.15
***************
*** 114,175 ****
  
    if (surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK) {
!     if (surface->pbuffer) {
!       surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
! 
!       if (surface->base.read_buffer != surface->bound_buffer) {
!         glitz_surface_push_current (&surface->base,
!                                     GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
!         glitz_agl_pbuffer_bind (surface->pbuffer,
!                                 surface->context->context,
!                                 &surface->base.texture,
!                                 surface->base.read_buffer);
!         surface->bound_buffer = surface->base.read_buffer;
!         glitz_surface_pop_current (&surface->base);
!       }
  
!       return &surface->base.texture;
!     } else {
!       glitz_bounding_box_t copy_box;
  
!       copy_box.x1 = copy_box.y1 = 0;
!       copy_box.x2 = surface->base.width;
!       copy_box.y2 = surface->base.height;
!       glitz_intersect_bounding_box (&surface->base.dirty_box,
!                                     &copy_box, &copy_box);
!       
!       if (!surface->base.texture.allocated)
!         glitz_texture_allocate (surface->base.gl, &surface->base.texture);
        
!       glitz_texture_copy_surface (&surface->base.texture, &surface->base,
!                                   copy_box.x1,
!                                   copy_box.y1,
!                                   copy_box.x2 - copy_box.x1,
!                                   copy_box.y2 - copy_box.y1,
!                                   copy_box.x1,
!                                   copy_box.y1);
!     }
!     
      surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
    }
  
    if (allocate) {
!     if (!surface->base.texture.allocated) {
!       if (SURFACE_RENDER_TEXTURE (&surface->base)) {
!         if (!surface->pbuffer)
!           surface->pbuffer = glitz_agl_pbuffer_create (&surface->base.texture);
! 
!         glitz_surface_push_current (&surface->base,
!                                     GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
!         glitz_agl_pbuffer_bind (surface->pbuffer,
!                                 surface->context->context,
!                                 &surface->base.texture,
!                                 surface->base.read_buffer);
!         surface->bound_buffer = surface->base.read_buffer;
!         glitz_surface_pop_current (&surface->base);
!       } else
!         glitz_texture_allocate (surface->base.gl, &surface->base.texture);
!     }
    }
! 
    if (surface->base.texture.allocated)
      return &surface->base.texture;
--- 114,143 ----
  
    if (surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK) {
!     glitz_bounding_box_t copy_box;
  
!     copy_box.x1 = copy_box.y1 = 0;
!     copy_box.x2 = surface->base.width;
!     copy_box.y2 = surface->base.height;
!     glitz_intersect_bounding_box (&surface->base.dirty_box,
!                                   &copy_box, &copy_box);
  
!     if (!surface->base.texture.allocated)
!       glitz_texture_allocate (surface->base.gl, &surface->base.texture);  
        
!     glitz_texture_copy_surface (&surface->base.texture, &surface->base,
!                                 copy_box.x1,
!                                 copy_box.y1,
!                                 copy_box.x2 - copy_box.x1,
!                                 copy_box.y2 - copy_box.y1,
!                                 copy_box.x1,
!                                 copy_box.y1);
      surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
    }
  
    if (allocate) {
!     if (!surface->base.texture.allocated)
!       glitz_texture_allocate (surface->base.gl, &surface->base.texture);
    }
!   
    if (surface->base.texture.allocated)
      return &surface->base.texture;
***************
*** 241,248 ****
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
!   if (format->draw.offscreen) {
      surface->base.hint_mask |= GLITZ_INT_HINT_DRAWABLE_MASK;
-     surface->base.hint_mask |= GLITZ_INT_HINT_RENDER_TEXTURE_MASK;
-   }
  
    _glitz_agl_set_features (surface);
--- 209,214 ----
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
!   if (format->draw.offscreen)
      surface->base.hint_mask |= GLITZ_INT_HINT_DRAWABLE_MASK;
  
    _glitz_agl_set_features (surface);

Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_aglint.h	9 Aug 2004 22:57:35 -0000	1.8
--- glitz_aglint.h	18 Aug 2004 12:30:24 -0000	1.9
***************
*** 62,66 ****
    AGLPixelFormat pixel_format;
    glitz_bool_t offscreen;
-   glitz_gl_uint_t texture_indirections;
  } glitz_agl_context_t;
  
--- 62,65 ----
***************
*** 129,138 ****
  
  extern void __internal_linkage
- glitz_agl_pbuffer_bind (AGLPbuffer pbuffer,
-                         AGLContext context,
-                         glitz_texture_t *texture,
-                         glitz_gl_enum_t buffer);
- 
- extern void __internal_linkage
  glitz_agl_pbuffer_destroy (AGLPbuffer pbuffer);
  
--- 128,131 ----

Index: glitz_compose.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_compose.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** glitz_compose.c	9 Aug 2004 22:57:35 -0000	1.1
--- glitz_compose.c	18 Aug 2004 12:30:24 -0000	1.2
***************
*** 407,419 ****
      { GLITZ_COMBINE_TYPE_ARGBF_SOLIDC, _glitz_combine_solid_solidc, 1, 0 }
    }
! };  
  
  static glitz_surface_type_t
! _glitz_get_surface_type (glitz_surface_t *surface)
  {
    if (surface == NULL)
      return GLITZ_SURFACE_TYPE_NULL;
  
!   if (SURFACE_SOLID (surface) && SURFACE_REPEAT (surface)) {
      if (SURFACE_COMPONENT_ALPHA (surface))
        return GLITZ_SURFACE_TYPE_SOLIDC;
--- 407,440 ----
      { GLITZ_COMBINE_TYPE_ARGBF_SOLIDC, _glitz_combine_solid_solidc, 1, 0 }
    }
! };
! 
! #define SURFACE_WRAP(surface, feature_mask) \
!   (SURFACE_REPEAT (surface)? \
!    ((surface)->texture.repeatable && \
!     ( \
!      (!SURFACE_MIRRORED (surface)) || \
!      ((feature_mask) & GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK) \
!      ) \
!     ) \
!    : \
!    (SURFACE_CLIP (surface) || \
!     (SURFACE_PAD (surface)? \
!      ((surface)->texture.repeatable || \
!       (surface)->texture.target != GLITZ_GL_TEXTURE_2D) \
!      : \
!      ((feature_mask) & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
!      ) \
!     ) \
!    )
  
  static glitz_surface_type_t
! _glitz_get_surface_type (glitz_surface_t *surface,
!                          unsigned long feature_mask)
  {
    if (surface == NULL)
      return GLITZ_SURFACE_TYPE_NULL;
  
!   if (SURFACE_SOLID (surface) &&
!       (SURFACE_REPEAT (surface) || SURFACE_PAD (surface))) {
      if (SURFACE_COMPONENT_ALPHA (surface))
        return GLITZ_SURFACE_TYPE_SOLIDC;
***************
*** 422,442 ****
    }
  
!   if (SURFACE_FRAGMENT_FILTER (surface)) {
!     if (SURFACE_COMPONENT_ALPHA (surface))
!       return GLITZ_SURFACE_TYPE_NA;
!     
!     if (surface->filter == GLITZ_FILTER_CONVOLUTION) {
!       if (surface->feature_mask & GLITZ_FEATURE_CONVOLUTION_FILTER_MASK)
          return GLITZ_SURFACE_TYPE_ARGBF;
-       
-     } else if (surface->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)
-       return GLITZ_SURFACE_TYPE_ARGBF;
      
!   } else if (SURFACE_COMPONENT_ALPHA (surface)) {
!     if (surface->feature_mask & GLITZ_FEATURE_COMPONENT_ALPHA_MASK)
!       return GLITZ_SURFACE_TYPE_ARGBC;
!   } else
!     return GLITZ_SURFACE_TYPE_ARGB;
!   
    return GLITZ_SURFACE_TYPE_NA;
  }
--- 443,461 ----
    }
  
!   if (SURFACE_WRAP (surface, feature_mask)) {
!     if (SURFACE_FRAGMENT_FILTER (surface)) {
!       if (SURFACE_COMPONENT_ALPHA (surface))
!         return GLITZ_SURFACE_TYPE_NA;
! 
!       if (feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)
          return GLITZ_SURFACE_TYPE_ARGBF;
      
!     } else if (SURFACE_COMPONENT_ALPHA (surface)) {
!       if (feature_mask & GLITZ_FEATURE_COMPONENT_ALPHA_MASK)
!         return GLITZ_SURFACE_TYPE_ARGBC;
!     } else
!       return GLITZ_SURFACE_TYPE_ARGB;
!   }
!     
    return GLITZ_SURFACE_TYPE_NA;
  }
***************
*** 446,472 ****
  };
  
- #define SURFACE_HW_WRAP(surface) \
-   (SURFACE_REPEAT (surface)? \
-    ((surface)->texture.repeatable && \
-     ( \
-      (!SURFACE_MIRRORED (surface)) || \
-      ((surface)->feature_mask & GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK) \
-      ) \
-     ) \
-    : \
-    (SURFACE_PAD (surface)? \
-     ((surface)->texture.repeatable || \
-      (surface)->texture.target != GLITZ_GL_TEXTURE_2D) \
-     : \
-     ((surface)->feature_mask & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
-     ) \
-    )
- 
- #define SURFACE_PROJECTIVE_TRANSFORM(surface) \
-   ((surface)->transform && \
-    (((surface)->transform->m[3] != 0.0) || \
-     ((surface)->transform->m[7] != 0.0) || \
-     ((surface)->transform->m[15] != 1.0)))
- 
  void
  glitz_composite_op_init (glitz_composite_op_t *op,
--- 465,468 ----
***************
*** 488,500 ****
    op->count = 0;
    op->solid = NULL;
-   op->hw_wrap = 1;
    op->component_alpha = GLITZ_COMPONENT_ALPHA_NONE;
    op->vp = op->fp = 0;
    
!   src_type = _glitz_get_surface_type (src);
    if (src_type < 1)
      return;
  
!   mask_type = _glitz_get_surface_type (mask);
    if (mask_type < 0)
      return;
--- 484,495 ----
    op->count = 0;
    op->solid = NULL;
    op->component_alpha = GLITZ_COMPONENT_ALPHA_NONE;
    op->vp = op->fp = 0;
    
!   src_type = _glitz_get_surface_type (src, dst->feature_mask);
    if (src_type < 1)
      return;
  
!   mask_type = _glitz_get_surface_type (mask, dst->feature_mask);
    if (mask_type < 0)
      return;
***************
*** 512,524 ****
      op->solid = &src->solid;
      op->src = NULL;
-   } else if (!SURFACE_HW_WRAP (src)) {
-     if (SURFACE_QUALITY_CORRECTNESS (dst) ||
-         SURFACE_PAD (src) ||
-         SURFACE_MIRRORED (src) ||
-         SURFACE_PROJECTIVE_TRANSFORM (src) ||
-         combine->fragment_processing)
-       return;
-     
-     op->hw_wrap = 0;
    }
    
--- 507,510 ----
***************
*** 537,551 ****
      }
    } else if (mask_type != GLITZ_SURFACE_TYPE_NULL) {
-     if (!SURFACE_HW_WRAP (mask)) {
-       if (SURFACE_QUALITY_CORRECTNESS (dst) ||
-           SURFACE_PAD (mask) ||
-           SURFACE_MIRRORED (mask) ||
-           SURFACE_PROJECTIVE_TRANSFORM (mask) ||
-           combine->fragment_processing)
-         return;
-       
-       op->hw_wrap = 0;
-     }
- 
      if (dst->feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK) {
        if (mask_type == GLITZ_SURFACE_TYPE_ARGBC) {
--- 523,526 ----
***************
*** 557,562 ****
        
        if (op->src) {
!         if (op->hw_wrap &&
!             (dst->feature_mask & GLITZ_FEATURE_MULTITEXTURE_MASK)) {
            op->combine = combine;
          } else if ((dst->feature_mask &
--- 532,536 ----
        
        if (op->src) {
!         if (dst->feature_mask & GLITZ_FEATURE_MULTITEXTURE_MASK) {
            op->combine = combine;
          } else if ((dst->feature_mask &
***************
*** 577,582 ****
      op->type = combine->type;
      if (combine->fragment_processing) {
!       op->vp = glitz_get_vertex_program (op, src->filter);
!       op->fp = glitz_get_fragment_program (op, src->filter);
        if (op->vp == 0 || op->fp == 0)
          op->type = GLITZ_COMBINE_TYPE_NA;
--- 551,556 ----
      op->type = combine->type;
      if (combine->fragment_processing) {
!       op->vp = glitz_filter_get_vertex_program (src, op);
!       op->fp = glitz_filter_get_fragment_program (src, op);
        if (op->vp == 0 || op->fp == 0)
          op->type = GLITZ_COMBINE_TYPE_NA;
***************
*** 586,615 ****
  
  void
- glitz_composite_op_set_alpha_mask (glitz_composite_op_t *op,
-                                    unsigned short red,
-                                    unsigned short green,
-                                    unsigned short blue,
-                                    unsigned short alpha)
- {
-   op->alpha_mask.red = red;
-   op->alpha_mask.green = green;
-   op->alpha_mask.blue = blue;
-   op->alpha_mask.alpha = alpha;
- }
- 
- void
- glitz_composite_op_get_alpha_mask (glitz_composite_op_t *op,
-                                    unsigned short *red,
-                                    unsigned short *green,
-                                    unsigned short *blue,
-                                    unsigned short *alpha)
- {
-   if (red) *red = op->alpha_mask.red;
-   if (green) *green = op->alpha_mask.green;
-   if (blue) *blue = op->alpha_mask.blue;
-   if (alpha) *alpha = op->alpha_mask.alpha;
- }
- 
- void
  glitz_composite_enable (glitz_composite_op_t *op)
  {
--- 560,563 ----

Index: glitz_filter.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_filter.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** glitz_filter.c	9 Aug 2004 22:57:35 -0000	1.1
--- glitz_filter.c	18 Aug 2004 12:30:24 -0000	1.2
***************
*** 32,66 ****
  #include <math.h>
  
- typedef struct _glitz_convolution_filter_t {
-   glitz_matrix_t matrix;
- } glitz_convolution_filter_t;
- 
  typedef struct _glitz_linear_gradient_filter_t {
!   glitz_point_fixed_t start;
!   glitz_point_fixed_t stop;
  } glitz_linear_gradient_filter_t;
  
  typedef struct _glitz_radial_gradient_filter_t {
!   glitz_point_fixed_t center;
!   glitz_fixed16_16_t radius0;
!   glitz_fixed16_16_t radius1;
  } glitz_radial_gradient_filter_t;
  
  struct _glitz_filter_params_t {
    union {
-     glitz_convolution_filter_t convolution;
      glitz_linear_gradient_filter_t linear;
      glitz_radial_gradient_filter_t radial;
    } u;
  };
  
  static int
! _glitz_filter_params_ensure (glitz_filter_params_t **params)
  {
    if (*params == NULL) {
!     *params = malloc (sizeof (glitz_filter_params_t));
      if (*params == NULL)      
        return 1;
    }
    
    return 0;
--- 32,77 ----
  #include <math.h>
  
  typedef struct _glitz_linear_gradient_filter_t {
!   glitz_point_t start;
!   glitz_point_t stop;
  } glitz_linear_gradient_filter_t;
  
  typedef struct _glitz_radial_gradient_filter_t {
!   glitz_point_t center;
!   double radius_base, radius_scale;
  } glitz_radial_gradient_filter_t;
  
  struct _glitz_filter_params_t {
+   int fp_type;
+   int id;
+   
    union {
      glitz_linear_gradient_filter_t linear;
      glitz_radial_gradient_filter_t radial;
    } u;
+ 
+   glitz_vec4_t *vectors;
+   int n_vectors;
  };
  
  static int
! _glitz_filter_params_ensure (glitz_filter_params_t **params, int vectors)
  {
    if (*params == NULL) {
!     *params = calloc (1, sizeof (glitz_filter_params_t));
      if (*params == NULL)      
        return 1;
    }
+ 
+   if ((*params)->n_vectors != vectors) {
+     (*params)->vectors =
+       realloc ((*params)->vectors, vectors * sizeof (glitz_vec4_t));
+     (*params)->n_vectors = vectors;
+   }
+   
+   if (vectors > 0 && (*params)->vectors == NULL) {
+     free (*params);
+     return 1;
+   }
    
    return 0;
***************
*** 68,191 ****
  
  static void
! _glitz_filter_params_set_fixed (glitz_fixed16_16_t *fixed,
!                                 const glitz_fixed16_16_t default_fixed,
!                                 glitz_fixed16_16_t **params,
!                                 int *n_params)
! {
!   if (*n_params > 0) {
!     *fixed = **params;
!     (*params)++;
!     n_params--;
!   } else
!     *fixed = default_fixed;
! }
! 
! static void
! _glitz_filter_params_set_double (double *value,
!                                  const double default_value,
!                                  glitz_fixed16_16_t **params,
!                                  int *n_params)
  {
    if (*n_params > 0) {
      *value = FIXED_TO_DOUBLE (**params);
      (*params)++;
!     n_params--;
    } else
      *value = default_value;
  }
  
! static void
! _glitz_filter_params_set_point (glitz_point_fixed_t *point,
!                                 const glitz_point_fixed_t *default_point,
!                                 glitz_fixed16_16_t **params,
!                                 int *n_params)
! {
!   _glitz_filter_params_set_fixed (&point->x, default_point->x,
!                                   params, n_params);
!   _glitz_filter_params_set_fixed (&point->y, default_point->y,
!                                   params, n_params);
! }
! 
! static void
! _glitz_filter_params_set_matrix (glitz_matrix_t *matrix,
!                                  const glitz_matrix_t *default_matrix,
!                                  glitz_fixed16_16_t **params,
!                                  int *n_params)
  {
!   int row, col;
!   
!   for (row = 0; row < 3; row++)
!     for (col = 0; col < 3; col++)
!       _glitz_filter_params_set_double (&matrix->m[row][col],
!                                        default_matrix->m[row][col],
!                                        params, n_params);
  }
  
- 
- static const glitz_matrix_t _default_convolution_kernel = {
-   {
-     { 1.0, 1.0, 1.0 },
-     { 1.0, 1.0, 1.0 },
-     { 1.0, 1.0, 1.0 }
-   }
- };
- 
- static const glitz_point_fixed_t _point_zero = {
-   0, 0
- };
- 
- static const glitz_point_fixed_t _point_one = {
-   65536, 65536
- };
- 
  glitz_status_t
! glitz_filter_set_params (glitz_filter_params_t **filter_params,
                           glitz_filter_t filter,
                           glitz_fixed16_16_t *params,
                           int n_params)
  {
    switch (filter) {
    case GLITZ_FILTER_CONVOLUTION: {
!     glitz_fixed16_16_t w, h;
      
!     if (_glitz_filter_params_ensure (filter_params))
        return GLITZ_STATUS_NO_MEMORY;
-     
-     _glitz_filter_params_set_fixed (&w, INT_TO_FIXED (3), &params, &n_params);
-     _glitz_filter_params_set_fixed (&h, INT_TO_FIXED (3), &params, &n_params);
  
!     /* TODO: support any convolution filter size */
!     if (w != INT_TO_FIXED (3) || h != INT_TO_FIXED (3))
!       return GLITZ_STATUS_NOT_SUPPORTED;
      
!     _glitz_filter_params_set_matrix (&(*filter_params)->u.convolution.matrix,
!                                      &_default_convolution_kernel,
!                                      &params, &n_params);
      
!     if (glitz_matrix_normalize (&(*filter_params)->u.convolution.matrix))
!       return GLITZ_STATUS_INVALID_MATRIX_MASK;
      
    } break;
!   case GLITZ_FILTER_LINEAR_GRADIENT:
!     if (_glitz_filter_params_ensure (filter_params))
        return GLITZ_STATUS_NO_MEMORY;
  
!     _glitz_filter_params_set_point (&(*filter_params)->u.linear.start,
!                                     &_point_zero,
!                                     &params, &n_params);
!     _glitz_filter_params_set_point (&(*filter_params)->u.linear.stop,
!                                     &_point_one,
!                                     &params, &n_params);
!     break;
    case GLITZ_FILTER_RADIAL_GRADIENT:
!     if (_glitz_filter_params_ensure (filter_params))
        return GLITZ_STATUS_NO_MEMORY;
  
!     _glitz_filter_params_set_point (&(*filter_params)->u.radial.center,
!                                     &_point_zero, &params, &n_params);
!     _glitz_filter_params_set_fixed (&(*filter_params)->u.radial.radius0,
!                                     0, &params, &n_params);
!     _glitz_filter_params_set_fixed (&(*filter_params)->u.radial.radius1,
!                                     65536, &params, &n_params);
      break;
    case GLITZ_FILTER_BILINEAR:
--- 79,318 ----
  
  static void
! _glitz_filter_params_set (double *value,
!                           const double default_value,
!                           glitz_fixed16_16_t **params,
!                           int *n_params)
  {
    if (*n_params > 0) {
      *value = FIXED_TO_DOUBLE (**params);
      (*params)++;
!     (*n_params)--;
    } else
      *value = default_value;
  }
  
! static int
! _glitz_color_stop_compare (const void *elem1, const void *elem2)
  {
!   return
!     (((glitz_vec4_t *) elem1)->v[2] == ((glitz_vec4_t *) elem2)->v[2]) ?
!     /* equal offsets, sort on id */
!     ((((glitz_vec4_t *) elem1)->v[3] <
!       ((glitz_vec4_t *) elem2)->v[3]) ? -1 : 1) :
!     /* sort on offset */
!     ((((glitz_vec4_t *) elem1)->v[2] <
!       ((glitz_vec4_t *) elem2)->v[2]) ? -1 : 1);
  }
  
  glitz_status_t
! glitz_filter_set_params (glitz_surface_t *surface,
                           glitz_filter_t filter,
                           glitz_fixed16_16_t *params,
                           int n_params)
  {
+   glitz_vec4_t *vecs;
+   int i, size = 0;
+   
    switch (filter) {
    case GLITZ_FILTER_CONVOLUTION: {
!     double dm, dn, sum, tx, ty;
!     int cx, cy, m, n, j;
      
!     _glitz_filter_params_set (&dm, 3.0, &params, &n_params);
!     _glitz_filter_params_set (&dn, 3.0, &params, &n_params);
!     m = dm;
!     n = dn;
! 
!     size = m * n;
!     if (_glitz_filter_params_ensure (&surface->filter_params, size))
        return GLITZ_STATUS_NO_MEMORY;
  
!     vecs = surface->filter_params->vectors;
      
!     surface->filter_params->id = 0;
      
!     /* center point is rounded down in case dimensions are not even */
!     cx = m / 2;
!     cy = n / 2;
! 
!     tx = surface->texture.texcoord_width / surface->texture.width;
!     ty = surface->texture.texcoord_height / surface->texture.height;
! 
!     sum = 0.0;
!     for (i = 0; i < m; i++) {
!       glitz_vec4_t *vec;
!       double weight;
!       
!       for (j = 0; j < n; j++) {
!         _glitz_filter_params_set (&weight, 0.0, &params, &n_params);
!         if (weight != 0.0) {
!           vec = &vecs[surface->filter_params->id++];
!           vec->v[0] = (i - cx) * tx;
!           vec->v[1] = (cy - j) * ty;
!           vec->v[2] = weight;
!           sum += weight;
!         }
!       }
!     }
! 
!     /* normalize */
!     if (sum != 0.0)
!       sum = 1.0 / sum;
!     
!     for (i = 0; i < surface->filter_params->id; i++)
!       vecs[i].v[2] *= sum;
      
    } break;
!   case GLITZ_FILTER_GAUSSIAN: {
!     double radius, sigma, alpha, scale, xy_scale, sum, tx, ty;
!     int half_size, x, y;
!     
!     _glitz_filter_params_set (&radius, 1.0, &params, &n_params);
!     glitz_clamp_value (&radius, 0.0, 1024.0);
! 
!     _glitz_filter_params_set (&sigma, radius / 2.0, &params, &n_params);
!     glitz_clamp_value (&sigma, 0.0, 1024.0);
!     
!     _glitz_filter_params_set (&alpha, radius, &params, &n_params);
!     glitz_clamp_value (&alpha, 0.0, 1024.0);
! 
!     scale = 1.0 / (2.0 * GLITZ_PI * sigma * sigma);
!     half_size = (int) (alpha * radius) / 2;
! 
!     if (half_size == 0)
!       half_size = 1;
!     
!     size = half_size * 2 + 1;
!     xy_scale = 2.0 * radius / size;
!     
!     if (_glitz_filter_params_ensure (&surface->filter_params, size * size))
        return GLITZ_STATUS_NO_MEMORY;
  
!     vecs = surface->filter_params->vectors;
! 
!     surface->filter_params->id = 0;
! 
!     tx = surface->texture.texcoord_width / surface->texture.width;
!     ty = surface->texture.texcoord_height / surface->texture.height;
! 
!     sum = 0.0;
!     for (x = 0; x < size; x++) {
!       glitz_vec4_t *vec;
!       double fx, fy;
!       double amp;
!       
!       fx = xy_scale * (x - half_size);
!       
!       for (y = 0; y < size; y++) {
!         fy = xy_scale * (y - half_size);
! 
!         amp = scale * exp ((-1.0 * (fx * fx + fy * fy)) /
!                            (2.0 * sigma * sigma));
! 
!         if (amp > 0.0) {
!           vec = &vecs[surface->filter_params->id++];
!           vec->v[0] = fx * tx;
!           vec->v[1] = fy * ty;
!           vec->v[2] = amp;
!           sum += amp;
!         }
!       }
!     }
! 
!     /* normalize */
!     if (sum != 0.0)
!       sum = 1.0 / sum;
!     
!     for (i = 0; i < surface->filter_params->id; i++)
!       vecs[i].v[2] *= sum;
!   } break;
!   case GLITZ_FILTER_LINEAR_GRADIENT:
    case GLITZ_FILTER_RADIAL_GRADIENT:
!     if (n_params <= 4) {
!       if (surface->width == 1)
!         size = surface->height;
!       else if (surface->height == 1)
!         size = surface->width;
!     } else
!       size = (n_params - 1) / 3;
!     
!     if (size < 2)
!       size = 2;
! 
!     if (_glitz_filter_params_ensure (&surface->filter_params, size))
        return GLITZ_STATUS_NO_MEMORY;
+     
+     if (filter == GLITZ_FILTER_LINEAR_GRADIENT) {
+       _glitz_filter_params_set (&surface->filter_params->u.linear.start.x,
+                                 0.0, &params, &n_params);
+       _glitz_filter_params_set (&surface->filter_params->u.linear.start.y,
+                                 0.0, &params, &n_params);
+       _glitz_filter_params_set (&surface->filter_params->u.linear.stop.x,
+                                 1.0, &params, &n_params);
+       _glitz_filter_params_set (&surface->filter_params->u.linear.stop.y,
+                                 0.0, &params, &n_params);
+     } else {
+       double r0, r1;
+       
+       if (_glitz_filter_params_ensure (&surface->filter_params, size))
+         return GLITZ_STATUS_NO_MEMORY;
  
!       _glitz_filter_params_set (&surface->filter_params->u.radial.center.x,
!                                 0.5, &params, &n_params);
!       _glitz_filter_params_set (&surface->filter_params->u.radial.center.y,
!                                 0.5, &params, &n_params);
!       _glitz_filter_params_set (&r0, 0.0, &params, &n_params);
!       _glitz_filter_params_set (&r1, 0.5, &params, &n_params);
!       glitz_clamp_value (&r0, 0.0, r1);
!       surface->filter_params->u.radial.radius_base = r0;
!       if (r1 != r0)
!         surface->filter_params->u.radial.radius_scale = 1.0 / (r1 - r0);
!       else
!         surface->filter_params->u.radial.radius_scale = 2147483647.0;
!     }
! 
!     vecs = surface->filter_params->vectors;
!     surface->filter_params->id = size;
!     
!     for (i = 0; i < size; i++) {
!       double x_default, y_default, o_default;
!       
!       o_default = i / (double) (size - 1);
!       x_default = 0.5 + (surface->width * i) / (double) size;
!       y_default = 0.5 + (surface->height * i) / (double) size;
!       
!       _glitz_filter_params_set (&vecs[i].v[2], o_default, &params, &n_params);
!       _glitz_filter_params_set (&vecs[i].v[0], x_default, &params, &n_params);
!       _glitz_filter_params_set (&vecs[i].v[1], y_default, &params, &n_params);
! 
!       glitz_clamp_value (&vecs[i].v[2], 0.0, 1.0);
!       glitz_clamp_value (&vecs[i].v[0], 0.5, surface->width - 0.5);
!       glitz_clamp_value (&vecs[i].v[1], 0.5, surface->height - 0.5);
!       
!       glitz_texture_tex_coord (&surface->texture,
!                                vecs[i].v[0], vecs[i].v[1],
!                                &vecs[i].v[0], &vecs[i].v[1]);
!       
!       vecs[i].v[1] = surface->texture.texcoord_height - vecs[i].v[1];
!       vecs[i].v[3] = i;
!     }
!     
!     /* sort color stops in ascending order */
!     qsort (vecs, surface->filter_params->id, sizeof (glitz_vec4_t),
! 	   _glitz_color_stop_compare);
!     
!     for (i = 0; i < size; i++) {
!       double diff;
! 
!       if ((i + 1) == size)
!         diff = 1.0 - vecs[i].v[2];
!       else
!         diff = vecs[i + 1].v[2] - vecs[i].v[2];
!       
!       if (diff != 0.0)
!         vecs[i].v[3] = 1.0 / diff;
!       else
!         vecs[i].v[3] = 2147483647.0; /* should be DBL_MAX, but this will do */
!     }
      break;
    case GLITZ_FILTER_BILINEAR:
***************
*** 194,205 ****
--- 321,397 ----
    }
  
+   glitz_filter_set_type (surface, filter);
+     
    return GLITZ_STATUS_SUCCESS;
  }
  
  void
+ glitz_filter_params_destroy (glitz_filter_params_t *params)
+ {
+   if (params->vectors)
+     free (params->vectors);
+ 
+   free (params);
+ }
+ 
+ glitz_gl_uint_t
+ glitz_filter_get_vertex_program (glitz_surface_t *surface,
+                                  glitz_composite_op_t *op)
+ {
+   return glitz_get_vertex_program (op);
+ }
+ 
+ glitz_gl_uint_t
+ glitz_filter_get_fragment_program (glitz_surface_t *surface,
+                                    glitz_composite_op_t *op)
+ {
+   return glitz_get_fragment_program (op,
+                                      surface->filter_params->fp_type,
+                                      surface->filter_params->id);
+ }
+ 
+ void
+ glitz_filter_set_type (glitz_surface_t *surface,
+                        glitz_filter_t filter)
+ {
+   switch (filter) {
+   case GLITZ_FILTER_CONVOLUTION:
+   case GLITZ_FILTER_GAUSSIAN:
+     surface->filter_params->fp_type = GLITZ_FP_CONVOLUTION;
+     break;
+   case GLITZ_FILTER_LINEAR_GRADIENT:
+     if (surface->hint_mask & GLITZ_INT_HINT_REPEAT_MASK) {
+       if (SURFACE_MIRRORED (surface))
+         surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REFLECT;
+       else
+         surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REPEAT;
+     } else if (SURFACE_PAD (surface)) {
+       surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_NEAREST;
+     } else
+       surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT;
+     break;
+   case GLITZ_FILTER_RADIAL_GRADIENT:
+     if (surface->hint_mask & GLITZ_INT_HINT_REPEAT_MASK) {
+       if (SURFACE_MIRRORED (surface))
+         surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REFLECT;
+       else
+         surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REPEAT;
+     } else if (SURFACE_PAD (surface)) {
+       surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_NEAREST;
+     } else
+       surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT;
+     break;
+   case GLITZ_FILTER_BILINEAR:
+   case GLITZ_FILTER_NEAREST:
+     break;
+   }
+ }
+ 
+ void
  glitz_filter_enable (glitz_surface_t *surface,
                       glitz_composite_op_t *op)
  {
    glitz_gl_proc_address_list_t *gl = op->gl;
+   int i;
  
    gl->enable (GLITZ_GL_VERTEX_PROGRAM);
***************
*** 210,279 ****
  
    switch (surface->filter) {
!   case GLITZ_FILTER_CONVOLUTION: {
!     glitz_convolution_filter_t *c = &surface->filter_params->u.convolution;
!     double dw, dh;
! 
!     dw = surface->texture.texcoord_width / (double) surface->texture.width;
!     dh = surface->texture.texcoord_height / (double) surface->texture.height;
! 
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 0,
!                                 0.0, 0.0, c->matrix.m[1][1], 0.0);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 1,
!                                 -dw, 0.0, c->matrix.m[0][1], 0.0);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 2,
!                                 dw, 0.0, c->matrix.m[2][1], 0.0);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 3,
!                                 0.0, -dh, c->matrix.m[1][0], 0.0);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 4,
!                                 0.0, dh, c->matrix.m[1][2], 0.0);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 5,
!                                 -dw, -dh, c->matrix.m[0][0], 0.0);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 6,
!                                 dw, -dh, c->matrix.m[2][0], 0.0);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 7,
!                                 -dw, dh, c->matrix.m[0][2], 0.0);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 8,
!                                 dw, dh, c->matrix.m[2][2], 0.0);
!   } break;
    case GLITZ_FILTER_LINEAR_GRADIENT: {
      glitz_linear_gradient_filter_t *linear = &surface->filter_params->u.linear;
!     glitz_point_t p1, p2;
!     double length, angle, start, cos_angle, sin_angle;
      
!     p1.x = FIXED_TO_DOUBLE (linear->start.x);
!     p1.y = FIXED_TO_DOUBLE (linear->start.y);
!     p2.x = FIXED_TO_DOUBLE (linear->stop.x);
!     p2.y = FIXED_TO_DOUBLE (linear->stop.y);
        
!     length = sqrt ((p2.x - p1.x) * (p2.x - p1.x) +
!                    (p2.y - p1.y) * (p2.y - p1.y));
        
!     angle = -atan2 (p2.y - p1.y, p2.x - p1.x);
  
      cos_angle = cos (angle);
      sin_angle = sin (angle);
        
!     start = cos_angle * p1.x;
!     start += -sin_angle * p1.y;
  
      gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 0, start,
                                  (length)? 1.0 / length: INT_MAX,
                                  cos_angle, -sin_angle);
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 1,
!                                 surface->texture.texcoord_width,
!                                 0.0, 0.0, 0.0);
    } break;
    case GLITZ_FILTER_RADIAL_GRADIENT: {
      glitz_radial_gradient_filter_t *radial = &surface->filter_params->u.radial;
      
      gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 0,
!                                 FIXED_TO_DOUBLE (radial->center.x),
!                                 FIXED_TO_DOUBLE (radial->center.y),
!                                 1.0 / (FIXED_TO_DOUBLE (radial->radius1) -
!                                        FIXED_TO_DOUBLE (radial->radius0)),
!                                 FIXED_TO_DOUBLE (radial->radius0));
!     gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 1,
!                                 surface->texture.texcoord_width,
!                                 0.0, 0.0, 0.0);
    } break;
    case GLITZ_FILTER_BILINEAR:
--- 402,492 ----
  
    switch (surface->filter) {
!   case GLITZ_FILTER_GAUSSIAN:
!   case GLITZ_FILTER_CONVOLUTION:
!     for (i = 0; i < surface->filter_params->id; i++) {
!       glitz_vec4_t *vec;
!       
!       vec = &surface->filter_params->vectors[i];
!       
!       gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, i,
!                                   vec->v[0], vec->v[1], vec->v[2], 0.0);
!     }
!     break;
    case GLITZ_FILTER_LINEAR_GRADIENT: {
      glitz_linear_gradient_filter_t *linear = &surface->filter_params->u.linear;
!     double length, angle, start, cos_angle, sin_angle, dw, dh;
!     int j, fp_type = surface->filter_params->fp_type;
      
!     dw = linear->stop.x - linear->start.x;
!     dh = linear->stop.y - linear->start.y;
        
!     length = sqrt (dw * dw + dh * dh);
        
!     angle = -atan2 (dh, dw);
  
      cos_angle = cos (angle);
      sin_angle = sin (angle);
        
!     start = cos_angle * linear->start.x;
!     start += -sin_angle * linear->start.y;
  
      gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 0, start,
                                  (length)? 1.0 / length: INT_MAX,
                                  cos_angle, -sin_angle);
! 
!     if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT) {
!       glitz_vec4_t *vec = surface->filter_params->vectors;
!       
!       gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 1,
!                                   -1.0, -1.0, 0.0,
!                                   (vec->v[3])? 1.0 / vec->v[3]: 1.0);
!       j = 2;
!     } else
!       j = 1;
!     
!     for (i = 0; i < surface->filter_params->id; i++) {
!       glitz_vec4_t *vec;
!       
!       vec = &surface->filter_params->vectors[i];
!       
!       gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, i + j,
!                                   vec->v[0], vec->v[1], vec->v[2], vec->v[3]);
!     }
! 
!     if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT)
!       gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, i + j,
!                                   -1.0, -1.0, 1.0, 1.0);
!       
    } break;
    case GLITZ_FILTER_RADIAL_GRADIENT: {
      glitz_radial_gradient_filter_t *radial = &surface->filter_params->u.radial;
+     int j, fp_type = surface->filter_params->fp_type;
      
      gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 0,
!                                 radial->center.x, radial->center.y,
!                                 radial->radius_base, radial->radius_scale);
! 
!     if (fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
!       glitz_vec4_t *vec = surface->filter_params->vectors;
!       
!       gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, 1,
!                                   -1.0, -1.0, 0.0,
!                                   (vec->v[3]) ? 1.0 / vec->v[3]: 1.0);
!       j = 2;
!     } else
!       j = 1;
!     
!     for (i = 0; i < surface->filter_params->id; i++) {
!       glitz_vec4_t *vec;
!       
!       vec = &surface->filter_params->vectors[i];
!       
!       gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, i + j,
!                                   vec->v[0], vec->v[1], vec->v[2], vec->v[3]);
!     }
! 
!     if (fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT)
!       gl->program_local_param_4d (GLITZ_GL_FRAGMENT_PROGRAM, i + j,
!                                   -1.0, -1.0, 1.0, 1.0);
    } break;
    case GLITZ_FILTER_BILINEAR:
***************
*** 282,284 ****
    }
  }
-   
--- 495,496 ----

Index: glitz_gl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_gl.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_gl.h	9 Aug 2004 22:57:35 -0000	1.6
--- glitz_gl.h	18 Aug 2004 12:30:24 -0000	1.7
***************
*** 216,226 ****
  #define GLITZ_GL_MULTISAMPLE_FILTER_HINT 0x8534
  
! #define GLITZ_GL_VERTEX_PROGRAM         0x8620
! #define GLITZ_GL_PROGRAM_STRING         0x8628
! #define GLITZ_GL_PROGRAM_FORMAT_ASCII   0x8875
! #define GLITZ_GL_PROGRAM_ERROR_POSITION 0x864B
! 
! #define GLITZ_GL_FRAGMENT_PROGRAM             0x8804
! #define GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS 0x880D
  
  #define GLITZ_GL_PIXEL_PACK_BUFFER   0x88EB
--- 216,226 ----
  #define GLITZ_GL_MULTISAMPLE_FILTER_HINT 0x8534
  
! #define GLITZ_GL_VERTEX_PROGRAM              0x8620
! #define GLITZ_GL_FRAGMENT_PROGRAM            0x8804
! #define GLITZ_GL_PROGRAM_STRING              0x8628
! #define GLITZ_GL_PROGRAM_FORMAT_ASCII        0x8875
! #define GLITZ_GL_PROGRAM_ERROR_POSITION      0x864B
! #define GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS 0x88B6
! #define GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS 0x88A2
  
  #define GLITZ_GL_PIXEL_PACK_BUFFER   0x88EB
***************
*** 393,406 ****
  typedef glitz_gl_void_t (* glitz_gl_get_pointer_v_t)
       (glitz_gl_enum_t pname, glitz_gl_void_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_t)
       (glitz_gl_enum_t);
--- 393,396 ----

Index: glitz_glx_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_context.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** glitz_glx_context.c	9 Aug 2004 22:57:35 -0000	1.10
--- glitz_glx_context.c	18 Aug 2004 12:30:24 -0000	1.11
***************
*** 181,187 ****
            &screen_info->root_context.gl,
            sizeof (glitz_gl_proc_address_list_t));
-   memset (&context->glx, 0, sizeof (glitz_glx_proc_address_list_t));
    
!   context->gl.need_lookup = context->glx.need_lookup = 1;
    
    return context;
--- 181,186 ----
            &screen_info->root_context.gl,
            sizeof (glitz_gl_proc_address_list_t));
    
!   context->gl.need_lookup = 1;
    
    return context;
***************
*** 204,214 ****
      screen_info->display_info->thread_info;
      
-   context->glx.bind_tex_image =
-     (glitz_glx_bind_tex_image_t)
-     glitz_glx_get_proc_address (thread_info, "glXBindTexImageARB");
-   context->glx.release_tex_image =
-     (glitz_glx_release_tex_image_t)
-     glitz_glx_get_proc_address (thread_info, "glXReleaseTexImageARB");
- 
    context->gl.active_texture =
      (glitz_gl_active_texture_t)
--- 203,206 ----
***************
*** 256,268 ****
      glitz_glx_get_proc_address (thread_info, "glUnmapBuffer");
  
-   if (screen_info->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK) {
-     if (context->gl.get_program_iv)
-       context->gl.get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
-                                   GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS,
-                                   &context->texture_indirections);
-   }
-   
    context->gl.need_lookup = 0;
-   context->glx.need_lookup = 0;
  }
  
--- 248,252 ----

Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_glx_extension.c	9 Aug 2004 22:57:35 -0000	1.8
--- glitz_glx_extension.c	18 Aug 2004 12:30:24 -0000	1.9
***************
*** 33,39 ****
  
  static glitz_extension_map client_glx_extensions[] = {
-   /* NYI: Don't know of any driver that supports GLX_ARB_render_texture 
-     { "GLX_ARB_render_texture", GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK },
-    */
    { "GLX_ARB_multisample", GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK },
    { NULL, 0 }
--- 33,36 ----
***************
*** 142,148 ****
      screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK;
  
-   if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK)
-     screen_info->glx_feature_mask |= GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK;
- 
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_MULTITEXTURE_MASK) {
      screen_info->feature_mask |= GLITZ_FEATURE_MULTITEXTURE_MASK;
--- 139,142 ----
***************
*** 171,178 ****
          GLITZ_GLX_FEATURE_FRAGMENT_PROGRAM_MASK)
        screen_info->feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
- 
-     if ((screen_info->feature_mask & GLITZ_FEATURE_VERTEX_PROGRAM_MASK) &&
-         (screen_info->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK))
-       screen_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
    }
  
--- 165,168 ----

Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_format.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_glx_format.c	9 Aug 2004 22:57:35 -0000	1.8
--- glitz_glx_format.c	18 Aug 2004 12:30:24 -0000	1.9
***************
*** 51,68 ****
      if (format[i]->alpha_size)
        score[i] += 10;
-     if (format[i]->depth_size)
-       score[i] += 5;
      if (format[i]->stencil_size)
        score[i] += (10 + format[i]->stencil_size);
      if (format[i]->doublebuffer)
!       score[i] += 10;
      if (format[i]->draw.onscreen)
!       score[i] += 10;
      if (format[i]->draw.offscreen)
!       score[i] += 10;
      if (format[i]->draw.offscreen && format[i]->draw.onscreen)
        score[i] += 5;
      if (format[i]->multisample.supported) 
!       score[i] += (10 + format[i]->multisample.samples);
    }
    
--- 51,66 ----
      if (format[i]->alpha_size)
        score[i] += 10;
      if (format[i]->stencil_size)
        score[i] += (10 + format[i]->stencil_size);
      if (format[i]->doublebuffer)
!       score[i] -= 10;
      if (format[i]->draw.onscreen)
!       score[i] += 5;
      if (format[i]->draw.offscreen)
!       score[i] += 5;
      if (format[i]->draw.offscreen && format[i]->draw.onscreen)
        score[i] += 5;
      if (format[i]->multisample.supported) 
!       score[i] -= (10 - format[i]->multisample.samples);
    }
    

Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** glitz_glx_info.c	9 Aug 2004 22:57:35 -0000	1.13
--- glitz_glx_info.c	18 Aug 2004 12:30:24 -0000	1.14
***************
*** 92,100 ****
    (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_t) 0,
--- 92,95 ----
***************
*** 411,419 ****
            sizeof (glitz_gl_proc_address_list_t));
    
!   memset (&screen_info->root_context.glx, 0,
!           sizeof (glitz_glx_proc_address_list_t));
!   
!   screen_info->root_context.gl.need_lookup =
!     screen_info->root_context.glx.need_lookup = 1;
  }
  
--- 406,410 ----
            sizeof (glitz_gl_proc_address_list_t));
    
!   screen_info->root_context.gl.need_lookup = 1;
  }
  

Index: glitz_glx_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_surface.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** glitz_glx_surface.c	9 Aug 2004 22:57:35 -0000	1.16
--- glitz_glx_surface.c	18 Aug 2004 12:30:24 -0000	1.17
***************
*** 194,211 ****
    surface->base.feature_mask &= ~GLITZ_FEATURE_VERTEX_PROGRAM_MASK;
    surface->base.feature_mask &= ~GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
-   surface->base.feature_mask &= ~GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
    surface->base.feature_mask &= ~GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
  
!   if (surface->context->glx.need_lookup) {
      glitz_glx_context_push_current (surface, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
      glitz_glx_context_pop_current (surface);
    }
  
-   if ((surface->screen_info->glx_feature_mask &
-        GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK) &&
-       surface->context->glx.bind_tex_image &&
-       surface->context->glx.release_tex_image)
-     surface->render_texture = 1;
- 
    if (surface->context->gl.active_texture &&
        surface->context->gl.multi_tex_coord_2d) {
--- 194,204 ----
    surface->base.feature_mask &= ~GLITZ_FEATURE_VERTEX_PROGRAM_MASK;
    surface->base.feature_mask &= ~GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
    surface->base.feature_mask &= ~GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
  
!   if (surface->context->gl.need_lookup) {
      glitz_glx_context_push_current (surface, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
      glitz_glx_context_pop_current (surface);
    }
  
    if (surface->context->gl.active_texture &&
        surface->context->gl.multi_tex_coord_2d) {
***************
*** 226,239 ****
          
          if (surface->screen_info->feature_mask &
!             GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK) {
            surface->base.feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
-       
-           if (surface->context->texture_indirections >= 9) {
-             /* Convolution filter programs require support for at least nine
-                texture indirections. */
-             surface->base.feature_mask |=
-               GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
-           }
-         }
        }
      }
--- 219,224 ----
          
          if (surface->screen_info->feature_mask &
!             GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)
            surface->base.feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
        }
      }

Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxint.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glitz_glxint.h	9 Aug 2004 22:57:35 -0000	1.12
--- glitz_glxint.h	18 Aug 2004 12:30:24 -0000	1.13
***************
*** 51,56 ****
  #define GLITZ_GLX_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 11)
  #define GLITZ_GLX_FEATURE_GLX13_MASK                    (1L << 12)
! #define GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK           (1L << 13)
! #define GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 14)
  
  typedef struct _glitz_glx_surface glitz_glx_surface_t;
--- 51,55 ----
  #define GLITZ_GLX_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 11)
  #define GLITZ_GLX_FEATURE_GLX13_MASK                    (1L << 12)
! #define GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 13)
  
  typedef struct _glitz_glx_surface glitz_glx_surface_t;
***************
*** 69,78 ****
  } glitz_glx_static_proc_address_list_t;
  
- typedef struct _glitz_glx_proc_address_list_t {
-   glitz_glx_bind_tex_image_t bind_tex_image;
-   glitz_glx_release_tex_image_t release_tex_image;
-   glitz_bool_t need_lookup;
- } glitz_glx_proc_address_list_t;
- 
  typedef struct _glitz_glx_thread_info_t {
    glitz_glx_display_info_t **displays;
--- 68,71 ----
***************
*** 99,105 ****
    XID id;
    glitz_gl_proc_address_list_t gl;
-   glitz_glx_proc_address_list_t glx;
    GLXFBConfig fbconfig;
-   glitz_gl_uint_t texture_indirections;
  } glitz_glx_context_t;
  
--- 92,96 ----
***************
*** 136,140 ****
    GLXDrawable drawable;
    GLXDrawable pbuffer;
-   glitz_bool_t render_texture;
  };
  
--- 127,130 ----

--- glitz_matrix.c DELETED ---

Index: glitz_pixel.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_pixel.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** glitz_pixel.c	9 Aug 2004 22:57:35 -0000	1.3
--- glitz_pixel.c	18 Aug 2004 12:30:24 -0000	1.4
***************
*** 679,685 ****
    }
  
!   if (SURFACE_RENDER_TEXTURE (dst))
!     to_drawable = 0;
!   else if (SURFACE_DRAWABLE (dst))
      to_drawable = 1;
    else
--- 679,683 ----
    }
  
!   if (SURFACE_DRAWABLE (dst))
      to_drawable = 1;
    else

Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** glitz_program.c	9 Aug 2004 22:57:35 -0000	1.10
--- glitz_program.c	18 Aug 2004 12:30:24 -0000	1.11
***************
*** 112,124 ****
  
  /*
!  * Default vertex program
!  *
!  * Author: David Reveman <c99drn at cs.umu.se>
   */   
! static const char *_glitz_vertex_program[] = {
    "!!ARBvp1.0",
    "OPTION ARB_position_invariant;",
!   "MOV result.texcoord[%s], vertex.texcoord[%s];",
!   "MOV result.texcoord[%s], vertex.texcoord[%s];",
    "MOV result.color, vertex.color;",
    "END", NULL
--- 112,122 ----
  
  /*
!  * minimum vertex program
   */   
! static const char *_vertex_program[] = {
    "!!ARBvp1.0",
    "OPTION ARB_position_invariant;",
!   "MOV result.texcoord[0], vertex.texcoord[0];",
!   "MOV result.texcoord[1], vertex.texcoord[1];",
    "MOV result.color, vertex.color;",
    "END", NULL
***************
*** 126,248 ****
  
  /*
!   TODO: the following convolution filter program could easily be
!   dynamically created for any convolution kernel size.
! */
! 
! /*
!  * 9 samples convolution filter. projective transformations might not
!  * produce correct results.
!  *
!  * program.local[0..n]: Each parameter holds an offset and a weight.
!  *
!  * Author: David Reveman <c99drn at cs.umu.se>
   */
! static const char *_glitz_fragment_program_convolution[] = {
    "!!ARBfp1.0",
!   "ATTRIB center = fragment.texcoord[%s];",
!   "PARAM p0 = program.local[0];",
!   "PARAM p1 = program.local[1];",
!   "PARAM p2 = program.local[2];",
!   "PARAM p3 = program.local[3];",
!   "PARAM p4 = program.local[4];",
!   "PARAM p5 = program.local[5];",
!   "PARAM p6 = program.local[6];",
!   "PARAM p7 = program.local[7];",
!   "PARAM p8 = program.local[8];",
!   "PARAM m0 = state.matrix.texture[%s].row[0];",
!   "PARAM m1 = state.matrix.texture[%s].row[1];",
!   "PARAM m3 = state.matrix.texture[%s].row[3];",
    "TEMP color, in, coord, position;",
  
    /* extra declerations */
!   "%s",
  
    /* projective transform */
!   "DP4 position.x, m0, center;",
!   "DP4 position.y, m1, center;",
!   "DP4 position.w, m3, center;",
!   "MOV coord, position;",
! 
!   /* 1 */
!   "ADD coord.x, position.x, p0.x;",
!   "ADD coord.y, position.y, p0.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MUL color, in, p0.z;",
! 
!   /* 2 */
!   "ADD coord.x, position.x, p1.x;",
!   "ADD coord.y, position.y, p1.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p1.z, color;",
! 
!   /* 3 */
!   "ADD coord.x, position.x, p2.x;",
!   "ADD coord.y, position.y, p2.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p2.z, color;",
! 
!   /* 4 */
!   "ADD coord.x, position.x, p3.x;",
!   "ADD coord.y, position.y, p3.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p3.z, color;",
! 
!   /* 5 */
!   "ADD coord.x, position.x, p4.x;",
!   "ADD coord.y, position.y, p4.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p4.z, color;",
! 
!   /* 6 */
!   "ADD coord.x, position.x, p5.x;",
!   "ADD coord.y, position.y, p5.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p5.z, color;",
! 
!   /* 7 */
!   "ADD coord.x, position.x, p6.x;",
!   "ADD coord.y, position.y, p6.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p6.z, color;",
  
!   /* 8 */
!   "ADD coord.x, position.x, p7.x;",
!   "ADD coord.y, position.y, p7.y;",
    "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p7.z, color;",
  
!   /* 9 */
!   "ADD coord.x, position.x, p8.x;",
!   "ADD coord.y, position.y, p8.y;",
    "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p8.z, color;",
! 
!   /* IN operation */
!   "%s",
!   
!   "END", NULL
  };
  
  /*
!  * Linear gradient filter.
!  *
!  * program.local[0].x = start offset
!  * program.local[0].y = 1 / length
!  * program.local[0].z = sin (angle)
!  * program.local[0].w = cos (angle)
!  *
!  * Incoming texture coordinate is transformed using the affine
!  * transform stored in the texture matrix.
!  *
!  * Author: David Reveman <c99drn at cs.umu.se>
   */
! static const char *_glitz_fragment_program_linear[] = {
    "!!ARBfp1.0",
    "PARAM gradient = program.local[0];",
!   "PARAM adjust = program.local[1];",
!   "PARAM affine0 = state.matrix.texture[%s].row[0];",
!   "PARAM affine1 = state.matrix.texture[%s].row[1];",
    "ATTRIB pos = fragment.texcoord[%s];",
!   "TEMP color, distance, position;",
  
    /* extra declerations */
--- 124,172 ----
  
  /*
!  * general convolution filter (projective transformations might not
!  * produce correct results).
   */
! static const char *_convolution_header[] = {
    "!!ARBfp1.0",
!   "PARAM p[%d] = { program.local[0..%d] };",
!   "PARAM m[4] = { state.matrix.texture[%s].row[0..3] };",
!   "ATTRIB pos = fragment.texcoord[%s];",
    "TEMP color, in, coord, position;",
  
    /* extra declerations */
!   "%s"
  
    /* projective transform */
!   "DP4 position.x, m[0], pos;",
!   "DP4 position.y, m[1], pos;",
!   "DP4 position.w, m[3], pos;",
!   "MOV coord, position;", NULL
! };
  
! static const char *_convolution_sample_first[] = {
!   "ADD coord.x, position.x, p[0].x;",
!   "ADD coord.y, position.y, p[0].y;",
    "TXP in, coord, texture[%s], %s;",
!   "MUL color, in, p[0].z;", NULL
! };
  
! static const char *_convolution_sample[] = {
!   "ADD coord.x, position.x, p[%d].x;",
!   "ADD coord.y, position.y, p[%d].y;",
    "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p[%d].z, color;", NULL
  };
  
+ 
  /*
!  * gradient filters.
   */
! static const char *_gradient_header[] = {
    "!!ARBfp1.0",
    "PARAM gradient = program.local[0];",
!   "PARAM stops[%d] = { program.local[1..%d] };",
!   "PARAM m[2] = { state.matrix.texture[%s].row[0..1] };",
    "ATTRIB pos = fragment.texcoord[%s];",
!   "TEMP color, second_color, stop0, stop1, position;",
  
    /* extra declerations */
***************
*** 250,335 ****
  
    /* affine transform */
!   "DP4 position.x, affine0, pos;",
!   "DP4 position.y, affine1, pos;",
  
!   /* calculate gradient offset */
    "MUL position.x, gradient.z, position.x;",
    "MAD position.x, gradient.w, position.y, position.x;",
!   
!   "SUB distance.x, position.x, gradient.x;",
!   "MUL distance.x, distance.x, gradient.y;",
! 
!   /* temporary fix (until the new gradient shaders are implemented) */
!   "MOV distance.y, 0.5;",
!   "MUL distance.x, distance.x, adjust.x;",
!   
!   "TEX color, distance, texture[%s], %s;",
!   
!   /* IN operation */
!   "%s",
!   
!   "END", NULL
  };
  
  /*
!  * Radial gradient filter.
!  *
!  * param.local[0].x = center point X coordinate
!  * param.local[0].y = center point Y coordinate
!  * param.local[0].z = 1 / (radius1 - radius0)
!  * param.local[0].w = radius0
!  *
!  * Incoming texture coordinate is transformed using the affine
!  * transform stored in the texture matrix.
   *
!  * Author: David Reveman <c99drn at cs.umu.se>
   */
! static const char *_glitz_fragment_program_radial[] = {
!   "!!ARBfp1.0",
!   "PARAM gradient = program.local[0];",
!   "PARAM adjust = program.local[1];",
!   "PARAM affine0 = state.matrix.texture[%s].row[0];",
!   "PARAM affine1 = state.matrix.texture[%s].row[1];",
!   "ATTRIB pos = fragment.texcoord[%s];",
!   "TEMP color, distance, position;",
  
!   /* extra declerations */
!   "%s",
  
!   /* affine transform */
!   "DP4 position.x, affine0, pos;",
!   "DP4 position.y, affine1, pos;",
!   
!   /* calculate gradient offset */
!   "SUB distance, position, gradient;",
  
!   "DP3 distance.x, distance, distance;",
!   "RSQ distance.w, distance.x;",
!   
!   "RCP distance.x, distance.w;",
!   "MUL distance.x, distance.x, distance.x;",
!   "MUL distance.x, distance.x, distance.w;",
!   
!   "SUB distance.x, distance.x, gradient.w;",
!   "MUL distance.x, distance.x, gradient.z;",
  
!   /* temporary fix (until the new gradient shaders are implemented) */
!   "MOV distance.y, 0.5;",
!   "MUL distance.x, distance.x, adjust.x;",
!   
!   "TEX color, distance, texture[%s], %s;",
!   
!   /* IN operation */
!   "%s",
!   
!   "END", NULL
  };
  
! static glitz_gl_uint_t
  _glitz_compile_arb_vertex_program (glitz_gl_proc_address_list_t *gl,
                                     char *program_string)
  {
!   glitz_gl_int_t error;
!   glitz_gl_uint_t program;
      
    gl->gen_programs (1, &program);
--- 174,267 ----
  
    /* affine transform */
!   "DP4 position.x, m[0], pos;",
!   "DP4 position.y, m[1], pos;", NULL
! };
  
! /*
!  * linear gradient filter.
!  *
!  * gradient.x = start offset
!  * gradient.y = 1 / length
!  * gradient.z = sin (angle)
!  * gradient.w = cos (angle)
!  */
! static const char *_linear_gradient_calculations[] = {
    "MUL position.x, gradient.z, position.x;",
    "MAD position.x, gradient.w, position.y, position.x;",
!   "SUB position.z, position.x, gradient.x;",
!   "MUL position.z, position.z, gradient.y;", NULL
  };
  
  /*
!  * radial gradient filter.
   *
!  * gradient.x = center point X coordinate
!  * gradient.y = center point Y coordinate
!  * gradient.z = radius0
!  * gradient.w = 1 / (radius1 - radius0)
   */
! static const char *_radial_gradient_calculations[] = {
!   "SUB position, position, gradient;",
!   "MUL position.x, position.x, position.x;",
!   "MAD position.x, position.y, position.y, position.x;",
!   "RSQ position.y, position.x;",
!   "RCP position.x, position.y;",
!   "MUL position.x, position.x, position.x;",
!   "MUL position.x, position.x, position.y;",
!   "SUB position.x, position.x, gradient.z;",
!   "MUL position.z, position.x, gradient.w;", NULL
! };
  
! static const char *_gradient_fill_repeat[] = {
!   "FRC position.z, position.z;", NULL
! };
  
! static const char *_gradient_fill_reflect[] = {
!   "FLR position.w, position.z;",
!   "MUL position.w, position.w, 0.5;",
!   "FLR position.w, position.w;",
!   "MUL position.y, position.w, 2.0;",
!   "FLR position.x, position.z;",
!   "SUB position.y, position.x, position.y;",
!   "FRC position.x, position.z;",
!   "SUB position.x, position.x, position.y;",
!   "ABS position.z, position.x;", NULL
! };
  
! static const char *_gradient_init_stops[] = {
!   "MOV stop0, stops[0];",
!   "MOV stop1, stops[%d];", NULL
! };
  
! static const char *_gradient_lower_stop[] = {
!   "SLT position.x, stops[%d].z, position.z;",
!   "CMP stop0, -position.x, stops[%d], stop0;", NULL
  };
  
! static const char *_gradient_higher_stop[] = {
!   "SLT position.x, position.z, stops[%d].z;",
!   "CMP stop1, -position.x, stops[%d], stop1;", NULL
! };
! 
! static const char *_gradient_fetch_and_interpolate[] = {
!   "TEX color, stop0, texture[%s], %s;",
!   "TEX second_color, stop1, texture[%s], %s;",
! 
!   /* normalize gradient offset to color stop span */
!   "SUB position.z, position.z, stop0.z;",
!   "MUL_SAT position.z, position.z, stop0.w;",
! 
!   /* linear interpolation */
!   "LRP color, position.z, second_color, color;", NULL
! };
! 
! static glitz_gl_int_t
  _glitz_compile_arb_vertex_program (glitz_gl_proc_address_list_t *gl,
                                     char *program_string)
  {
!   glitz_gl_int_t error, pid = -1;
!   glitz_gl_uint_t value, program;
! 
!   gl->enable (GLITZ_GL_VERTEX_PROGRAM);
      
    gl->gen_programs (1, &program);
***************
*** 339,358 ****
                        strlen (program_string),
                        program_string);
!   
    gl->get_integer_v (GLITZ_GL_PROGRAM_ERROR_POSITION, &error);
!   if (error != -1) {
      gl->delete_programs (1, &program);
-     program = 0;
    }
    
!   return program;
  }
  
! static glitz_gl_uint_t
  _glitz_compile_arb_fragment_program (glitz_gl_proc_address_list_t *gl,
                                       char *program_string)
  {
!   glitz_gl_int_t error;
!   glitz_gl_uint_t program;
  
    gl->gen_programs (1, &program);
--- 271,307 ----
                        strlen (program_string),
                        program_string);
! 
    gl->get_integer_v (GLITZ_GL_PROGRAM_ERROR_POSITION, &error);
!   if (error == -1) {
!     gl->get_program_iv (GLITZ_GL_VERTEX_PROGRAM,
!                         GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS,
!                         &value);
!     if (value > 0) {
!       gl->get_program_iv (GLITZ_GL_VERTEX_PROGRAM,
!                           GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS,
!                           &value);
!       if (value == GLITZ_GL_TRUE)
!         pid = program;
!     }
!   }
!   
!   if (pid == -1) {
!     gl->bind_program (GLITZ_GL_VERTEX_PROGRAM, 0);
      gl->delete_programs (1, &program);
    }
+ 
+   gl->disable (GLITZ_GL_VERTEX_PROGRAM);
    
!   return pid;
  }
  
! static glitz_gl_int_t
  _glitz_compile_arb_fragment_program (glitz_gl_proc_address_list_t *gl,
                                       char *program_string)
  {
!   glitz_gl_int_t error, pid = -1;
!   glitz_gl_uint_t value, program;
! 
!   gl->enable (GLITZ_GL_FRAGMENT_PROGRAM);
  
    gl->gen_programs (1, &program);
***************
*** 362,373 ****
                        strlen (program_string),
                        program_string);
!   
    gl->get_integer_v (GLITZ_GL_PROGRAM_ERROR_POSITION, &error);
!   if (error != -1) {
      gl->delete_programs (1, &program);
-     program = 0;
    }
    
!   return program;
  }
  
--- 311,337 ----
                        strlen (program_string),
                        program_string);
! 
    gl->get_integer_v (GLITZ_GL_PROGRAM_ERROR_POSITION, &error);
!   if (error == -1) {
!     gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
!                         GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS,
!                         &value);
!     if (value > 0) {
!       gl->get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
!                           GLITZ_GL_PROGRAM_UNDER_NATIVE_LIMITS,
!                           &value);
!       if (value == GLITZ_GL_TRUE)
!         pid = program;
!     }
!   }
!   
!   if (pid == -1) {
!     gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
      gl->delete_programs (1, &program);
    }
+ 
+   gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
    
!   return pid;
  }
  
***************
*** 386,533 ****
  
  static glitz_gl_uint_t
! _glitz_create_vertex_program (glitz_composite_op_t *op,
!                               glitz_filter_t filter,
!                               const glitz_program_expand_t *expand)
  {
!   char program[512], program_buffer[512];
  
!   _string_array_to_char_array (program, _glitz_vertex_program);
      
    switch (op->type) {
    case GLITZ_COMBINE_TYPE_ARGBF:
    case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
    case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
!     sprintf (program_buffer, program,
!              "0", "0", "1", "1");
      break;
    case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
    case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
!     sprintf (program_buffer, program,
!              "1", "1", "0", "0");
      break;
    default:
      return 0;
    }
-   
-   return _glitz_compile_arb_vertex_program (op->gl, program_buffer);
- }
  
! static glitz_gl_uint_t
! _glitz_create_fragment_program (glitz_composite_op_t *op,
!                                 glitz_filter_t filter,
!                                 const glitz_program_expand_t *expand)
! {
!   char program[4096], program_buffer[4096];
  
!   switch (filter) {
!   case GLITZ_FILTER_CONVOLUTION:
!       _string_array_to_char_array (program,
!                                    _glitz_fragment_program_convolution);
!       
!       switch (op->type) {
!       case GLITZ_COMBINE_TYPE_ARGBF:
!       case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
!       case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
!         sprintf (program_buffer, program,
!                  "0", "0", "0", "0",
!                  expand->declarations,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  expand->in);
!         break;
!       case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
!       case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
!         sprintf (program_buffer, program,
!                  "1", "1", "1", "1",
!                  expand->declarations,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  expand->in);
!         break;
!       default:
!         return 0;
!       }
!       break;
!   case GLITZ_FILTER_LINEAR_GRADIENT:
!     _string_array_to_char_array (program, _glitz_fragment_program_linear);
      
!     switch (op->type) {
!     case GLITZ_COMBINE_TYPE_ARGBF:
!     case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
!     case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
!       sprintf (program_buffer, program,
!                "0", "0", "0",
!                expand->declarations,
!                "0", expand->texture,
!                expand->in);
!       break;
!     case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
!     case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
!       sprintf (program_buffer, program,
!                "1", "1", "1",
!                expand->declarations,
!                "1", expand->texture,
!                expand->in);
        break;
      default:
!       return 0;
      }
!     break;
!   case GLITZ_FILTER_RADIAL_GRADIENT:
!     _string_array_to_char_array (program, _glitz_fragment_program_radial);
      
!     switch (op->type) {
!     case GLITZ_COMBINE_TYPE_ARGBF:
!     case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
!     case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
!       sprintf (program_buffer, program,
!                "0", "0", "0",
!                expand->declarations,
!                "0", expand->texture,
!                expand->in);
        break;
!     case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
!     case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
!       sprintf (program_buffer, program,
!                "1", "1", "1",
!                expand->declarations,
!                "1", expand->texture,
!                expand->in);
        break;
      default:
!       return 0;
      }
      break;
    default:
      return 0;
    }
    
!   return _glitz_compile_arb_fragment_program (op->gl, program_buffer);
! }
  
! static int
! _texture_index (glitz_surface_t *surface)
! {
!   if (surface) {
!     if (surface->texture.target == GLITZ_GL_TEXTURE_2D)
!       return GLITZ_TEXTURE_2D;
!     else
!       return GLITZ_TEXTURE_RECT;
!   } else
!     return GLITZ_TEXTURE_NONE;
  }
                        
--- 350,489 ----
  
  static glitz_gl_uint_t
! _glitz_create_vertex_program (glitz_composite_op_t *op)
  {
!   char program[512];
  
!   _string_array_to_char_array (program, _vertex_program);
      
+   return _glitz_compile_arb_vertex_program (op->gl, program);
+ }
+ 
+ /* these should be more than enough */
+ #define CONVOLUTION_BASE_SIZE   2048
+ #define CONVOLUTION_SAMPLE_SIZE 256
+ 
+ #define GRADIENT_BASE_SIZE 2048
+ #define GRADIENT_STOP_SIZE 256
+ 
+ static glitz_gl_uint_t
+ _glitz_create_fragment_program (glitz_composite_op_t *op,
+                                 int fp_type,
+                                 int id,
+                                 const glitz_program_expand_t *expand)
+ {
+   char buffer[1024], *program = NULL, *tex, *p = NULL;
+   glitz_gl_uint_t fp;
+   int i;
+   
    switch (op->type) {
    case GLITZ_COMBINE_TYPE_ARGBF:
    case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
    case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
!     tex = "0";
      break;
    case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
    case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
!     tex = "1";
      break;
    default:
      return 0;
    }
  
!   switch (fp_type) {
!   case GLITZ_FP_CONVOLUTION:
!     program = malloc (CONVOLUTION_BASE_SIZE + CONVOLUTION_SAMPLE_SIZE * id);
!     if (program == NULL)
!       return 0;
  
!     p = program;
      
!     _string_array_to_char_array (buffer, _convolution_header);
!     p += sprintf (p, buffer, id, id - 1, tex, tex, expand->declarations);
!     
!     _string_array_to_char_array (buffer, _convolution_sample_first);
!     p += sprintf (p, buffer, tex, expand->texture);
!     
!     _string_array_to_char_array (buffer, _convolution_sample);
!     for (i = 1; i < id; i++)
!       p += sprintf (p, buffer, i, i, tex, expand->texture, i);
!     
!     break;
!   case GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT:
!   case GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT:
!     id += 2;
!     /* fall-through */
!   case GLITZ_FP_LINEAR_GRADIENT_NEAREST:
!   case GLITZ_FP_LINEAR_GRADIENT_REPEAT:
!   case GLITZ_FP_LINEAR_GRADIENT_REFLECT:
!   case GLITZ_FP_RADIAL_GRADIENT_NEAREST:
!   case GLITZ_FP_RADIAL_GRADIENT_REPEAT:
!   case GLITZ_FP_RADIAL_GRADIENT_REFLECT:
!     program = malloc (GRADIENT_BASE_SIZE + GRADIENT_STOP_SIZE * id);
!     if (program == NULL)
!       return 0;
! 
!     p = program;
!     
!     _string_array_to_char_array (buffer, _gradient_header);
!     p += sprintf (p, buffer, id, id, tex, tex, expand->declarations);
!     
!     switch (fp_type) {
!     case GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT:
!     case GLITZ_FP_LINEAR_GRADIENT_NEAREST:
!     case GLITZ_FP_LINEAR_GRADIENT_REPEAT:
!     case GLITZ_FP_LINEAR_GRADIENT_REFLECT:
!       _string_array_to_char_array (buffer, _linear_gradient_calculations);
        break;
      default:
!       _string_array_to_char_array (buffer, _radial_gradient_calculations);
!       break;
      }
! 
!     p += sprintf (p, buffer);
      
!     switch (fp_type) {
!     case GLITZ_FP_LINEAR_GRADIENT_REPEAT:
!     case GLITZ_FP_RADIAL_GRADIENT_REPEAT:
!       _string_array_to_char_array (buffer, _gradient_fill_repeat);
!       p += sprintf (p, buffer);
        break;
!     case GLITZ_FP_LINEAR_GRADIENT_REFLECT:
!     case GLITZ_FP_RADIAL_GRADIENT_REFLECT:
!       _string_array_to_char_array (buffer, _gradient_fill_reflect);
!       p += sprintf (p, buffer);
        break;
      default:
!       break;
      }
+     
+     _string_array_to_char_array (buffer, _gradient_init_stops);
+     p += sprintf (p, buffer, id - 1);
+ 
+     _string_array_to_char_array (buffer, _gradient_lower_stop);
+     for (i = 1; i < (id - 1); i++)
+       p += sprintf (p, buffer, i, i);
+     
+     _string_array_to_char_array (buffer, _gradient_higher_stop);
+     for (i = 1; i < (id - 1); i++)
+       p += sprintf (p, buffer, id - i - 1, id - i - 1);
+     
+     _string_array_to_char_array (buffer, _gradient_fetch_and_interpolate);
+     p += sprintf (p, buffer, tex, expand->texture, tex, expand->texture);
      break;
    default:
      return 0;
    }
+ 
+   if (program == NULL)
+     return 0;
    
!   p += sprintf (p, "%s", expand->in);
!   sprintf (p, "END");
  
!   fp = _glitz_compile_arb_fragment_program (op->gl, program);
!   
!   free (program);
! 
!   return fp;
  }
                        
***************
*** 542,620 ****
                          glitz_program_map_t *map)
  {
!   int i, j, x, y;
      
!   for (i = 0; i < GLITZ_COMBINE_TYPES; i++)
!     for (j = 0; j < GLITZ_FRAGMENT_FILTER_TYPES; j++)
!       for (x = 0; x < GLITZ_TEXTURE_LAST; x++)
          for (y = 0; y < GLITZ_TEXTURE_LAST; y++) {
!           if (map->info[i][j].vertex[x][y])
!             gl->delete_programs (1, &map->info[i][j].vertex[x][y]);
!           if (map->info[i][j].fragment[x][y])
!             gl->delete_programs (1, &map->info[i][j].vertex[x][y]);
          }
  }
  
  glitz_gl_uint_t
! glitz_get_vertex_program (glitz_composite_op_t *op,
!                           glitz_filter_t filter)
  {
!   glitz_gl_uint_t *program;
!   int index1 = _texture_index (op->src);
!   int index2 = _texture_index (op->mask);
  
!   /* smae vertex program for all filters */
!   program = &op->dst->program_map->info[op->type][0].vertex[index1][index2];
    
    if (*program == 0) {
!     if (glitz_surface_push_current (op->dst,
!                                     GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!       *program =
!         _glitz_create_vertex_program (op, filter,
!                                       &_program_expand_map[index1][index2]);
!     }
      glitz_surface_pop_current (op->dst);
    }
! 
!   return *program;
  }
! 
  glitz_gl_uint_t
  glitz_get_fragment_program (glitz_composite_op_t *op,
!                             glitz_filter_t filter)
  {
!   glitz_gl_uint_t *program;
!   int index1 = _texture_index (op->src);
!   int index2 = _texture_index (op->mask);
!   int ftype;
  
!   switch (filter) {
!   case GLITZ_FILTER_CONVOLUTION:
!     ftype = GLITZ_FRAGMENT_FILTER_CONVOLUTION;
!     break;
!   case GLITZ_FILTER_LINEAR_GRADIENT:
!     ftype = GLITZ_FRAGMENT_FILTER_LINEAR_GRADIENT;
!     break;
!   case GLITZ_FILTER_RADIAL_GRADIENT:
!     ftype = GLITZ_FRAGMENT_FILTER_RADIAL_GRADIENT;
!     break;
!   case GLITZ_FILTER_BILINEAR:
!   case GLITZ_FILTER_NEAREST:
!   default:
!     return 0;
!   }
!   
!   program =
!     &op->dst->program_map->info[op->type][ftype].fragment[index1][index2];
    
!   if (*program == 0) {
!     if (glitz_surface_push_current (op->dst,
!                                     GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!       *program =
!         _glitz_create_fragment_program (op, filter,
!                                         &_program_expand_map[index1][index2]);
      }
      glitz_surface_pop_current (op->dst);
    }
  
!   return *program;
  }
--- 498,597 ----
                          glitz_program_map_t *map)
  {
!   glitz_gl_uint_t program;
!   int i, j, k, x, y;
      
!   for (i = 0; i < GLITZ_COMBINE_TYPES; i++) {
!     for (j = 0; j < GLITZ_FP_TYPES; j++) {
!       for (x = 0; x < GLITZ_TEXTURE_LAST; x++) {
          for (y = 0; y < GLITZ_TEXTURE_LAST; y++) {
!           glitz_program_t *p = &map->filters[i][j].fp[x][y];
!           
!           if (p->name) {
!             for (k = 0; k < p->size; k++)
!               if (p->name[k] > 0) {
!                 program = p->name[k];
!                 gl->delete_programs (1, &program);
!               }
!             
!             free (p->name);
!           }
          }
+       }
+     }
+   }
+   
+   if (map->vp > 0) {
+     program = map->vp;
+     gl->delete_programs (1, &program);
+   }
  }
  
+ #define TEXTURE_INDEX(surface) \
+   ((surface)? \
+    (((surface)->texture.target == GLITZ_GL_TEXTURE_2D)? \
+     GLITZ_TEXTURE_2D: \
+     GLITZ_TEXTURE_RECT \
+     ) : \
+    GLITZ_TEXTURE_NONE \
+    )
+ 
  glitz_gl_uint_t
! glitz_get_vertex_program (glitz_composite_op_t *op)
  {
!   glitz_gl_int_t *program;
  
!   program = &op->dst->program_map->vp;
    
    if (*program == 0) {
!     glitz_surface_push_current (op->dst, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
!     *program = _glitz_create_vertex_program (op);
      glitz_surface_pop_current (op->dst);
    }
!   
!   if (*program > 0)
!     return *program;
!   else
!     return 0;
  }
!      
  glitz_gl_uint_t
  glitz_get_fragment_program (glitz_composite_op_t *op,
!                             int fp_type,
!                             int id)
  {
!   glitz_program_t *program;
!   int t0 = TEXTURE_INDEX (op->src);
!   int t1 = TEXTURE_INDEX (op->mask);
  
!   program = &op->dst->program_map->filters[op->type][fp_type].fp[t0][t1];
    
!   if (program->size < id) {
!     int old_size;
!     
!     program->name = realloc (program->name,
!                              id * sizeof (glitz_gl_uint_t));
!     if (program->name == NULL) {
!       glitz_surface_status_add (op->dst, GLITZ_STATUS_NO_MEMORY_MASK);
!       return 0;
      }
+     old_size = program->size;
+     program->size = id;
+     memset (program->name + old_size, 0,
+             (program->size - old_size) * sizeof (glitz_gl_uint_t));
+   }
+   
+   if (program->name[id - 1] == 0) {
+     glitz_surface_push_current (op->dst, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
+     
+     program->name[id - 1] =
+       _glitz_create_fragment_program (op, fp_type, id,
+                                       &_program_expand_map[t0][t1]);
+     
      glitz_surface_pop_current (op->dst);
    }
  
!   if (program->name[id - 1] > 0)
!     return program->name[id - 1];
!   else
!     return 0;
  }

Index: glitz_rect.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_rect.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_rect.c	9 Aug 2004 22:57:35 -0000	1.6
--- glitz_rect.c	18 Aug 2004 12:30:24 -0000	1.7
***************
*** 39,54 ****
  
  static void
! glitz_rectangle_bounds (int n_rects,
                          const glitz_rectangle_t *rects,
                          glitz_bounding_box_t *box)
  {
!   box->x1 = rects->x;
!   box->x2 = rects->x + rects->width;
!   box->y1 = rects->y;
!   box->y2 = rects->y + rects->height;
!   rects++;
!   n_rects--;
!     
!   while (n_rects-- > 0) {
      if (rects->x < box->x1)
        box->x1 = rects->x;
--- 39,54 ----
  
  static void
! glitz_rectangle_bounds (int x_offset,
!                         int y_offset,
!                         int n_rects,
                          const glitz_rectangle_t *rects,
                          glitz_bounding_box_t *box)
  {
!   box->x1 = MAXSHORT;
!   box->x2 = MINSHORT;
!   box->y1 = MAXSHORT;
!   box->y2 = MINSHORT;
!   
!   for (; n_rects; n_rects--, rects++) {
      if (rects->x < box->x1)
        box->x1 = rects->x;
***************
*** 59,64 ****
      else if ((rects->y + rects->height) > box->y2)
        box->y2 = rects->y + rects->height;
-     rects++;
    }
  }
  
--- 59,68 ----
      else if ((rects->y + rects->height) > box->y2)
        box->y2 = rects->y + rects->height;
    }
+ 
+   box->x1 += x_offset;
+   box->x2 += x_offset;
+   box->y1 += y_offset;
+   box->y2 += y_offset;
  }
  
***************
*** 66,69 ****
--- 70,75 ----
  glitz_int_fill_rectangles (glitz_operator_t op,
                             glitz_surface_t *dst,
+                            int x_offset,
+                            int y_offset,
                             const glitz_color_t *color,
                             const glitz_rectangle_t *rects,
***************
*** 92,97 ****
      for (; n_rects; n_rects--, rects++) {
        gl->enable (GLITZ_GL_SCISSOR_TEST);
!       gl->scissor (rects->x,
!                    dst->height - (rects->y + rects->height),
                     rects->width,
                     rects->height);
--- 98,103 ----
      for (; n_rects; n_rects--, rects++) {
        gl->enable (GLITZ_GL_SCISSOR_TEST);
!       gl->scissor (x_offset + rects->x,
!                    dst->height - (y_offset + rects->y + rects->height),
                     rects->width,
                     rects->height);
***************
*** 109,116 ****
        
      for (; n_rects; n_rects--, rects++) {
!       vertex_2i (rects->x, rects->y);
!       vertex_2i (rects->x + rects->width, rects->y);
!       vertex_2i (rects->x + rects->width, rects->y + rects->height);
!       vertex_2i (rects->x, rects->y + rects->height);
      }
    
--- 115,123 ----
        
      for (; n_rects; n_rects--, rects++) {
!       vertex_2i (x_offset + rects->x, y_offset + rects->y);
!       vertex_2i (x_offset + rects->x + rects->width, y_offset + rects->y);
!       vertex_2i (x_offset + rects->x + rects->width,
!                  y_offset + rects->y + rects->height);
!       vertex_2i (x_offset + rects->x, y_offset + rects->y + rects->height);
      }
    
***************
*** 172,176 ****
    }
  
!   glitz_int_fill_rectangles (op, dst, color, &rect, 1);
  
    glitz_surface_dirty (dst, &bounds);
--- 179,183 ----
    }
  
!   glitz_int_fill_rectangles (op, dst, 0, 0, color, &rect, 1);
  
    glitz_surface_dirty (dst, &bounds);
***************
*** 182,185 ****
--- 189,194 ----
  glitz_fill_rectangles (glitz_operator_t op,
                         glitz_surface_t *dst,
+                        int x_offset,
+                        int y_offset,
                         const glitz_color_t *color,
                         const glitz_rectangle_t *rects,
***************
*** 188,192 ****
    glitz_bounding_box_t bounds;
    
!   glitz_rectangle_bounds (n_rects, rects, &bounds);
    if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
--- 197,201 ----
    glitz_bounding_box_t bounds;
    
!   glitz_rectangle_bounds (x_offset, y_offset, n_rects, rects, &bounds);
    if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
***************
*** 206,210 ****
    }
  
!   glitz_int_fill_rectangles (op, dst, color, rects, n_rects);
  
    glitz_surface_dirty (dst, &bounds);
--- 215,220 ----
    }
  
!   glitz_int_fill_rectangles (op, dst, x_offset, y_offset,
!                              color, rects, n_rects);
  
    glitz_surface_dirty (dst, &bounds);

Index: glitz_stencil.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_stencil.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_stencil.c	9 Aug 2004 22:57:35 -0000	1.2
--- glitz_stencil.c	18 Aug 2004 12:30:24 -0000	1.3
***************
*** 32,37 ****
  
  void
! glitz_stencil_rectangles (glitz_surface_t *dst,
!                           glitz_stencil_operator_t op,
                            const glitz_rectangle_t *rects,
                            int n_rects)
--- 32,39 ----
  
  void
! glitz_stencil_rectangles (glitz_stencil_operator_t op,
!                           glitz_surface_t *dst,
!                           int x_offset,
!                           int y_offset,
                            const glitz_rectangle_t *rects,
                            int n_rects)
***************
*** 80,83 ****
--- 82,87 ----
    glitz_int_fill_rectangles (rect_op,
                               dst,
+                              x_offset,
+                              y_offset,
                               &color,
                               rects,
***************
*** 94,98 ****
                                  *dst->stencil_mask);
      glitz_int_fill_rectangles (GLITZ_INT_OPERATOR_STENCIL_RECT_SRC,
!                                dst, &color, &rect, 1);
    } else if (op == GLITZ_STENCIL_OPERATOR_INCR_EQUAL)
      *dst->stencil_mask |= 0x1;
--- 98,102 ----
                                  *dst->stencil_mask);
      glitz_int_fill_rectangles (GLITZ_INT_OPERATOR_STENCIL_RECT_SRC,
!                                dst, 0, 0, &color, &rect, 1);
    } else if (op == GLITZ_STENCIL_OPERATOR_INCR_EQUAL)
      *dst->stencil_mask |= 0x1;
***************
*** 106,113 ****
  
  void
! glitz_stencil_trapezoids (glitz_surface_t *dst,
!                        glitz_stencil_operator_t op,
!                        const glitz_trapezoid_t *traps,
!                        int n_traps)
  {
    static glitz_color_t color = { 0x0000, 0x0000, 0x0000, 0x0000 };
--- 110,119 ----
  
  void
! glitz_stencil_trapezoids (glitz_stencil_operator_t op,
!                           glitz_surface_t *dst,
!                           int x_offset,
!                           int y_offset,
!                           const glitz_trapezoid_t *traps,
!                           int n_traps)
  {
    static glitz_color_t color = { 0x0000, 0x0000, 0x0000, 0x0000 };
***************
*** 147,151 ****
    glitz_int_fill_trapezoids (GLITZ_OPERATOR_SRC,
                               dst,
!                              0, 0,
                               &color,
                               traps,
--- 153,157 ----
    glitz_int_fill_trapezoids (GLITZ_OPERATOR_SRC,
                               dst,
!                              x_offset, y_offset,
                               &color,
                               traps,
***************
*** 162,166 ****
                                  *dst->stencil_mask);
      glitz_int_fill_rectangles (GLITZ_INT_OPERATOR_STENCIL_RECT_SRC,
!                                dst, &color, &rect, 1);
    } else if (op == GLITZ_STENCIL_OPERATOR_INCR_EQUAL)
      *dst->stencil_mask |= 0x1;
--- 168,172 ----
                                  *dst->stencil_mask);
      glitz_int_fill_rectangles (GLITZ_INT_OPERATOR_STENCIL_RECT_SRC,
!                                dst, 0, 0, &color, &rect, 1);
    } else if (op == GLITZ_STENCIL_OPERATOR_INCR_EQUAL)
      *dst->stencil_mask |= 0x1;
***************
*** 174,179 ****
  
  void
! glitz_stencil_triangles (glitz_surface_t *dst,
!                          glitz_stencil_operator_t op,
                           glitz_triangle_type_t type,
                           const glitz_point_fixed_t *points,
--- 180,187 ----
  
  void
! glitz_stencil_triangles (glitz_stencil_operator_t op,
!                          glitz_surface_t *dst,
!                          int x_offset,
!                          int y_offset,
                           glitz_triangle_type_t type,
                           const glitz_point_fixed_t *points,
***************
*** 217,221 ****
                              dst,
                              type,
!                             0, 0,
                              &color,                        
                              points,
--- 225,229 ----
                              dst,
                              type,
!                             x_offset, y_offset,
                              &color,                        
                              points,
***************
*** 232,236 ****
                                  *dst->stencil_mask);
      glitz_int_fill_rectangles (GLITZ_INT_OPERATOR_STENCIL_RECT_SRC,
!                                dst, &color, &rect, 1);
    } else if (op == GLITZ_STENCIL_OPERATOR_INCR_EQUAL)
      *dst->stencil_mask |= 0x1;
--- 240,244 ----
                                  *dst->stencil_mask);
      glitz_int_fill_rectangles (GLITZ_INT_OPERATOR_STENCIL_RECT_SRC,
!                                dst, 0, 0, &color, &rect, 1);
    } else if (op == GLITZ_STENCIL_OPERATOR_INCR_EQUAL)
      *dst->stencil_mask |= 0x1;

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** glitz_surface.c	9 Aug 2004 22:57:35 -0000	1.17
--- glitz_surface.c	18 Aug 2004 12:30:24 -0000	1.18
***************
*** 65,68 ****
--- 65,69 ----
    surface->stencil_mask = surface->stencil_masks;
    surface->update_mask = GLITZ_UPDATE_ALL_MASK;
+   surface->hint_mask |= GLITZ_INT_HINT_CLIP_MASK;
  
    if (format->doublebuffer)
***************
*** 97,101 ****
  
    if (surface->filter_params)
!     free (surface->filter_params);
  }
  
--- 98,102 ----
  
    if (surface->filter_params)
!     glitz_filter_params_destroy (surface->filter_params);
  }
  
***************
*** 135,139 ****
      surface->polyedge = templ->polyedge;
      surface->polyedge_smooth_hint = templ->polyedge_smooth_hint;
-     surface->polyopacity = templ->polyopacity;
    }
    
--- 136,139 ----
***************
*** 287,294 ****
      surface->transform->m[15] = FIXED_TO_DOUBLE (transform->matrix[2][2]);
  
!     /* FIXME: projective transformation matrix conversion to normalized
!        texture coordinates is incorrect. */
      memcpy (surface->transform->m_norm, surface->transform->m,
              16 * sizeof (double));
      surface->transform->m_norm[12] =
        (surface->texture.texcoord_width / surface->width) *
--- 287,297 ----
      surface->transform->m[15] = FIXED_TO_DOUBLE (transform->matrix[2][2]);
  
!     /* XXX: Projective transformation matrix conversion to normalized
!        texture coordinates seems to be working fine. However, it would be
!        good if someone could verify that this is actually a correct way for
!        doing this. */
      memcpy (surface->transform->m_norm, surface->transform->m,
              16 * sizeof (double));
+     
      surface->transform->m_norm[12] =
        (surface->texture.texcoord_width / surface->width) *
***************
*** 297,302 ****
        (surface->texture.texcoord_height / surface->height) *
        surface->transform->m[13];
! 
!     surface->transform->inverted = 0;
    } else {
      if (surface->transform)
--- 300,309 ----
        (surface->texture.texcoord_height / surface->height) *
        surface->transform->m[13];
!     
!     surface->transform->m_norm[3] /=
!       (surface->texture.texcoord_width / surface->width);
!     surface->transform->m_norm[7] /=
!       (surface->texture.texcoord_height / surface->height);
!     
    } else {
      if (surface->transform)
***************
*** 308,336 ****
  slim_hidden_def(glitz_surface_set_transform);
  
- glitz_matrix_t *
- glitz_surface_get_affine_transform (glitz_surface_t *surface)
- {
-   if (surface->transform == NULL)
-     return NULL;
-     
-   if (surface->transform->inverted == 0) {
-     surface->transform->affine.m[0][0] = surface->transform->m[0];
-     surface->transform->affine.m[1][0] = surface->transform->m[4];
-     surface->transform->affine.m[2][0] = surface->transform->m[12];
- 
-     surface->transform->affine.m[0][1] = surface->transform->m[1];
-     surface->transform->affine.m[1][1] = surface->transform->m[5];
-     surface->transform->affine.m[2][1] = surface->transform->m[13];
-   
-     if (glitz_matrix_invert (&surface->transform->affine)) {
-       glitz_surface_status_add (surface, GLITZ_STATUS_INVALID_MATRIX_MASK);
-       return NULL;
-     }
-     surface->transform->inverted = 1;
-   }
-   
-   return &surface->transform->affine;
- }
- 
  void
  glitz_surface_set_fill (glitz_surface_t *surface,
--- 315,318 ----
***************
*** 338,345 ****
--- 320,334 ----
  {
    switch (fill) {
+   case GLITZ_FILL_CLIP:
+     surface->hint_mask |= GLITZ_INT_HINT_CLIP_MASK;
+     surface->hint_mask &= ~GLITZ_INT_HINT_PAD_MASK;
+     surface->hint_mask &= ~GLITZ_INT_HINT_REPEAT_MASK;
+     surface->hint_mask &= ~GLITZ_INT_HINT_MIRRORED_MASK;
+     break;
    case GLITZ_FILL_TRANSPARENT:
      surface->hint_mask &= ~GLITZ_INT_HINT_REPEAT_MASK;
      surface->hint_mask &= ~GLITZ_INT_HINT_MIRRORED_MASK;
      surface->hint_mask &= ~GLITZ_INT_HINT_PAD_MASK;
+     surface->hint_mask &= ~GLITZ_INT_HINT_CLIP_MASK;
      break;
    case GLITZ_FILL_NEAREST:
***************
*** 347,350 ****
--- 336,340 ----
      surface->hint_mask &= ~GLITZ_INT_HINT_MIRRORED_MASK;
      surface->hint_mask |= GLITZ_INT_HINT_PAD_MASK;
+     surface->hint_mask &= ~GLITZ_INT_HINT_CLIP_MASK;
      break;
    case GLITZ_FILL_REPEAT:
***************
*** 352,355 ****
--- 342,346 ----
      surface->hint_mask &= ~GLITZ_INT_HINT_MIRRORED_MASK;
      surface->hint_mask &= ~GLITZ_INT_HINT_PAD_MASK;
+     surface->hint_mask &= ~GLITZ_INT_HINT_CLIP_MASK;
      break;
    case GLITZ_FILL_REFLECT:
***************
*** 357,362 ****
--- 348,356 ----
      surface->hint_mask |= GLITZ_INT_HINT_MIRRORED_MASK;
      surface->hint_mask &= ~GLITZ_INT_HINT_PAD_MASK;
+     surface->hint_mask &= ~GLITZ_INT_HINT_CLIP_MASK;
      break;
    }
+ 
+   glitz_filter_set_type (surface, surface->filter);
  }
  slim_hidden_def(glitz_surface_set_fill);
***************
*** 375,389 ****
  
  void
- glitz_surface_set_correctness_hint (glitz_surface_t *surface,
-                                     glitz_correctness_hint_t hint)
- {
-   if (hint == GLITZ_CORRECTNESS_HINT_QUALITY)
-     surface->hint_mask |= GLITZ_INT_HINT_QUALITY_CORRECTNESS_MASK;
-   else
-     surface->hint_mask &= ~GLITZ_INT_HINT_QUALITY_CORRECTNESS_MASK;
- }
- slim_hidden_def(glitz_surface_set_correctness_hint);
- 
- void
  glitz_surface_set_filter (glitz_surface_t *surface,
                            glitz_filter_t filter,
--- 369,372 ----
***************
*** 393,398 ****
    glitz_status_t status;
    
!   status = glitz_filter_set_params (&surface->filter_params, filter,
!                                     params, n_params);
    if (status) {
      glitz_surface_status_add (surface, glitz_status_to_status_mask (status));
--- 376,380 ----
    glitz_status_t status;
    
!   status = glitz_filter_set_params (surface, filter, params, n_params);
    if (status) {
      glitz_surface_status_add (surface, glitz_status_to_status_mask (status));
***************
*** 401,426 ****
      case GLITZ_FILTER_NEAREST:
        surface->hint_mask &= ~GLITZ_INT_HINT_FRAGMENT_FILTER_MASK;
!       surface->hint_mask &= ~GLITZ_INT_HINT_LINEAR_TRANSFORM_MASK;
!       surface->hint_mask &= ~GLITZ_INT_HINT_LINEAR_NON_TRANSFORM_MASK;
        surface->hint_mask &= ~GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK;
        break;
      case GLITZ_FILTER_BILINEAR:
        surface->hint_mask &= ~GLITZ_INT_HINT_FRAGMENT_FILTER_MASK;
!       surface->hint_mask |= GLITZ_INT_HINT_LINEAR_TRANSFORM_MASK;
!       surface->hint_mask &= ~GLITZ_INT_HINT_LINEAR_NON_TRANSFORM_MASK;
        surface->hint_mask &= ~GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK;
        break;
      case GLITZ_FILTER_CONVOLUTION:
        surface->hint_mask |= GLITZ_INT_HINT_FRAGMENT_FILTER_MASK;
!       surface->hint_mask |= GLITZ_INT_HINT_LINEAR_TRANSFORM_MASK;
!       surface->hint_mask &= ~GLITZ_INT_HINT_LINEAR_NON_TRANSFORM_MASK;
        surface->hint_mask &= ~GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK;
        break;
      case GLITZ_FILTER_LINEAR_GRADIENT:
      case GLITZ_FILTER_RADIAL_GRADIENT:
        surface->hint_mask |= GLITZ_INT_HINT_FRAGMENT_FILTER_MASK;
!       surface->hint_mask |= GLITZ_INT_HINT_LINEAR_TRANSFORM_MASK;
!       surface->hint_mask |= GLITZ_INT_HINT_LINEAR_NON_TRANSFORM_MASK;
        surface->hint_mask |= GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK;
        break;
      }
--- 383,409 ----
      case GLITZ_FILTER_NEAREST:
        surface->hint_mask &= ~GLITZ_INT_HINT_FRAGMENT_FILTER_MASK;
!       surface->hint_mask &= ~GLITZ_INT_HINT_LINEAR_TRANSFORM_FILTER_MASK;
        surface->hint_mask &= ~GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK;
+       surface->hint_mask &= ~GLITZ_INT_HINT_IGNORE_REPEAT_MASK;
        break;
      case GLITZ_FILTER_BILINEAR:
        surface->hint_mask &= ~GLITZ_INT_HINT_FRAGMENT_FILTER_MASK;
!       surface->hint_mask |= GLITZ_INT_HINT_LINEAR_TRANSFORM_FILTER_MASK;
        surface->hint_mask &= ~GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK;
+       surface->hint_mask &= ~GLITZ_INT_HINT_IGNORE_REPEAT_MASK;
        break;
      case GLITZ_FILTER_CONVOLUTION:
+     case GLITZ_FILTER_GAUSSIAN:
        surface->hint_mask |= GLITZ_INT_HINT_FRAGMENT_FILTER_MASK;
!       surface->hint_mask |= GLITZ_INT_HINT_LINEAR_TRANSFORM_FILTER_MASK;
        surface->hint_mask &= ~GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK;
+       surface->hint_mask &= ~GLITZ_INT_HINT_IGNORE_REPEAT_MASK;
        break;
      case GLITZ_FILTER_LINEAR_GRADIENT:
      case GLITZ_FILTER_RADIAL_GRADIENT:
        surface->hint_mask |= GLITZ_INT_HINT_FRAGMENT_FILTER_MASK;
!       surface->hint_mask &= ~GLITZ_INT_HINT_LINEAR_TRANSFORM_FILTER_MASK;
        surface->hint_mask |= GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK;
+       surface->hint_mask |= GLITZ_INT_HINT_IGNORE_REPEAT_MASK;
        break;
      }
***************
*** 438,449 ****
  slim_hidden_def(glitz_surface_set_polyedge);
  
- void
- glitz_surface_set_polyopacity (glitz_surface_t *surface,
-                                unsigned short polyopacity)
- {
-   surface->polyopacity = polyopacity;
- }
- slim_hidden_def(glitz_surface_set_polyopacity);
- 
  int
  glitz_surface_get_width (glitz_surface_t *surface)
--- 421,424 ----
***************
*** 629,632 ****
--- 604,613 ----
      surface->update_mask &= ~GLITZ_UPDATE_VIEWPORT_MASK;
    }
+ 
+   if (surface->update_mask & GLITZ_UPDATE_SCISSOR_MASK) {
+     gl->disable (GLITZ_GL_SCISSOR_TEST);
+     
+     surface->update_mask &= ~GLITZ_UPDATE_SCISSOR_MASK;
+   }
    
    if (surface->update_mask & GLITZ_UPDATE_SCISSOR_MASK) {
***************
*** 791,795 ****
    glitz_texture_bind (surface->gl, texture);
  
!   if (SURFACE_LINEAR_TRANSFORM (surface))
      glitz_texture_ensure_filter (surface->gl, texture, GLITZ_GL_LINEAR);
    else
--- 772,776 ----
    glitz_texture_bind (surface->gl, texture);
  
!   if (SURFACE_LINEAR_TRANSFORM_FILTER (surface))
      glitz_texture_ensure_filter (surface->gl, texture, GLITZ_GL_LINEAR);
    else
***************
*** 846,855 ****
  glitz_surface_clip_rectangles (glitz_surface_t *surface,
                                 glitz_clip_operator_t op,
                                 const glitz_rectangle_t *rects,
                                 int n_rects)
  {
    if ((op == GLITZ_CLIP_OPERATOR_SET ||op == GLITZ_CLIP_OPERATOR_UNION) &&
!       n_rects == 1 && rects->x <= 0 && rects->y <= 0 &&
!       rects->width >= surface->width && rects->height >= surface->height) {
      *surface->stencil_mask = 0x0;
      surface->update_mask |= GLITZ_UPDATE_STENCIL_OP_MASK;
--- 827,841 ----
  glitz_surface_clip_rectangles (glitz_surface_t *surface,
                                 glitz_clip_operator_t op,
+                                int x_offset,
+                                int y_offset,
                                 const glitz_rectangle_t *rects,
                                 int n_rects)
  {
    if ((op == GLITZ_CLIP_OPERATOR_SET ||op == GLITZ_CLIP_OPERATOR_UNION) &&
!       n_rects == 1 &&
!       (rects->x + x_offset) <= 0 &&
!       (rects->y + y_offset) <= 0 &&
!       (rects->width + x_offset) >= surface->width &&
!       (rects->height + y_offset) >= surface->height) {
      *surface->stencil_mask = 0x0;
      surface->update_mask |= GLITZ_UPDATE_STENCIL_OP_MASK;
***************
*** 862,871 ****
      rect.height = surface->height;
      
!     glitz_stencil_rectangles (surface,
!                               GLITZ_STENCIL_OPERATOR_CLEAR,
                                &rect, 1);
    }
    
!   glitz_stencil_rectangles (surface, (glitz_stencil_operator_t) op,
                              rects, n_rects);
  }
--- 848,860 ----
      rect.height = surface->height;
      
!     glitz_stencil_rectangles (GLITZ_STENCIL_OPERATOR_CLEAR,
!                               surface,
!                               0, 0,
                                &rect, 1);
    }
    
!   glitz_stencil_rectangles ((glitz_stencil_operator_t) op,
!                             surface,
!                             x_offset, y_offset,
                              rects, n_rects);
  }
***************
*** 875,878 ****
--- 864,869 ----
  glitz_surface_clip_trapezoids (glitz_surface_t *surface,
                                 glitz_clip_operator_t op,
+                                int x_offset,
+                                int y_offset,
                                 const glitz_trapezoid_t *traps,
                                 int n_traps)
***************
*** 885,894 ****
      rect.height = surface->height;
      
!     glitz_stencil_rectangles (surface,
!                               GLITZ_STENCIL_OPERATOR_CLEAR,
!                               &rect, 1);
    }
    
!   glitz_stencil_trapezoids (surface, (glitz_stencil_operator_t) op,
                              traps, n_traps);
  }
--- 876,886 ----
      rect.height = surface->height;
      
!     glitz_stencil_rectangles (GLITZ_STENCIL_OPERATOR_CLEAR,
!                               surface, 0, 0, &rect, 1);
    }
    
!   glitz_stencil_trapezoids ((glitz_stencil_operator_t) op,
!                             surface,
!                             x_offset, y_offset,
                              traps, n_traps);
  }
***************
*** 898,901 ****
--- 890,895 ----
  glitz_surface_clip_triangles (glitz_surface_t *surface,
                                glitz_clip_operator_t op,
+                               int x_offset,
+                               int y_offset,
                                const glitz_triangle_t *tris,
                                int n_tris)
***************
*** 908,917 ****
      rect.height = surface->height;
      
!     glitz_stencil_rectangles (surface,
!                               GLITZ_STENCIL_OPERATOR_CLEAR,
!                               &rect, 1);
    }
    
!   glitz_stencil_triangles (surface, (glitz_stencil_operator_t) op,
                             GLITZ_TRIANGLE_TYPE_NORMAL,
                             (glitz_point_fixed_t *) tris, n_tris * 3);
--- 902,912 ----
      rect.height = surface->height;
      
!     glitz_stencil_rectangles (GLITZ_STENCIL_OPERATOR_CLEAR,
!                               surface, 0, 0, &rect, 1);
    }
    
!   glitz_stencil_triangles ((glitz_stencil_operator_t) op,
!                            surface,
!                            x_offset, y_offset,
                             GLITZ_TRIANGLE_TYPE_NORMAL,
                             (glitz_point_fixed_t *) tris, n_tris * 3);

Index: glitz_trap.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_trap.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_trap.c	9 Aug 2004 22:57:35 -0000	1.7
--- glitz_trap.c	18 Aug 2004 12:30:24 -0000	1.8
***************
*** 33,97 ****
  
  /* whether 't' is a well defined not obviously empty trapezoid */
! #define TRAPEZOID_VALID(t) ((t)->left.p1.y != (t)->left.p2.y && \
! 			     (t)->right.p1.y != (t)->right.p2.y && \
! 			     (int) ((t)->bottom - (t)->top) > 0)
! 
! /* whether 't' is a well defined not obviously empty color trapezoid */
! #define COLORTRAPEZOID_VALID(t) ((t)->top.left <= (t)->top.right && \
  			     (t)->bottom.left <= (t)->bottom.right && \
  			     (int) ((t)->bottom.y - (t)->top.y) >= 0)
  
- static glitz_fixed16_16_t
- glitz_line_fixed_x (const glitz_line_fixed_t *l,
-                     glitz_fixed16_16_t y,
-                     int ceil)
- {
-   glitz_fixed_32_32 ex = (glitz_fixed_32_32) (y - l->p1.y) *
-     (l->p2.x - l->p1.x);
-   glitz_fixed16_16_t dy = l->p2.y - l->p1.y;
-   
-   if (ceil)
-     ex += (dy - 1);
-   
-   return l->p1.x + (glitz_fixed16_16_t) (ex / dy);
- }
- 
  static void
! glitz_trapezoid_bounds (int n_traps,
                          const glitz_trapezoid_t *traps,
                          glitz_bounding_box_t *box)
  {
-   box->y1 = MAXSHORT;
-   box->y2 = MINSHORT;
    box->x1 = MAXSHORT;
    box->x2 = MINSHORT;
    
    for (; n_traps; n_traps--, traps++) {
!     int16_t x1, y1, x2, y2;
!     
      if (!TRAPEZOID_VALID (traps))
        continue;
      
!     y1 = FIXED_TO_INT (traps->top);
!     if (y1 < box->y1)
!       box->y1 = y1;
! 
!     y2 = FIXED_TO_INT (FIXED_CEIL (traps->bottom));
!     if (y2 > box->y2)
!       box->y2 = y2;
! 
!     x1 = FIXED_TO_INT (MIN (glitz_line_fixed_x (&traps->left, traps->top, 0),
!                             glitz_line_fixed_x (&traps->left,
!                                                 traps->bottom, 0)));
      if (x1 < box->x1)
        box->x1 = x1;
! 
!     x2 = FIXED_TO_INT (FIXED_CEIL
!                        (MAX (glitz_line_fixed_x (&traps->right, traps->top, 1),
!                              glitz_line_fixed_x (&traps->right,
!                                                  traps->bottom, 1))));
      if (x2 > box->x2)
        box->x2 = x2;
    }
  }
  
--- 33,81 ----
  
  /* whether 't' is a well defined not obviously empty trapezoid */
! #define TRAPEZOID_VALID(t) ((t)->top.left <= (t)->top.right && \
  			     (t)->bottom.left <= (t)->bottom.right && \
  			     (int) ((t)->bottom.y - (t)->top.y) >= 0)
  
  static void
! glitz_trapezoid_bounds (int x_offset,
!                         int y_offset,
!                         int n_traps,
                          const glitz_trapezoid_t *traps,
                          glitz_bounding_box_t *box)
  {
    box->x1 = MAXSHORT;
    box->x2 = MINSHORT;
+   box->y1 = MAXSHORT;
+   box->y2 = MINSHORT;
    
    for (; n_traps; n_traps--, traps++) {
!     int x1, y1, x2, y2;
! 
      if (!TRAPEZOID_VALID (traps))
        continue;
      
!     x1 = MIN (FIXED_TO_INT (traps->top.left),
!               FIXED_TO_INT (traps->bottom.left));
      if (x1 < box->x1)
        box->x1 = x1;
!     
!     x2 = MAX (FIXED_TO_INT (FIXED_CEIL (traps->top.right)),
!               FIXED_TO_INT (FIXED_CEIL (traps->bottom.right)));
      if (x2 > box->x2)
        box->x2 = x2;
+     
+     y1 = FIXED_TO_INT (traps->top.y);
+     if (y1 < box->y1)
+       box->y1 = y1;
+     
+     y2 = FIXED_TO_INT (FIXED_CEIL (traps->bottom.y));
+     if (y2 > box->y2)
+       box->y2 = y2;
    }
+ 
+   box->x1 += x_offset;
+   box->x2 += x_offset;
+   box->y1 += y_offset;
+   box->y2 += y_offset;
  }
  
***************
*** 106,110 ****
  {
    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);
--- 90,96 ----
  {
    glitz_gl_vertex_2d_t vertex_2d;
!   static glitz_sample_offset_t zero_offset = { 0.0, 0.0 };
!   glitz_sample_offset_t *offset;
!   int i, passes;
  
    dst->gl->color_4us (color->red, color->green, color->blue, color->alpha);
***************
*** 113,165 ****
  
    if (dst->multi_sample) {
!     list = dst->gl->gen_lists (1);
!     dst->gl->new_list (list, GLITZ_GL_COMPILE);
    }
-     
-   dst->gl->begin (GLITZ_GL_QUADS);
  
    vertex_2d = dst->gl->vertex_2d;
    for (; n_traps; n_traps--, traps++) {
!     double top, bottom;
!     
!     if (!TRAPEZOID_VALID (traps))
!       continue;
      
!     top = y_offset + FIXED_TO_DOUBLE (traps->top);
!     bottom = y_offset + FIXED_TO_DOUBLE (traps->bottom);
  
!     vertex_2d (x_offset +
!                FIXED_TO_DOUBLE (glitz_line_fixed_x
!                                 (&traps->left, traps->top, 0)), top);
!     vertex_2d (x_offset +
!                FIXED_TO_DOUBLE (glitz_line_fixed_x
!                                 (&traps->right, traps->top, 1)), top);
!     vertex_2d (x_offset +
!                FIXED_TO_DOUBLE (glitz_line_fixed_x
!                                 (&traps->right, traps->bottom, 1)), bottom);
!     vertex_2d (x_offset +
!                FIXED_TO_DOUBLE (glitz_line_fixed_x
!                                 (&traps->left, traps->bottom, 0)), bottom);
    }
  
    dst->gl->end ();
- 
-   if (list) {
-     int i;
-     
-     dst->gl->end_list ();
-     
-     dst->gl->matrix_mode (GLITZ_GL_MODELVIEW);
- 
-     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);
-   }
  }
  
--- 99,136 ----
  
    if (dst->multi_sample) {
!     passes = dst->multi_sample->n_samples;
!     offset = dst->multi_sample->offsets;
!   } else {
!     passes = 1;
!     offset = &zero_offset;
    }
  
    vertex_2d = dst->gl->vertex_2d;
+   
+   dst->gl->begin (GLITZ_GL_QUADS);
+ 
    for (; n_traps; n_traps--, traps++) {
!     double top, topleft, topright;
!     double bottom, bottomleft, bottomright;
      
!       if (!TRAPEZOID_VALID (traps))
!         continue;
  
!       top = y_offset + FIXED_TO_DOUBLE (traps->top.y);
!       bottom = y_offset + FIXED_TO_DOUBLE (traps->bottom.y);
!       bottomleft = x_offset + FIXED_TO_DOUBLE (traps->bottom.left);
!       topleft = x_offset + FIXED_TO_DOUBLE (traps->top.left);
!       topright = x_offset + FIXED_TO_DOUBLE (traps->top.right);
!       bottomright = x_offset + FIXED_TO_DOUBLE (traps->bottom.right);
!       
!       for (i = 0; i < passes; i++) {
!         vertex_2d (offset[i].x + bottomleft, offset[i].y + bottom);
!         vertex_2d (offset[i].x + topleft, offset[i].y + top);
!         vertex_2d (offset[i].x + topright, offset[i].y + top);
!         vertex_2d (offset[i].x + bottomright, offset[i].y + bottom);
!     }
    }
  
    dst->gl->end ();
  }
  
***************
*** 167,170 ****
--- 138,143 ----
  glitz_fill_trapezoids (glitz_operator_t op,
                         glitz_surface_t *dst,
+                        int x_offset,
+                        int y_offset,
                         const glitz_color_t *color,
                         const glitz_trapezoid_t *traps,
***************
*** 173,177 ****
    glitz_bounding_box_t bounds;
    
!   glitz_trapezoid_bounds (n_traps, traps, &bounds);
    if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
--- 146,150 ----
    glitz_bounding_box_t bounds;
    
!   glitz_trapezoid_bounds (x_offset, y_offset, n_traps, traps, &bounds);
    if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
***************
*** 184,188 ****
    }
    
!   glitz_int_fill_trapezoids (op, dst, 0, 0, color, traps, n_traps);
  
    glitz_surface_dirty (dst, &bounds);
--- 157,163 ----
    }
    
!   glitz_int_fill_trapezoids (op, dst,
!                              x_offset, y_offset,
!                              color, traps, n_traps);
  
    glitz_surface_dirty (dst, &bounds);
***************
*** 192,195 ****
--- 167,210 ----
  
  void
+ glitz_add_trapezoids (glitz_surface_t *dst,
+                       int x_offset,
+                       int y_offset,
+                       const glitz_trapezoid_t *traps,
+                       int n_traps)
+ {
+   glitz_bounding_box_t bounds;
+   glitz_color_t color;
+   
+   glitz_trapezoid_bounds (x_offset, y_offset, n_traps, traps, &bounds);
+   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
+       bounds.x2 < 0 || bounds.y2 < 0)
+     return;
+ 
+   glitz_surface_enable_anti_aliasing (dst);
+ 
+   if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
+     glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
+     glitz_surface_pop_current (dst);
+     return;
+   }
+ 
+   if (dst->multi_sample)
+     color.red = color.green = color.blue = color.alpha =
+       0xffff / dst->multi_sample->n_samples;
+   else
+     color.red = color.green = color.blue = color.alpha = 0xffff;
+   
+   glitz_int_fill_trapezoids (GLITZ_OPERATOR_ADD, dst,
+                              x_offset, y_offset,
+                              &color, traps, n_traps);
+ 
+   glitz_surface_disable_anti_aliasing (dst);
+ 
+   glitz_surface_dirty (dst, &bounds);
+   glitz_surface_pop_current (dst);
+ }
+ slim_hidden_def(glitz_add_trapezoids);
+ 
+ void
  glitz_composite_trapezoids (glitz_operator_t op,
                              glitz_surface_t *src,
***************
*** 197,205 ****
                              int x_src,
                              int y_src,
                              const glitz_trapezoid_t *traps,
                              int n_traps)
  {
!   glitz_bounding_box_t trap_bounds;
!   int x_dst, y_dst;
    glitz_rectangle_t rect;
  
--- 212,222 ----
                              int x_src,
                              int y_src,
+                             int x_offset,
+                             int y_offset,
+                             unsigned short opacity,
                              const glitz_trapezoid_t *traps,
                              int n_traps)
  {
!   glitz_bounding_box_t bounds;
    glitz_rectangle_t rect;
  
***************
*** 207,213 ****
      return;
  
-   x_dst = traps[0].left.p1.x >> 16;
-   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);
--- 224,227 ----
***************
*** 215,239 ****
    }
  
!   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;
  
!   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;
  
    glitz_surface_enable_anti_aliasing (dst);
  
    if (*dst->stencil_mask == 0x0)
!     glitz_stencil_rectangles (dst,
!                               GLITZ_STENCIL_OPERATOR_CLEAR,
!                               &rect, 1);
    
!   glitz_stencil_trapezoids (dst,
!                             GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
                              traps, n_traps);
!   
    dst->hint_mask |= GLITZ_INT_HINT_POLYGON_OP_MASK;
  
--- 229,254 ----
    }
  
!   glitz_trapezoid_bounds (x_offset, y_offset, n_traps, traps, &bounds);
!   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
!       bounds.x2 < 0 || bounds.y2 < 0)
      return;
  
!   rect.x = bounds.x1;
!   rect.y = bounds.y1;
!   rect.width = bounds.x2 - bounds.x1;
!   rect.height = bounds.y2 - bounds.y1;
  
    glitz_surface_enable_anti_aliasing (dst);
  
    if (*dst->stencil_mask == 0x0)
!     glitz_stencil_rectangles (GLITZ_STENCIL_OPERATOR_CLEAR,
!                               dst, 0, 0, &rect, 1);
    
!   glitz_stencil_trapezoids (GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
!                             dst,
!                             x_offset, y_offset,
                              traps, n_traps);
! 
!   dst->polyopacity = opacity;
    dst->hint_mask |= GLITZ_INT_HINT_POLYGON_OP_MASK;
  
***************
*** 242,247 ****
                     NULL,
                     dst,
!                    x_src + trap_bounds.x1 - x_dst,
!                    y_src + trap_bounds.y1 - y_dst,
                     0, 0,
                     rect.x, rect.y,
--- 257,262 ----
                     NULL,
                     dst,
!                    x_src + bounds.x1,
!                    y_src + bounds.y1,
                     0, 0,
                     rect.x, rect.y,
***************
*** 253,259 ****
    
    if (*dst->stencil_mask != 0x1)
!     glitz_stencil_rectangles (dst,
!                               GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                               &rect, 1);
    else
      *dst->stencil_mask = 0x0;
--- 268,273 ----
    
    if (*dst->stencil_mask != 0x1)
!     glitz_stencil_rectangles (GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                               dst, 0, 0, &rect, 1);
    else
      *dst->stencil_mask = 0x0;
***************
*** 264,280 ****
  
  static void
! glitz_color_trapezoid_bounds (int n_color_traps,
                                const glitz_color_trapezoid_t *color_traps,
                                glitz_bounding_box_t *box)
  {
-   box->y1 = MAXSHORT;
-   box->y2 = MINSHORT;
    box->x1 = MAXSHORT;
    box->x2 = MINSHORT;
    
    for (; n_color_traps; n_color_traps--, color_traps++) {
!     int16_t x1, y1, x2, y2;
  
!     if (!COLORTRAPEZOID_VALID (color_traps))
        continue;
      
--- 278,296 ----
  
  static void
! glitz_color_trapezoid_bounds (int x_offset,
!                               int y_offset,
!                               int n_color_traps,
                                const glitz_color_trapezoid_t *color_traps,
                                glitz_bounding_box_t *box)
  {
    box->x1 = MAXSHORT;
    box->x2 = MINSHORT;
+   box->y1 = MAXSHORT;
+   box->y2 = MINSHORT;
    
    for (; n_color_traps; n_color_traps--, color_traps++) {
!     int x1, y1, x2, y2;
  
!     if (!TRAPEZOID_VALID (color_traps))
        continue;
      
***************
*** 297,300 ****
--- 313,321 ----
        box->y2 = y2;
    }
+ 
+   box->x1 += x_offset;
+   box->x2 += x_offset;
+   box->y1 += y_offset;
+   box->y2 += y_offset;
  }
  
***************
*** 302,305 ****
--- 323,328 ----
  glitz_color_trapezoids (glitz_operator_t op,
                          glitz_surface_t *dst,
+                         int x_offset,
+                         int y_offset,
                          const glitz_color_trapezoid_t *color_traps,
                          int n_color_traps)
***************
*** 308,317 ****
    glitz_gl_color_4us_t color_4us;
    glitz_bounding_box_t bounds;
-   int index;
-   glitz_bool_t shade = 0;
    
!   glitz_color_trapezoid_bounds (n_color_traps, color_traps, &bounds);
!   if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2 ||
!       bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
      return;
--- 331,338 ----
    glitz_gl_color_4us_t color_4us;
    glitz_bounding_box_t bounds;
    
!   glitz_color_trapezoid_bounds (x_offset, y_offset,
!                                 n_color_traps, color_traps, &bounds);
!   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
      return;
***************
*** 325,347 ****
    glitz_set_operator (dst->gl, op);
  
!   for (index = 0; index < n_color_traps; index++) {
!     
!     if (!COLORTRAPEZOID_VALID (&color_traps[index]))
!       continue;
!     
!     if (memcmp (&color_traps[index].top.right_color,
!                 &color_traps[index].top.left_color,
!                 sizeof (glitz_color_t)) ||
!         memcmp (&color_traps[index].bottom.right_color,
!                 &color_traps[index].bottom.left_color,
!                 sizeof (glitz_color_t)) ||
!         memcmp (&color_traps[index].top.left_color,
!                 &color_traps[index].bottom.left_color,
!                 sizeof (glitz_color_t))) {
!       dst->gl->shade_model (GLITZ_GL_SMOOTH);
!       shade = 1;
!       break;
!     }
!   }
    
    dst->gl->begin (GLITZ_GL_QUADS);
--- 346,350 ----
    glitz_set_operator (dst->gl, op);
  
!   dst->gl->shade_model (GLITZ_GL_SMOOTH);
    
    dst->gl->begin (GLITZ_GL_QUADS);
***************
*** 351,355 ****
    for (; n_color_traps; n_color_traps--, color_traps++) {
      
!     if (!COLORTRAPEZOID_VALID (color_traps))
        continue;
  
--- 354,358 ----
    for (; n_color_traps; n_color_traps--, color_traps++) {
      
!     if (!TRAPEZOID_VALID (color_traps))
        continue;
  
***************
*** 358,391 ****
                 color_traps->bottom.left_color.blue,
                 color_traps->bottom.left_color.alpha);
!     vertex_2d (FIXED_TO_DOUBLE (color_traps->bottom.left),
!                FIXED_TO_DOUBLE (color_traps->bottom.y));
  
!     if (shade)
!       color_4us (color_traps->top.left_color.red,
!                  color_traps->top.left_color.green,
!                  color_traps->top.left_color.blue,
!                  color_traps->top.left_color.alpha);
!     vertex_2d (FIXED_TO_DOUBLE (color_traps->top.left),
!                FIXED_TO_DOUBLE (color_traps->top.y));
  
!     if (shade)
!       color_4us (color_traps->top.right_color.red,
!                  color_traps->top.right_color.green,
!                  color_traps->top.right_color.blue,
!                  color_traps->top.right_color.alpha);
!     vertex_2d (FIXED_TO_DOUBLE (color_traps->top.right),
!                FIXED_TO_DOUBLE (color_traps->top.y));
  
!     if (shade)
!       color_4us (color_traps->bottom.right_color.red,
!                  color_traps->bottom.right_color.green,
!                  color_traps->bottom.right_color.blue,
!                  color_traps->bottom.right_color.alpha);
!     vertex_2d (FIXED_TO_DOUBLE (color_traps->bottom.right),
!                FIXED_TO_DOUBLE (color_traps->bottom.y));
    }
    
    dst->gl->end ();
  
    glitz_surface_dirty (dst, &bounds);
    glitz_surface_pop_current (dst);
--- 361,393 ----
                 color_traps->bottom.left_color.blue,
                 color_traps->bottom.left_color.alpha);
!     vertex_2d (x_offset + FIXED_TO_DOUBLE (color_traps->bottom.left),
!                y_offset + FIXED_TO_DOUBLE (color_traps->bottom.y));
  
!     color_4us (color_traps->top.left_color.red,
!                color_traps->top.left_color.green,
!                color_traps->top.left_color.blue,
!                color_traps->top.left_color.alpha);
!     vertex_2d (x_offset + FIXED_TO_DOUBLE (color_traps->top.left),
!                y_offset + FIXED_TO_DOUBLE (color_traps->top.y));
  
!     color_4us (color_traps->top.right_color.red,
!                color_traps->top.right_color.green,
!                color_traps->top.right_color.blue,
!                color_traps->top.right_color.alpha);
!     vertex_2d (x_offset + FIXED_TO_DOUBLE (color_traps->top.right),
!                y_offset + FIXED_TO_DOUBLE (color_traps->top.y));
  
!     color_4us (color_traps->bottom.right_color.red,
!                color_traps->bottom.right_color.green,
!                color_traps->bottom.right_color.blue,
!                color_traps->bottom.right_color.alpha);
!     vertex_2d (x_offset + FIXED_TO_DOUBLE (color_traps->bottom.right),
!                y_offset + FIXED_TO_DOUBLE (color_traps->bottom.y));
    }
    
    dst->gl->end ();
  
+   dst->gl->shade_model (GLITZ_GL_FLAT);
+ 
    glitz_surface_dirty (dst, &bounds);
    glitz_surface_pop_current (dst);

Index: glitz_tri.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_tri.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_tri.c	9 Aug 2004 22:57:35 -0000	1.7
--- glitz_tri.c	18 Aug 2004 12:30:24 -0000	1.8
***************
*** 33,52 ****
  
  static void
! glitz_point_fixed_bounds (int n_point,
                            const glitz_point_fixed_t *points,
                            glitz_bounding_box_t *box)
  {
!   box->x1 = FIXED_TO_INT (points->x);
!   box->x2 = FIXED_TO_INT (FIXED_CEIL (points->x));
!   box->y1 = FIXED_TO_INT (points->y);
!   box->y2 = FIXED_TO_INT (FIXED_CEIL (points->y));
!   points++;
!   n_point--;
      
!   while (n_point-- > 0) {
!     int x1 = FIXED_TO_INT (points->x);
!     int x2 = FIXED_TO_INT (FIXED_CEIL (points->x));
!     int y1 = FIXED_TO_INT (points->y);
!     int y2 = FIXED_TO_INT (FIXED_CEIL (points->y));
        
      if (x1 < box->x1)
--- 33,54 ----
  
  static void
! glitz_point_fixed_bounds (int x_offset,
!                           int y_offset,
!                           int n_points,
                            const glitz_point_fixed_t *points,
                            glitz_bounding_box_t *box)
  {
!   box->x1 = MAXSHORT;
!   box->x2 = MINSHORT;
!   box->y1 = MAXSHORT;
!   box->y2 = MINSHORT;
!   
!   for (; n_points; n_points--, points++) {
!     int x1, y1, x2, y2;
      
!     x1 = FIXED_TO_INT (points->x);
!     x2 = FIXED_TO_INT (FIXED_CEIL (points->x));
!     y1 = FIXED_TO_INT (points->y);
!     y2 = FIXED_TO_INT (FIXED_CEIL (points->y));
        
      if (x1 < box->x1)
***************
*** 58,64 ****
      else if (y2 > box->y2)
        box->y2 = y2;
-     
-     points++;
    }
  }
  
--- 60,69 ----
      else if (y2 > box->y2)
        box->y2 = y2;
    }
+ 
+   box->x1 += x_offset;
+   box->x2 += x_offset;
+   box->y1 += y_offset;
+   box->y2 += y_offset;
  }
  
***************
*** 74,78 ****
  {
    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);
--- 79,85 ----
  {
    glitz_gl_vertex_2d_t vertex_2d;
!   static glitz_sample_offset_t zero_offset = { 0.0, 0.0 };
!   glitz_sample_offset_t *offset;
!   int i, passes;
    
    dst->gl->color_4us (color->red, color->green, color->blue, color->alpha);
***************
*** 81,88 ****
  
    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:
--- 88,100 ----
  
    if (dst->multi_sample) {
!     passes = dst->multi_sample->n_samples;
!     offset = dst->multi_sample->offsets;
!   } else {
!     passes = 1;
!     offset = &zero_offset;
    }
  
+   vertex_2d = dst->gl->vertex_2d;
+ 
    switch (type) {
    case GLITZ_TRIANGLE_TYPE_NORMAL:
***************
*** 97,124 ****
    }
  
!   vertex_2d = dst->gl->vertex_2d;
!   for (; n_points; n_points--, points++)
!     vertex_2d (x_offset + FIXED_TO_DOUBLE (points->x),
!                y_offset + FIXED_TO_DOUBLE (points->y));
    
    dst->gl->end ();
- 
-   if (list) {
-     int i;
-     
-     dst->gl->end_list ();
- 
-     dst->gl->matrix_mode (GLITZ_GL_MODELVIEW);
- 
-     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);
-   }
  }
  
--- 109,118 ----
    }
  
!   while (passes--)
!     for (i = 0; i < n_points; i++)
!       vertex_2d (offset[passes].x + x_offset + FIXED_TO_DOUBLE (points[i].x),
!                  offset[passes].y + y_offset + FIXED_TO_DOUBLE (points[i].y));
    
    dst->gl->end ();
  }
  
***************
*** 126,129 ****
--- 120,125 ----
  glitz_fill_triangles (glitz_operator_t op,
                        glitz_surface_t *dst,
+                       int x_offset,
+                       int y_offset,
                        const glitz_color_t *color,
                        const glitz_triangle_t *tris,
***************
*** 132,136 ****
    glitz_bounding_box_t bounds;
    
!   glitz_point_fixed_bounds (n_tris * 3, (glitz_point_fixed_t *) tris, &bounds);
    if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
--- 128,133 ----
    glitz_bounding_box_t bounds;
    
!   glitz_point_fixed_bounds (x_offset, y_offset,
!                             n_tris * 3, (glitz_point_fixed_t *) tris, &bounds);
    if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
***************
*** 138,141 ****
--- 135,139 ----
      
    if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
+     glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
      glitz_surface_pop_current (dst);
      return;
***************
*** 145,149 ****
                              dst,
                              GLITZ_TRIANGLE_TYPE_NORMAL,
!                             0, 0,
                              color,
                              (glitz_point_fixed_t *) tris,
--- 143,147 ----
                              dst,
                              GLITZ_TRIANGLE_TYPE_NORMAL,
!                             x_offset, y_offset,
                              color,
                              (glitz_point_fixed_t *) tris,
***************
*** 155,158 ****
--- 153,201 ----
  slim_hidden_def(glitz_fill_triangles);
  
+ void
+ glitz_add_triangles (glitz_surface_t *dst,
+                      int x_offset,
+                      int y_offset,
+                      const glitz_triangle_t *tris,
+                      int n_tris)
+ {
+   glitz_bounding_box_t bounds;
+   glitz_color_t color;
+   
+   glitz_point_fixed_bounds (x_offset, y_offset,
+                             n_tris * 3, (glitz_point_fixed_t *) tris, &bounds);
+   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
+       bounds.x2 < 0 || bounds.y2 < 0)
+     return;
+ 
+   glitz_surface_enable_anti_aliasing (dst);
+     
+   if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
+     glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
+     glitz_surface_pop_current (dst);
+     return;
+   }
+   
+   if (dst->multi_sample)
+     color.red = color.green = color.blue = color.alpha =
+       0xffff / dst->multi_sample->n_samples;
+   else
+     color.red = color.green = color.blue = color.alpha = 0xffff;
+ 
+   glitz_int_fill_triangles (GLITZ_OPERATOR_ADD,
+                             dst,
+                             GLITZ_TRIANGLE_TYPE_NORMAL,
+                             x_offset, y_offset,
+                             &color,
+                             (glitz_point_fixed_t *) tris,
+                             n_tris * 3);
+ 
+   glitz_surface_disable_anti_aliasing (dst);
+ 
+   glitz_surface_dirty (dst, &bounds);  
+   glitz_surface_pop_current (dst);
+ }
+ slim_hidden_def(glitz_add_triangles);
+ 
  static void
  glitz_int_composite_triangles (glitz_operator_t op,
***************
*** 161,175 ****
                                 int x_src,
                                 int y_src,
                                 glitz_triangle_type_t type,
                                 const glitz_point_fixed_t *points,
                                 int n_points)
  {
!   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);
--- 204,217 ----
                                 int x_src,
                                 int y_src,
+                                int x_offset,
+                                int y_offset,
+                                unsigned short opacity,
                                 glitz_triangle_type_t type,
                                 const glitz_point_fixed_t *points,
                                 int n_points)
  {
!   glitz_bounding_box_t bounds;
    glitz_rectangle_t rect;
  
    if (dst->format->stencil_size < ((*dst->stencil_mask)? 2: 1)) {
      glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
***************
*** 177,204 ****
    }
  
!   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;
  
!   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;
    
    glitz_surface_enable_anti_aliasing (dst);
  
    if (*dst->stencil_mask == 0x0)
!     glitz_stencil_rectangles (dst,
!                               GLITZ_STENCIL_OPERATOR_CLEAR,
!                               &rect, 1);
    
!   glitz_stencil_triangles (dst,
!                            GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
!                            type,
!                            points,
!                            n_points);
!     
    dst->hint_mask |= GLITZ_INT_HINT_POLYGON_OP_MASK;
  
--- 219,243 ----
    }
  
!   glitz_point_fixed_bounds (x_offset, y_offset, n_points, points, &bounds);
!   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
!       bounds.x2 < 0 || bounds.y2 < 0)
      return;
  
!   rect.x = bounds.x1;
!   rect.y = bounds.y1;
!   rect.width = bounds.x2 - bounds.x1;
!   rect.height = bounds.y2 - bounds.y1;
    
    glitz_surface_enable_anti_aliasing (dst);
  
    if (*dst->stencil_mask == 0x0)
!     glitz_stencil_rectangles (GLITZ_STENCIL_OPERATOR_CLEAR,
!                               dst, 0, 0, &rect, 1);
    
!   glitz_stencil_triangles (GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
!                            dst, x_offset, y_offset, type,
!                            points, n_points);
! 
!   dst->polyopacity = opacity;
    dst->hint_mask |= GLITZ_INT_HINT_POLYGON_OP_MASK;
  
***************
*** 207,212 ****
                     NULL,
                     dst,
!                    x_src + tri_bounds.x1 - x_dst,
!                    y_src + tri_bounds.y1 - y_dst,
                     0, 0,
                     rect.x, rect.y,
--- 246,251 ----
                     NULL,
                     dst,
!                    x_src + bounds.x1,
!                    y_src + bounds.y1,
                     0, 0,
                     rect.x, rect.y,
***************
*** 218,224 ****
      
    if (*dst->stencil_mask != 0x1)
!     glitz_stencil_rectangles (dst,
!                               GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                               &rect, 1);
    else
      *dst->stencil_mask = 0x0;
--- 257,262 ----
      
    if (*dst->stencil_mask != 0x1)
!     glitz_stencil_rectangles (GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                               dst, 0, 0, &rect, 1);
    else
      *dst->stencil_mask = 0x0;
***************
*** 233,241 ****
                             int x_src,
                             int y_src,
                             const glitz_triangle_t *tris,
                             int n_tris)
  {
!   glitz_int_composite_triangles (op, src, dst, x_src, y_src,
!                                  GLITZ_TRIANGLE_TYPE_NORMAL,
                                   (glitz_point_fixed_t *) tris,
                                   n_tris * 3);
--- 271,283 ----
                             int x_src,
                             int y_src,
+                            int x_offset,
+                            int y_offset,
+                            unsigned short opacity,
                             const glitz_triangle_t *tris,
                             int n_tris)
  {
!   glitz_int_composite_triangles (op, src, dst,
!                                  x_src, y_src, x_offset, y_offset,
!                                  opacity, GLITZ_TRIANGLE_TYPE_NORMAL,
                                   (glitz_point_fixed_t *) tris,
                                   n_tris * 3);
***************
*** 249,257 ****
                             int x_src,
                             int y_src,
                             const glitz_point_fixed_t *points,
                             int n_points)
  {
!   glitz_int_composite_triangles (op, src, dst, x_src, y_src,
!                                  GLITZ_TRIANGLE_TYPE_STRIP,
                                   points, n_points);
  }
--- 291,303 ----
                             int x_src,
                             int y_src,
+                            int x_offset,
+                            int y_offset,
+                            unsigned short opacity,
                             const glitz_point_fixed_t *points,
                             int n_points)
  {
!   glitz_int_composite_triangles (op, src, dst,
!                                  x_src, y_src, x_offset, y_offset,
!                                  opacity, GLITZ_TRIANGLE_TYPE_STRIP,
                                   points, n_points);
  }
***************
*** 264,272 ****
                           int x_src,
                           int y_src,
                           const glitz_point_fixed_t *points,
                           int n_points)
  {
!   glitz_int_composite_triangles (op, src, dst, x_src, y_src,
!                                  GLITZ_TRIANGLE_TYPE_FAN,
                                   points, n_points);
  }
--- 310,322 ----
                           int x_src,
                           int y_src,
+                          int x_offset,
+                          int y_offset,
+                          unsigned short opacity,
                           const glitz_point_fixed_t *points,
                           int n_points)
  {
!   glitz_int_composite_triangles (op, src, dst,
!                                  x_src, y_src, x_offset, y_offset,
!                                  opacity, GLITZ_TRIANGLE_TYPE_FAN,
                                   points, n_points);
  }
***************
*** 274,303 ****
  
  static void
! glitz_color_triangle_bounds (int n_color_tris,
                               const glitz_color_triangle_t *color_tris,
                               glitz_bounding_box_t *box)
  {
!   box->x1 = MIN (MIN (FIXED_TO_INT (color_tris->p1.point.x),
!                       FIXED_TO_INT (color_tris->p2.point.x)),
!                  FIXED_TO_INT (color_tris->p3.point.x));
! 
!   box->x2 = MAX (MAX (FIXED_TO_INT (FIXED_CEIL (color_tris->p1.point.x)),
!                       FIXED_TO_INT (FIXED_CEIL (color_tris->p2.point.x))),
!                  FIXED_TO_INT (FIXED_CEIL (color_tris->p3.point.x)));
!   
!   box->y1 = MIN (MIN (FIXED_TO_INT (color_tris->p1.point.y),
!                       FIXED_TO_INT (color_tris->p2.point.y)),
!                  FIXED_TO_INT (color_tris->p3.point.y));
!   
!   box->y2 = MAX (MAX (FIXED_TO_INT (FIXED_CEIL (color_tris->p1.point.y)),
!                       FIXED_TO_INT (FIXED_CEIL (color_tris->p2.point.y))),
!                  FIXED_TO_INT (FIXED_CEIL (color_tris->p3.point.y)));
!   
!   color_tris++;
!   n_color_tris--;
! 
!   while (n_color_tris-- > 0) {
!     int16_t x1, y1, x2, y2;
  
      x1 = MIN (MIN (FIXED_TO_INT (color_tris->p1.point.x),
                     FIXED_TO_INT (color_tris->p2.point.x)),
--- 324,341 ----
  
  static void
! glitz_color_triangle_bounds (int x_offset,
!                              int y_offset,
!                              int n_color_tris,
                               const glitz_color_triangle_t *color_tris,
                               glitz_bounding_box_t *box)
  {
!   box->x1 = MAXSHORT;
!   box->x2 = MINSHORT;
!   box->y1 = MAXSHORT;
!   box->y2 = MINSHORT;
  
+   for (; n_color_tris; n_color_tris--, color_tris++) {
+     int x1, y1, x2, y2;
+     
      x1 = MIN (MIN (FIXED_TO_INT (color_tris->p1.point.x),
                     FIXED_TO_INT (color_tris->p2.point.x)),
***************
*** 323,329 ****
      if (y2 > box->y2)
        box->y2 = y2;
-     
-     color_tris++;
    }
  }
  
--- 361,370 ----
      if (y2 > box->y2)
        box->y2 = y2;
    }
+ 
+   box->x1 += x_offset;
+   box->x2 += x_offset;
+   box->y1 += y_offset;
+   box->y2 += y_offset;
  }
  
***************
*** 332,335 ****
--- 373,378 ----
  glitz_color_triangles (glitz_operator_t op,
                         glitz_surface_t *dst,
+                        int x_offset,
+                        int y_offset,
                         const glitz_color_triangle_t *color_tris,
                         int n_color_tris)
***************
*** 338,351 ****
    glitz_gl_color_4us_t color_4us;
    glitz_bounding_box_t bounds;
-   int index;
-   glitz_bool_t shade = 0;
  
!   glitz_color_triangle_bounds (n_color_tris, color_tris, &bounds);
!   if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2 ||
!       bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
      return;
    
    if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
      glitz_surface_pop_current (dst);
      return;
--- 381,393 ----
    glitz_gl_color_4us_t color_4us;
    glitz_bounding_box_t bounds;
  
!   glitz_color_triangle_bounds (x_offset, y_offset,
!                                n_color_tris, color_tris, &bounds);
!   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
        bounds.x2 < 0 || bounds.y2 < 0)
      return;
    
    if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
+     glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
      glitz_surface_pop_current (dst);
      return;
***************
*** 354,368 ****
    glitz_set_operator (dst->gl, op);
  
!   for (index = 0; index < n_color_tris; index++) {
!     if (memcmp (&color_tris[index].p1.color,
!                 &color_tris[index].p2.color, sizeof (glitz_color_t)) ||
!         memcmp (&color_tris[index].p2.color,
!                 &color_tris[index].p3.color, sizeof (glitz_color_t))) {
!       dst->gl->shade_model (GLITZ_GL_SMOOTH);
!       shade = 1;
!       break;
!     }
!   }
! 
    dst->gl->begin (GLITZ_GL_TRIANGLES);
  
--- 396,401 ----
    glitz_set_operator (dst->gl, op);
  
!   dst->gl->shade_model (GLITZ_GL_SMOOTH);
!   
    dst->gl->begin (GLITZ_GL_TRIANGLES);
  
***************
*** 374,398 ****
                 color_tris->p1.color.blue,
                 color_tris->p1.color.alpha);
!     vertex_2d (FIXED_TO_DOUBLE (color_tris->p1.point.x),
!                FIXED_TO_DOUBLE (color_tris->p1.point.y));
      
!     if (shade)
!       color_4us (color_tris->p2.color.red,
!                  color_tris->p2.color.green,
!                  color_tris->p2.color.blue,
!                  color_tris->p2.color.alpha);
!     vertex_2d (FIXED_TO_DOUBLE (color_tris->p2.point.x),
!                FIXED_TO_DOUBLE (color_tris->p2.point.y));
  
!     if (shade)
!       color_4us (color_tris->p3.color.red,
!                  color_tris->p3.color.green,
!                  color_tris->p3.color.blue,
!                  color_tris->p3.color.alpha);
!     vertex_2d (FIXED_TO_DOUBLE (color_tris->p3.point.x),
!                FIXED_TO_DOUBLE (color_tris->p3.point.y));
    }
  
    dst->gl->end ();
  
    glitz_surface_dirty (dst, &bounds);
--- 407,431 ----
                 color_tris->p1.color.blue,
                 color_tris->p1.color.alpha);
!     vertex_2d (x_offset + FIXED_TO_DOUBLE (color_tris->p1.point.x),
!                y_offset + FIXED_TO_DOUBLE (color_tris->p1.point.y));
      
!     color_4us (color_tris->p2.color.red,
!                color_tris->p2.color.green,
!                color_tris->p2.color.blue,
!                color_tris->p2.color.alpha);
!     vertex_2d (x_offset + FIXED_TO_DOUBLE (color_tris->p2.point.x),
!                y_offset + FIXED_TO_DOUBLE (color_tris->p2.point.y));
  
!     color_4us (color_tris->p3.color.red,
!                color_tris->p3.color.green,
!                color_tris->p3.color.blue,
!                color_tris->p3.color.alpha);
!     vertex_2d (x_offset + FIXED_TO_DOUBLE (color_tris->p3.point.x),
!                y_offset + FIXED_TO_DOUBLE (color_tris->p3.point.y));
    }
  
    dst->gl->end ();
+   
+   dst->gl->shade_model (GLITZ_GL_FLAT);
  
    glitz_surface_dirty (dst, &bounds);

Index: glitz_util.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_util.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_util.c	9 Aug 2004 22:57:35 -0000	1.7
--- glitz_util.c	18 Aug 2004 12:30:24 -0000	1.8
***************
*** 136,137 ****
--- 136,147 ----
    gl->pop_attrib ();
  }
+ 
+ void
+ glitz_clamp_value (double *value, double min, double max)
+ {
+   if (*value < min)
+     *value = min;
+   else if (*value > max)
+     *value = max;
+ }
+ 

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** glitzint.h	9 Aug 2004 22:57:35 -0000	1.21
--- glitzint.h	18 Aug 2004 12:30:24 -0000	1.22
***************
*** 138,146 ****
    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_t active_texture;
--- 138,141 ----
***************
*** 198,213 ****
  #define GLITZ_TEXTURE_LAST 3
  
! #define GLITZ_FRAGMENT_FILTER_CONVOLUTION     0
! #define GLITZ_FRAGMENT_FILTER_LINEAR_GRADIENT 1
! #define GLITZ_FRAGMENT_FILTER_RADIAL_GRADIENT 2
! #define GLITZ_FRAGMENT_FILTER_TYPES 3
  
! typedef struct _glitz_program_info_t {
!   glitz_gl_uint_t vertex[GLITZ_TEXTURE_LAST][GLITZ_TEXTURE_LAST];
!   glitz_gl_uint_t fragment[GLITZ_TEXTURE_LAST][GLITZ_TEXTURE_LAST];
! } glitz_program_info_t;
  
  typedef struct _glitz_program_map_t {
!   glitz_program_info_t info[GLITZ_COMBINE_TYPES][GLITZ_FRAGMENT_FILTER_TYPES];
  } glitz_program_map_t;
  
--- 193,219 ----
  #define GLITZ_TEXTURE_LAST 3
  
! #define GLITZ_FP_CONVOLUTION                 0
! #define GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT 1
! #define GLITZ_FP_LINEAR_GRADIENT_NEAREST     2
! #define GLITZ_FP_LINEAR_GRADIENT_REPEAT      3
! #define GLITZ_FP_LINEAR_GRADIENT_REFLECT     4
! #define GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT 5
! #define GLITZ_FP_RADIAL_GRADIENT_NEAREST     6
! #define GLITZ_FP_RADIAL_GRADIENT_REPEAT      7
! #define GLITZ_FP_RADIAL_GRADIENT_REFLECT     8
! #define GLITZ_FP_TYPES                       9
  
! typedef struct _glitz_program_t {
!   glitz_gl_int_t *name;
!   unsigned int size;
! } glitz_program_t;
! 
! typedef struct _glitz_filter_map_t {
!   glitz_program_t fp[GLITZ_TEXTURE_LAST][GLITZ_TEXTURE_LAST];
! } glitz_filter_map_t;
  
  typedef struct _glitz_program_map_t {
!   glitz_filter_map_t filters[GLITZ_COMBINE_TYPES][GLITZ_FP_TYPES];
!   glitz_gl_int_t vp;
  } glitz_program_map_t;
  
***************
*** 233,239 ****
  } glitz_point_t;
  
! typedef struct _glitz_matrix_t {
!   double m[3][3];
! } glitz_matrix_t;
  
  typedef struct _glitz_texture {
--- 239,245 ----
  } glitz_point_t;
  
! typedef struct _glitz_vec_t {
!   double v[4];
! } glitz_vec4_t;
  
  typedef struct _glitz_texture {
***************
*** 286,306 ****
  } glitz_surface_backend_t;
  
! #define GLITZ_INT_HINT_SOLID_MASK                  (1L <<  3)
! #define GLITZ_INT_HINT_REPEAT_MASK                 (1L <<  4)
! #define GLITZ_INT_HINT_MIRRORED_MASK               (1L <<  5)
! #define GLITZ_INT_HINT_PAD_MASK                    (1L <<  6)
! #define GLITZ_INT_HINT_DIRTY_MASK                  (1L <<  7)
! #define GLITZ_INT_HINT_COMPONENT_ALPHA_MASK        (1L <<  8)
! #define GLITZ_INT_HINT_QUALITY_CORRECTNESS_MASK    (1L <<  9)
! #define GLITZ_INT_HINT_MULTISAMPLE_MASK            (1L << 10)
! #define GLITZ_INT_HINT_SOLID_DIRTY_MASK            (1L << 11)
! #define GLITZ_INT_HINT_DRAWABLE_DIRTY_MASK         (1L << 12)
! #define GLITZ_INT_HINT_POLYGON_OP_MASK             (1L << 13)
! #define GLITZ_INT_HINT_FRAGMENT_FILTER_MASK        (1L << 14)
! #define GLITZ_INT_HINT_LINEAR_TRANSFORM_MASK       (1L << 15)
! #define GLITZ_INT_HINT_LINEAR_NON_TRANSFORM_MASK   (1L << 16)
! #define GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK (1L << 17)
! #define GLITZ_INT_HINT_RENDER_TEXTURE_MASK         (1L << 18)
! #define GLITZ_INT_HINT_DRAWABLE_MASK               (1L << 19)
  
  #define SURFACE_OFFSCREEN(surface) \
--- 292,311 ----
  } glitz_surface_backend_t;
  
! #define GLITZ_INT_HINT_SOLID_MASK                   (1L <<  3)
! #define GLITZ_INT_HINT_REPEAT_MASK                  (1L <<  4)
! #define GLITZ_INT_HINT_MIRRORED_MASK                (1L <<  5)
! #define GLITZ_INT_HINT_PAD_MASK                     (1L <<  6)
! #define GLITZ_INT_HINT_CLIP_MASK                    (1L <<  7)
! #define GLITZ_INT_HINT_DIRTY_MASK                   (1L <<  8)
! #define GLITZ_INT_HINT_COMPONENT_ALPHA_MASK         (1L <<  9)
! #define GLITZ_INT_HINT_MULTISAMPLE_MASK             (1L << 10)
! #define GLITZ_INT_HINT_SOLID_DIRTY_MASK             (1L << 11)
! #define GLITZ_INT_HINT_DRAWABLE_DIRTY_MASK          (1L << 12)
! #define GLITZ_INT_HINT_POLYGON_OP_MASK              (1L << 13)
! #define GLITZ_INT_HINT_FRAGMENT_FILTER_MASK         (1L << 14)
! #define GLITZ_INT_HINT_LINEAR_TRANSFORM_FILTER_MASK (1L << 15)
! #define GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK  (1L << 16)
! #define GLITZ_INT_HINT_DRAWABLE_MASK                (1L << 17)
! #define GLITZ_INT_HINT_IGNORE_REPEAT_MASK           (1L << 18)
  
  #define SURFACE_OFFSCREEN(surface) \
***************
*** 311,315 ****
  
  #define SURFACE_REPEAT(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_REPEAT_MASK)
  
  #define SURFACE_MIRRORED(surface) \
--- 316,321 ----
  
  #define SURFACE_REPEAT(surface) \
!   (((surface)->hint_mask & GLITZ_INT_HINT_REPEAT_MASK) && \
!    (!((surface)->hint_mask & GLITZ_INT_HINT_IGNORE_REPEAT_MASK)))
  
  #define SURFACE_MIRRORED(surface) \
***************
*** 325,331 ****
    ((surface)->hint_mask & GLITZ_INT_HINT_COMPONENT_ALPHA_MASK)
  
- #define SURFACE_QUALITY_CORRECTNESS(surface) \
-   ((surface)->hint_mask & GLITZ_INT_HINT_QUALITY_CORRECTNESS_MASK)
- 
  #define SURFACE_MULTISAMPLE(surface) \
    ((surface)->hint_mask & GLITZ_INT_HINT_MULTISAMPLE_MASK)
--- 331,334 ----
***************
*** 343,361 ****
    ((surface)->hint_mask & GLITZ_INT_HINT_FRAGMENT_FILTER_MASK)
  
! #define SURFACE_LINEAR_TRANSFORM(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_LINEAR_TRANSFORM_MASK)
! 
! #define SURFACE_LINEAR_NON_TRANSFORM(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_LINEAR_NON_TRANSFORM_MASK)
  
  #define SURFACE_WINDOW_SPACE_TEXCOORDS(surface) \
    ((surface)->hint_mask & GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK)
  
- #define SURFACE_RENDER_TEXTURE(surface) \
-   ((surface)->hint_mask & GLITZ_INT_HINT_RENDER_TEXTURE_MASK)
- 
  #define SURFACE_DRAWABLE(surface) \
    ((surface)->hint_mask & GLITZ_INT_HINT_DRAWABLE_MASK)
  
  typedef struct _glitz_sample_offset {
    double x;
--- 346,363 ----
    ((surface)->hint_mask & GLITZ_INT_HINT_FRAGMENT_FILTER_MASK)
  
! #define SURFACE_LINEAR_TRANSFORM_FILTER(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_LINEAR_TRANSFORM_FILTER_MASK)
  
  #define SURFACE_WINDOW_SPACE_TEXCOORDS(surface) \
    ((surface)->hint_mask & GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK)
  
  #define SURFACE_DRAWABLE(surface) \
    ((surface)->hint_mask & GLITZ_INT_HINT_DRAWABLE_MASK)
  
+ #define SURFACE_CLIP(surface) \
+   (((surface)->hint_mask & GLITZ_INT_HINT_CLIP_MASK) && \
+    (!SURFACE_FRAGMENT_FILTER (surface)) && \
+    (!(surface)->transform))
+ 
  typedef struct _glitz_sample_offset {
    double x;
***************
*** 377,382 ****
    double m[16];
    double m_norm[16];
-   glitz_matrix_t affine;
-   glitz_bool_t inverted;
  } glitz_projective_transform_t;
  
--- 379,382 ----
***************
*** 431,436 ****
  typedef enum {
    GLITZ_COMPONENT_ALPHA_NONE = 0,
!   GLITZ_COMPONENT_ALPHA_RGB,
!   GLITZ_COMPONENT_ALPHA_ARGB
  } glitz_component_alpha_type_t;
  
--- 431,436 ----
  typedef enum {
    GLITZ_COMPONENT_ALPHA_NONE = 0,
!   GLITZ_COMPONENT_ALPHA_RGB = 3,
!   GLITZ_COMPONENT_ALPHA_ARGB = 4
  } glitz_component_alpha_type_t;
  
***************
*** 445,449 ****
    glitz_color_t alpha_mask;
    glitz_component_alpha_type_t component_alpha;
-   glitz_bool_t hw_wrap;
    glitz_gl_uint_t fp;
    glitz_gl_uint_t vp;
--- 445,448 ----
***************
*** 456,469 ****
  } glitz_extension_map;
  
- extern void __internal_linkage
- glitz_matrix_transform_point (glitz_matrix_t *matrix,
-                               double *x, double *y);
- 
- extern glitz_status_t __internal_linkage
- glitz_matrix_invert (glitz_matrix_t *matrix);
- 
- extern glitz_status_t __internal_linkage
- glitz_matrix_normalize (glitz_matrix_t *matrix);
- 
  typedef enum glitz_int_operator {
    GLITZ_INT_OPERATOR_STENCIL_RECT_SET = 1000,
--- 455,458 ----
***************
*** 512,515 ****
--- 501,507 ----
                        int y);
  
+ extern void __internal_linkage
+ glitz_clamp_value (double *value, double min, double max);
+ 
  void
  glitz_texture_init (glitz_texture_t *texture,
***************
*** 616,622 ****
  glitz_surface_disable_anti_aliasing (glitz_surface_t *surface);
  
- extern glitz_matrix_t *__internal_linkage
- glitz_surface_get_affine_transform (glitz_surface_t *surface);
- 
  extern unsigned long __internal_linkage
  glitz_status_to_status_mask (glitz_status_t status);
--- 608,611 ----
***************
*** 657,670 ****
  
  extern glitz_gl_uint_t __internal_linkage
! glitz_get_vertex_program (glitz_composite_op_t *op,
!                           glitz_filter_t filter);
  
  extern glitz_gl_uint_t __internal_linkage
  glitz_get_fragment_program (glitz_composite_op_t *op,
!                             glitz_filter_t filter);
  
  extern void __internal_linkage
  glitz_int_fill_rectangles (glitz_operator_t op,
                             glitz_surface_t *dst,
                             const glitz_color_t *color,
                             const glitz_rectangle_t *rects,
--- 646,661 ----
  
  extern glitz_gl_uint_t __internal_linkage
! glitz_get_vertex_program (glitz_composite_op_t *op);
  
  extern glitz_gl_uint_t __internal_linkage
  glitz_get_fragment_program (glitz_composite_op_t *op,
!                             int fp_type,
!                             int id);
  
  extern void __internal_linkage
  glitz_int_fill_rectangles (glitz_operator_t op,
                             glitz_surface_t *dst,
+                            int x_offset,
+                            int y_offset,
                             const glitz_color_t *color,
                             const glitz_rectangle_t *rects,
***************
*** 691,708 ****
  
  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,
--- 682,705 ----
  
  extern void __internal_linkage
! glitz_stencil_rectangles (glitz_stencil_operator_t op,
!                           glitz_surface_t *dst,
!                           int x_offset,
!                           int y_offset,
                            const glitz_rectangle_t *rects,
                            int n_rects);
  
  extern void __internal_linkage
! glitz_stencil_trapezoids (glitz_stencil_operator_t op,
!                           glitz_surface_t *dst,
!                           int x_offset,
!                           int y_offset,
                            const glitz_trapezoid_t *traps,
                            int n_traps);
  
  extern void __internal_linkage
! glitz_stencil_triangles (glitz_stencil_operator_t op,
!                          glitz_surface_t *dst,
!                          int x_offset,
!                          int y_offset,
                           glitz_triangle_type_t type,
                           const glitz_point_fixed_t *points,
***************
*** 716,733 ****
  
  extern void __internal_linkage
- glitz_composite_op_set_alpha_mask (glitz_composite_op_t *op,
-                                    unsigned short red,
-                                    unsigned short green,
-                                    unsigned short blue,
-                                    unsigned short alpha);
- 
- extern void __internal_linkage
- glitz_composite_op_get_alpha_mask (glitz_composite_op_t *op,
-                                    unsigned short *red,
-                                    unsigned short *green,
-                                    unsigned short *blue,
-                                    unsigned short *alpha);
- 
- extern void __internal_linkage
  glitz_composite_enable (glitz_composite_op_t *op);
  
--- 713,716 ----
***************
*** 743,747 ****
  
  extern glitz_status_t __internal_linkage
! glitz_filter_set_params (glitz_filter_params_t **filter_params,
                           glitz_filter_t filter,
                           glitz_fixed16_16_t *params,
--- 726,730 ----
  
  extern glitz_status_t __internal_linkage
! glitz_filter_set_params (glitz_surface_t *surface,
                           glitz_filter_t filter,
                           glitz_fixed16_16_t *params,
***************
*** 749,752 ****
--- 732,750 ----
  
  extern void __internal_linkage
+ glitz_filter_set_type (glitz_surface_t *surface,
+                        glitz_filter_t filter);
+ 
+ extern void __internal_linkage
+ glitz_filter_params_destroy (glitz_filter_params_t *params);
+ 
+ extern glitz_gl_uint_t __internal_linkage
+ glitz_filter_get_vertex_program (glitz_surface_t *surface,
+                                  glitz_composite_op_t *op);
+ 
+ extern glitz_gl_uint_t __internal_linkage
+ glitz_filter_get_fragment_program (glitz_surface_t *surface,
+                                    glitz_composite_op_t *op);
+ 
+ extern void __internal_linkage
  glitz_filter_enable (glitz_surface_t *surface,
                       glitz_composite_op_t *op);
***************
*** 769,772 ****
--- 767,772 ----
  #endif
  
+ #define GLITZ_PI 3.14159265358979323846
+ 
  /* Fixed point updates from Carl Worth, USC, Information Sciences Institute */
  
***************
*** 832,839 ****
  slim_hidden_proto(glitz_surface_set_fill)
  slim_hidden_proto(glitz_surface_set_component_alpha)
- slim_hidden_proto(glitz_surface_set_correctness_hint)
  slim_hidden_proto(glitz_surface_set_filter)
  slim_hidden_proto(glitz_surface_set_polyedge)
- slim_hidden_proto(glitz_surface_set_polyopacity)
  slim_hidden_proto(glitz_surface_get_width)
  slim_hidden_proto(glitz_surface_get_height)
--- 832,837 ----
***************
*** 857,863 ****
--- 855,863 ----
  slim_hidden_proto(glitz_fill_rectangles)
  slim_hidden_proto(glitz_fill_trapezoids)
+ slim_hidden_proto(glitz_add_trapezoids)
  slim_hidden_proto(glitz_composite_trapezoids)
  slim_hidden_proto(glitz_color_trapezoids)
  slim_hidden_proto(glitz_fill_triangles)
+ slim_hidden_proto(glitz_add_triangles)
  slim_hidden_proto(glitz_composite_triangles)
  slim_hidden_proto(glitz_composite_tri_strip)




More information about the cairo-commit mailing list