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

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


Committed by: davidr

Update of /cvs/cairo/glitz/src
In directory gabe:/tmp/cvs-serv3582/src

Modified Files:
	Makefile.am glitz.c glitz.h glitz_agl_context.c 
	glitz_agl_extension.c glitz_agl_format.c glitz_agl_info.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_operator.c 
	glitz_pixel.c glitz_program.c glitz_rect.c glitz_status.c 
	glitz_surface.c glitz_texture.c glitz_util.c glitzint.h 
Added Files:
	glitz_buffer.c glitz_geometry.c 
Removed Files:
	glitz_stencil.c glitz_trap.c glitz_tri.c 
Log Message:
Switched to new geometry interface

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/glitz/src/Makefile.am,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** Makefile.am	18 Aug 2004 12:30:24 -0000	1.6
--- Makefile.am	3 Sep 2004 14:27:58 -0000	1.7
***************
*** 32,37 ****
  	glitz_texture.c \
  	glitz_rect.c \
- 	glitz_trap.c \
- 	glitz_tri.c \
  	glitz_status.c \
  	glitz_util.c \
--- 32,35 ----
***************
*** 39,45 ****
  	glitz_program.c \
  	glitz_compose.c \
- 	glitz_stencil.c \
- 	glitz_pixel.c \
  	glitz_filter.c \
  	glitz_gl.h \
  	glitzint.h
--- 37,44 ----
  	glitz_program.c \
  	glitz_compose.c \
  	glitz_filter.c \
+ 	glitz_buffer.c \
+ 	glitz_geometry.c \
+ 	glitz_pixel.c \
  	glitz_gl.h \
  	glitzint.h

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** glitz.c	18 Aug 2004 12:30:24 -0000	1.20
--- glitz.c	3 Sep 2004 14:27:58 -0000	1.21
***************
*** 45,48 ****
--- 45,49 ----
    glitz_texture_t *texture;
    glitz_gl_uint_t unit;
+   glitz_bool_t transform;
  } glitz_texture_unit_t;
  
***************
*** 61,65 ****
                   int height)
  {
!   glitz_gl_proc_address_list_t *gl = dst->gl;
    glitz_surface_t *intermediate = NULL;
    glitz_bounding_box_t rect;
--- 62,66 ----
                   int height)
  {
!   glitz_gl_proc_address_list_t *gl = &dst->backend->gl;
    glitz_surface_t *intermediate = NULL;
    glitz_bounding_box_t rect;
***************
*** 68,75 ****
    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)
--- 69,76 ----
    glitz_texture_t *stexture, *mtexture;
    glitz_texture_unit_t textures[3];
    glitz_color_t alpha_mask;
+   glitz_gl_enum_t primitive;
+   glitz_gl_int_t first;
+   glitz_gl_sizei_t count;
  
    if (width <= 0 || height <= 0)
***************
*** 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) {
--- 85,88 ----
***************
*** 205,242 ****
    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))
--- 168,193 ----
    rect.x2 = rect.x1 + width;
    rect.y2 = rect.y1 + height;
! 
    if (mtexture) {
      textures[0].texture = mtexture;
      textures[0].unit = _texture_units[0];
+     textures[0].transform = 0;
      texture_nr = 0;
      
      glitz_texture_bind (gl, mtexture);
! 
!     glitz_texture_set_tex_gen (gl,
!                                mtexture,
!                                rect.x1 - x_mask,
!                                rect.y1 - y_mask,
!                                mask->height,
!                                mask->flags);
      
      if (mask->transform) {
!       textures[0].transform = 1;
!       gl->matrix_mode (GLITZ_GL_TEXTURE);
!       gl->load_matrix_f (SURFACE_TEXTURE_COORDS (mask)?
!                          mask->transform->t: mask->transform->m);
!       gl->matrix_mode (GLITZ_GL_MODELVIEW);
        
        if (SURFACE_LINEAR_TRANSFORM_FILTER (mask))
***************
*** 244,255 ****
        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)) {
--- 195,200 ----
        else
          glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_NEAREST);
!     } else
        glitz_texture_ensure_filter (gl, mtexture, GLITZ_GL_NEAREST);
      
      if (SURFACE_REPEAT (mask)) {
***************
*** 259,263 ****
          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
--- 204,208 ----
          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
***************
*** 272,325 ****
        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)) {
--- 217,246 ----
        textures[++texture_nr].texture = stexture;
        textures[texture_nr].unit = _texture_units[texture_nr];
+       textures[texture_nr].transform = 0;
        if (texture_nr > 0)
          gl->active_texture (textures[texture_nr].unit);
        glitz_texture_bind (gl, stexture);
      }
  
!     glitz_texture_set_tex_gen (gl,
!                                stexture,
!                                rect.x1 - y_src,
!                                rect.y1 - x_src,
!                                src->height,
!                                src->flags);
  
      if (src->transform) {
!       textures[texture_nr].transform = 1;
!       gl->matrix_mode (GLITZ_GL_TEXTURE);
!       gl->load_matrix_f (SURFACE_TEXTURE_COORDS (src)?
!                          src->transform->t: src->transform->m);
!       gl->matrix_mode (GLITZ_GL_MODELVIEW);
!       
        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
        glitz_texture_ensure_filter (gl, stexture, GLITZ_GL_NEAREST);
        
      if (SURFACE_REPEAT (src)) {
***************
*** 329,333 ****
          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
--- 250,254 ----
          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
***************
*** 338,414 ****
    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);
!     gl->vertex_2d (rect.x1, rect.y1);
!     
!     if (t0) gl->tex_coord_2d (t0_br.x, t0_tl.y);
!     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);
!     gl->vertex_2d (rect.x2, rect.y2);
!     
!     if (t0) gl->tex_coord_2d (t0_tl.x, t0_br.y);
!     if (t1) gl->multi_tex_coord_2d (t1, t1_tl.x, t1_br.y);
!     gl->vertex_2d (rect.x1, rect.y2);
!     
!     gl->end ();
      
    }
  
!   if (comp_op.component_alpha)
!     gl->color_mask (1, 1, 1, 1);
  
!   glitz_composite_disable (&comp_op);
  
    for (i = texture_nr; i >= 0; i--) {
      glitz_texture_unbind (gl, textures[i].texture);
  
      if (i > 0)
--- 259,384 ----
    glitz_set_operator (gl, op);
  
!   gl->scissor (rect.x1,
!                dst->height - rect.y2,
!                rect.x2 - rect.x1,
!                rect.y2 - rect.y1);
! 
!   gl->push_matrix ();
!   
!   glitz_geometry_enable (gl, dst, &primitive, &first, &count);
! 
!   if (dst->indirect) {
!     glitz_sample_offset_t *offsets;
! 
!     passes = dst->indirect->n_samples;
!     offsets = dst->indirect->offsets;
! 
!     gl->enable (GLITZ_GL_STENCIL_TEST);
!     gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE, GLITZ_GL_FALSE,
!                     GLITZ_GL_FALSE);
!     gl->clear_stencil (0);
!     gl->clear (GLITZ_GL_STENCIL_BUFFER_BIT);
!     gl->stencil_func (GLITZ_GL_ALWAYS, ~0, ~0);
!     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_INCR, GLITZ_GL_INCR);
!     
!     for (i = 0; i < passes; i++) {
!       gl->push_matrix ();
!       gl->translate_f (offsets[i].x, offsets[i].y, 0.0f);
!       gl->draw_arrays (primitive, first, count);
!       gl->pop_matrix ();
!     }
! 
!     gl->pop_matrix ();
!     gl->push_matrix ();
!     
!     gl->color_mask (GLITZ_GL_TRUE, GLITZ_GL_TRUE, GLITZ_GL_TRUE,
!                     GLITZ_GL_TRUE);
!     
!     glitz_geometry_enable_default (gl, dst);
!     primitive = GLITZ_GL_QUADS;
!     first = 0;
!     count = 4;
!   } else
      passes = 1;
  
+   if (comp_op.component_alpha)
+     passes *= comp_op.component_alpha;
+ 
    alpha_mask = comp_op.alpha_mask;
  
    for (i = 0; i < passes; i++) {
!     unsigned short weight, sample;
!     
!     if (dst->indirect) {
!       if (comp_op.component_alpha)
!         sample = i / comp_op.component_alpha;
        else
!         sample = i;
        
!       weight = dst->indirect->weights[sample];
!       
!       gl->stencil_func (GLITZ_GL_EQUAL, sample + 1, ~0);
!       gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_KEEP, GLITZ_GL_KEEP);
!     } else
!       weight = 0xffff;
!     
!     if (comp_op.component_alpha) {
!       switch (i % comp_op.component_alpha) {
        case 0:
!         SET_COLOR (comp_op.alpha_mask,
!                    SHORT_MULT (weight, alpha_mask.red), 0, 0, 0);
!         gl->color_mask (GLITZ_GL_TRUE, GLITZ_GL_FALSE, GLITZ_GL_FALSE,
!                         GLITZ_GL_FALSE);
          break;
        case 1:
!         SET_COLOR (comp_op.alpha_mask,
!                    0, 0, SHORT_MULT (weight, alpha_mask.blue), 0);
!         gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE, GLITZ_GL_TRUE,
!                         GLITZ_GL_FALSE);
          break;
        case 2:
!         SET_COLOR (comp_op.alpha_mask,
!                    0, SHORT_MULT (weight, alpha_mask.green), 0, 0);
!         gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_TRUE, GLITZ_GL_FALSE,
!                         (comp_op.component_alpha == 4)? GLITZ_GL_FALSE:
!                         GLITZ_GL_TRUE);
          break;
        case 3:
!         SET_COLOR (comp_op.alpha_mask,
!                    0, 0, 0, SHORT_MULT (weight, alpha_mask.alpha));
!         gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE, GLITZ_GL_FALSE,
!                         GLITZ_GL_TRUE);
          break;
        }
+     } else {
+       SET_COLOR (comp_op.alpha_mask, 0, 0, 0,
+                  SHORT_MULT (weight, alpha_mask.alpha));
      }
      
!     glitz_composite_enable (&comp_op);
      
+     gl->draw_arrays (primitive, first, count);
    }
  
!   glitz_geometry_disable (gl, dst);
  
!   gl->pop_matrix ();
  
+   if (dst->indirect)
+     gl->disable (GLITZ_GL_STENCIL_TEST);
+   
+   if (comp_op.component_alpha)
+     gl->color_mask (GLITZ_GL_TRUE, GLITZ_GL_TRUE, GLITZ_GL_TRUE,
+                     GLITZ_GL_TRUE);
+   
+   glitz_composite_disable (&comp_op);
+   
    for (i = texture_nr; i >= 0; i--) {
      glitz_texture_unbind (gl, textures[i].texture);
+     if (textures[i].transform) {
+       gl->matrix_mode (GLITZ_GL_TEXTURE);
+       gl->load_identity ();
+       gl->matrix_mode (GLITZ_GL_MODELVIEW);
+     }
  
      if (i > 0)
***************
*** 417,421 ****
    
    glitz_surface_dirty (dst, &rect);
! 
    glitz_surface_pop_current (dst);
    
--- 387,391 ----
    
    glitz_surface_dirty (dst, &rect);
!   
    glitz_surface_pop_current (dst);
    
***************
*** 470,474 ****
      return;
  
!   gl = dst->gl;
  
    status = 0;
--- 440,444 ----
      return;
  
!   gl = &dst->backend->gl;
  
    status = 0;
***************
*** 481,486 ****
        status = 1;
  
!     gl->disable (GLITZ_GL_STENCIL_TEST);
!     dst->update_mask |= GLITZ_UPDATE_STENCIL_OP_MASK;
  
      if (status) {
--- 451,458 ----
        status = 1;
  
!     box.x1 = x_dst;
!     box.y1 = y_dst;
!     box.x2 = box.x1 + width;
!     box.y2 = box.y1 + height;
  
      if (status) {
***************
*** 496,541 ****
        glitz_texture_t *texture = glitz_surface_get_texture (src, 0);
        if (texture) {
-         glitz_point_t tl, br;
-           
          glitz_texture_bind (gl, texture);
  
!         gl->matrix_mode (GLITZ_GL_TEXTURE);
!         gl->load_identity ();
!         
          gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
                         GLITZ_GL_REPLACE);
          gl->color_4us (0x0, 0x0, 0x0, 0xffff);
- 
-         glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
          
          glitz_texture_ensure_wrap (gl, texture, GLITZ_GL_CLAMP_TO_EDGE);
          glitz_texture_ensure_filter (gl, texture, GLITZ_GL_NEAREST);
-         
-         glitz_texture_tex_coord (&dst->texture, x_dst, y_dst, &tl.x, &tl.y);
-         glitz_texture_tex_coord (&dst->texture,
-                                  x_dst + width, y_dst + height, &br.x, &br.y);
  
!         tl.y = dst->texture.texcoord_height - tl.y;
!         br.y = dst->texture.texcoord_height - br.y;
  
!         gl->begin (GLITZ_GL_QUADS);
!         gl->tex_coord_2d (tl.x, tl.y);
!         gl->vertex_2d (x_dst, y_dst);
!         gl->tex_coord_2d (br.x, tl.y);
!         gl->vertex_2d (x_dst + width, y_dst);
!         gl->tex_coord_2d (br.x, br.y);
!         gl->vertex_2d (x_dst + width, y_dst + height);
!         gl->tex_coord_2d (tl.x, br.y);
!         gl->vertex_2d (x_dst, y_dst + height);
!         gl->end ();
  
          glitz_texture_unbind (gl, texture);
        }
      }
- 
-     box.x1 = x_dst;
-     box.y1 = y_dst;
-     box.x2 = box.x1 + width;
-     box.y2 = box.y1 + height;
      
      glitz_surface_dirty (dst, &box);
--- 468,497 ----
        glitz_texture_t *texture = glitz_surface_get_texture (src, 0);
        if (texture) {
          glitz_texture_bind (gl, texture);
  
!         glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, height, ~0); 
! 
          gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
                         GLITZ_GL_REPLACE);
          gl->color_4us (0x0, 0x0, 0x0, 0xffff);
          
          glitz_texture_ensure_wrap (gl, texture, GLITZ_GL_CLAMP_TO_EDGE);
          glitz_texture_ensure_filter (gl, texture, GLITZ_GL_NEAREST);
  
!         glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
  
!         gl->scissor (box.x1,
!                      dst->height - box.y2,
!                      width, height);
!         
!         glitz_geometry_enable_default (gl, dst);
!         
!         gl->draw_arrays (GLITZ_GL_QUADS, 0, 4);
!         
!         glitz_geometry_disable (gl, dst);
  
          glitz_texture_unbind (gl, texture);
        }
      }
      
      glitz_surface_dirty (dst, &box);
***************
*** 571,579 ****
        GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
      };
!     glitz_pixel_buffer_t *buffer =
        glitz_pixel_buffer_create (src,
                                   NULL,
                                   width * height * 4,
!                                  GLITZ_PIXEL_BUFFER_HINT_STATIC_COPY);
      if (!buffer) {
        glitz_surface_status_add (dst, GLITZ_STATUS_NO_MEMORY_MASK);
--- 527,535 ----
        GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
      };
!     glitz_buffer_t *buffer =
        glitz_pixel_buffer_create (src,
                                   NULL,
                                   width * height * 4,
!                                  GLITZ_BUFFER_HINT_STATIC_COPY);
      if (!buffer) {
        glitz_surface_status_add (dst, GLITZ_STATUS_NO_MEMORY_MASK);
***************
*** 581,590 ****
      }
  
!     glitz_pixel_buffer_set_format (buffer, &pf);
!     
!     glitz_get_pixels (src, x_src, y_src, width, height, buffer);
!     glitz_put_pixels (dst, x_dst, y_dst, width, height, buffer);
      
!     glitz_pixel_buffer_destroy (buffer);
    }
  }
--- 537,544 ----
      }
  
!     glitz_get_pixels (src, x_src, y_src, width, height, &pf, buffer);
!     glitz_set_pixels (dst, x_dst, y_dst, width, height, &pf, buffer);
      
!     glitz_buffer_destroy (buffer);
    }
  }

Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** glitz.h	18 Aug 2004 12:30:24 -0000	1.18
--- glitz.h	3 Sep 2004 14:27:58 -0000	1.19
***************
*** 1,5 ****
  /*
!  * Copyright © 2004 David Reveman, Peter Nilsson
!  *
   * Permission to use, copy, modify, distribute, and sell this software
   * and its documentation for any purpose is hereby granted without
--- 1,5 ----
  /*
!  * Copyright © 2004 David Reveman
!  * 
   * Permission to use, copy, modify, distribute, and sell this software
   * and its documentation for any purpose is hereby granted without
***************
*** 7,27 ****
   * and that both that copyright notice and this permission notice
   * appear in supporting documentation, and that the names of
!  * David Reveman and Peter Nilsson not be used in advertising or
!  * publicity pertaining to distribution of the software without
!  * specific, written prior permission. David Reveman and Peter Nilsson
!  * makes no representations about the suitability of this software for
!  * any purpose. It is provided "as is" without express or implied warranty.
   *
!  * DAVID REVEMAN AND PETER NILSSON DISCLAIMS ALL WARRANTIES WITH
!  * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
!  * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DAVID REVEMAN AND
!  * PETER NILSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
!  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
!  * OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
!  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
!  * PERFORMANCE OF THIS SOFTWARE.
   *
!  * Authors: David Reveman <c99drn at cs.umu.se>
!  *          Peter Nilsson <c99pnn at cs.umu.se>
   */
  
--- 7,25 ----
   * and that both that copyright notice and this permission notice
   * appear in supporting documentation, and that the names of
!  * David Reveman not be used in advertising or publicity pertaining to
!  * distribution of the software without specific, written prior permission.
!  * David Reveman makes no representations about the suitability of this
!  * software for any purpose. It is provided "as is" without express or
!  * implied warranty.
   *
!  * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
!  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
!  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
!  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
!  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
!  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
!  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   *
!  * Author: David Reveman <c99drn at cs.umu.se>
   */
  
***************
*** 41,46 ****
  /* NOTE: Must be manually synchronized with GLITZ_VERSION in configure.in */
  #define GLITZ_MAJOR 0
! #define GLITZ_MINOR 1
! #define GLITZ_REVISION 5
  
  #if defined(__cplusplus) || defined(c_plusplus)
--- 39,44 ----
  /* NOTE: Must be manually synchronized with GLITZ_VERSION in configure.in */
  #define GLITZ_MAJOR 0
! #define GLITZ_MINOR 2
! #define GLITZ_REVISION 0
  
  #if defined(__cplusplus) || defined(c_plusplus)
***************
*** 49,58 ****
  
  typedef int glitz_bool_t;
  typedef int glitz_fixed16_16_t;
  
- typedef struct _glitz_point_fixed_t {
-   glitz_fixed16_16_t x, y;
- } glitz_point_fixed_t;
- 
  typedef struct _glitz_rectangle_t {
    short x, y;
--- 47,56 ----
  
  typedef int glitz_bool_t;
+ typedef short glitz_short_t;
+ typedef int glitz_int_t;
+ typedef float glitz_float_t;
+ typedef double glitz_double_t;
  typedef int glitz_fixed16_16_t;
  
  typedef struct _glitz_rectangle_t {
    short x, y;
***************
*** 60,75 ****
  } glitz_rectangle_t;
  
- typedef struct _glitz_triangle_t {
-   glitz_point_fixed_t p1, p2, p3;
- } 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;
- 
  typedef struct _glitz_transform_t {
    glitz_fixed16_16_t matrix[3][3];
--- 58,61 ----
***************
*** 83,105 ****
  } glitz_color_t;
    
- typedef struct _glitz_colorspan_t {
-   glitz_fixed16_16_t left, right, y;
-   glitz_color_t left_color;
-   glitz_color_t right_color;
- } glitz_colorspan_t;
- 
- typedef struct _glitz_colorpoint_t {
-   glitz_point_fixed_t point;
-   glitz_color_t color;
- } glitz_colorpoint_t;
- 
- typedef struct _glitz_color_trapezoid_t {
-   glitz_colorspan_t top, bottom;
- } glitz_color_trapezoid_t;
- 
- typedef struct _glitz_color_triangle_t {
-   glitz_colorpoint_t p1, p2, p3;
- } glitz_color_triangle_t;
- 
  typedef enum {
    GLITZ_FILTER_NEAREST,
--- 69,72 ----
***************
*** 112,120 ****
  
  typedef enum {
-   GLITZ_POLYEDGE_SHARP,
-   GLITZ_POLYEDGE_SMOOTH
- } glitz_polyedge_t;
- 
- typedef enum {
    GLITZ_OPERATOR_CLEAR,
    GLITZ_OPERATOR_SRC,
--- 79,82 ----
***************
*** 133,151 ****
  } glitz_operator_t;
  
! #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 {
--- 95,112 ----
  } glitz_operator_t;
  
! #define GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK        (1L <<  0)
! #define GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK (1L <<  1)
! #define GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK  (1L <<  2)
! #define GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK     (1L <<  3)
! #define GLITZ_FEATURE_MULTISAMPLE_MASK              (1L <<  4)
! #define GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK    (1L <<  5)
! #define GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK  (1L <<  6)
! #define GLITZ_FEATURE_MULTITEXTURE_MASK             (1L <<  7)
! #define GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK      (1L <<  8)
! #define GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK         (1L <<  9)
! #define GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 10)
! #define GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK     (1L << 11)
! #define GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 12)
! #define GLITZ_FEATURE_COMPONENT_ALPHA_MASK          (1L << 13)
  
  typedef enum {
***************
*** 199,203 ****
--- 160,167 ----
  } glitz_format_t;
  
+ typedef struct _glitz_surface glitz_surface_t;
+ typedef struct _glitz_buffer glitz_buffer_t;
  
+   
  /* glitz_status.c */
    
***************
*** 205,212 ****
      GLITZ_STATUS_SUCCESS = 0,
      GLITZ_STATUS_NO_MEMORY,
-     GLITZ_STATUS_NULL_POINTER,
      GLITZ_STATUS_BAD_COORDINATE,
      GLITZ_STATUS_NOT_SUPPORTED,
!     GLITZ_STATUS_INVALID_MATRIX
  } glitz_status_t;
  
--- 169,175 ----
      GLITZ_STATUS_SUCCESS = 0,
      GLITZ_STATUS_NO_MEMORY,
      GLITZ_STATUS_BAD_COORDINATE,
      GLITZ_STATUS_NOT_SUPPORTED,
!     GLITZ_STATUS_CONTENT_DESTROYED
  } glitz_status_t;
  
***************
*** 217,231 ****
  /* glitz_surface.c */
  
- typedef struct _glitz_surface glitz_surface_t;
- 
  void
  glitz_surface_destroy (glitz_surface_t *surface);
  
  void
  glitz_surface_set_transform (glitz_surface_t *surface,
                               glitz_transform_t *transform);
  
  typedef enum {
-   GLITZ_FILL_CLIP,
    GLITZ_FILL_TRANSPARENT,
    GLITZ_FILL_NEAREST,
--- 180,194 ----
  /* glitz_surface.c */
  
  void
  glitz_surface_destroy (glitz_surface_t *surface);
  
  void
+ glitz_surface_reference (glitz_surface_t *surface);
+ 
+ void
  glitz_surface_set_transform (glitz_surface_t *surface,
                               glitz_transform_t *transform);
  
  typedef enum {
    GLITZ_FILL_TRANSPARENT,
    GLITZ_FILL_NEAREST,
***************
*** 246,338 ****
                            glitz_filter_t filter,
                            glitz_fixed16_16_t *params,
!                           int n_params);
!   
! void
! glitz_surface_set_polyedge (glitz_surface_t *surface,
!                             glitz_polyedge_t polyedge);
  
  typedef enum {
!   GLITZ_POLYEDGE_SMOOTH_HINT_FAST,
!   GLITZ_POLYEDGE_SMOOTH_HINT_GOOD,
!   GLITZ_POLYEDGE_SMOOTH_HINT_BEST
! } glitz_polyedge_smooth_hint_t;
  
  void
! glitz_surface_set_polyedge_smooth_hint (glitz_surface_t *surface,
!                                         glitz_polyedge_smooth_hint_t hint);
! 
! typedef enum {
!   GLITZ_CLIP_OPERATOR_SET,
!   GLITZ_CLIP_OPERATOR_UNION,
!   GLITZ_CLIP_OPERATOR_INTERSECT
! } glitz_clip_operator_t;
!   
! void
! 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);
!   
! void
! 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);
  
  void
! 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);
    
- int
- glitz_surface_get_width (glitz_surface_t *surface);
- 
- int
- glitz_surface_get_height (glitz_surface_t *surface);
- 
- void
- glitz_surface_update_size (glitz_surface_t *surface);
- 
- typedef enum {
-   GLITZ_BUFFER_FRONT,
-   GLITZ_BUFFER_BACK
- } glitz_buffer_t;
- 
- void
- glitz_surface_set_read_buffer (glitz_surface_t *surface,
-                                glitz_buffer_t buffer);
- 
  void
! glitz_surface_set_draw_buffer (glitz_surface_t *surface,
!                                glitz_buffer_t buffer);
  
  void
  glitz_surface_flush (glitz_surface_t *surface);
-   
- void
- glitz_surface_swap_buffers (glitz_surface_t *surface);
  
  void
  glitz_surface_finish (glitz_surface_t *surface);
  
! void
! glitz_surface_get_gl_texture (glitz_surface_t *surface,
!                               unsigned int *name,
!                               unsigned int *target,
!                               double *texcoord_width,
!                               double *texcoord_height);
! 
! void
! glitz_surface_gl_begin (glitz_surface_t *surface);
  
! void
! glitz_surface_gl_end (glitz_surface_t *surface);
  
  glitz_status_t
--- 209,241 ----
                            glitz_filter_t filter,
                            glitz_fixed16_16_t *params,
!                           int n_params);  
  
  typedef enum {
!   GLITZ_COLOR_BUFFER_FRONT,
!   GLITZ_COLOR_BUFFER_BACK
! } glitz_color_buffer_t;
  
  void
! glitz_surface_set_read_color_buffer (glitz_surface_t *surface,
!                                      glitz_color_buffer_t buffer);
  
  void
! glitz_surface_set_draw_color_buffer (glitz_surface_t *surface,
!                                      glitz_color_buffer_t buffer);
    
  void
! glitz_surface_swap_buffers (glitz_surface_t *surface);
  
  void
  glitz_surface_flush (glitz_surface_t *surface);
  
  void
  glitz_surface_finish (glitz_surface_t *surface);
  
! int
! glitz_surface_get_width (glitz_surface_t *surface);
  
! int
! glitz_surface_get_height (glitz_surface_t *surface);
  
  glitz_status_t
***************
*** 361,371 ****
                                int height);
  
! #define GLITZ_HINT_CLIPPING_MASK     (1L << 0)
! #define GLITZ_HINT_OFFSCREEN_MASK    (1L << 1)
! #define GLITZ_HINT_MULTISAMPLE_MASK  (1L << 2)
  
! unsigned long
! glitz_surface_get_hints (glitz_surface_t *surface);
    
    
  /* glitz_pixel.c */
--- 264,342 ----
                                int height);
  
!   
! /* glitz_rect.c */
  
! void
! glitz_set_rectangle (glitz_surface_t *dst,
!                      const glitz_color_t *color,
!                      int x,
!                      int y,
!                      unsigned int width,
!                      unsigned int height);
!   
! void
! glitz_set_rectangles (glitz_surface_t *dst,
!                       const glitz_color_t *color,
!                       const glitz_rectangle_t *rects,
!                       int n_rects);
! 
! 
! /* glitz_buffer.c */
!   
! typedef enum {
!   GLITZ_BUFFER_HINT_STREAM_DRAW,
!   GLITZ_BUFFER_HINT_STREAM_READ,
!   GLITZ_BUFFER_HINT_STREAM_COPY,
!   GLITZ_BUFFER_HINT_STATIC_DRAW,
!   GLITZ_BUFFER_HINT_STATIC_READ,
!   GLITZ_BUFFER_HINT_STATIC_COPY,
!   GLITZ_BUFFER_HINT_DYNAMIC_DRAW,
!   GLITZ_BUFFER_HINT_DYNAMIC_READ,
!   GLITZ_BUFFER_HINT_DYNAMIC_COPY
! } glitz_buffer_hint_t;
! 
! typedef enum {
!   GLITZ_BUFFER_ACCESS_READ_ONLY,
!   GLITZ_BUFFER_ACCESS_WRITE_ONLY,
!   GLITZ_BUFFER_ACCESS_READ_WRITE
! } glitz_buffer_access_t;
! 
! glitz_buffer_t *
! glitz_geometry_buffer_create (glitz_surface_t *surface,
!                               void *data,
!                               unsigned int size,
!                               glitz_buffer_hint_t hint);
! 
! glitz_buffer_t *
! glitz_pixel_buffer_create (glitz_surface_t *surface,
!                            void *data,
!                            unsigned int size,
!                            glitz_buffer_hint_t hint);
!   
! void
! glitz_buffer_destroy (glitz_buffer_t *buffer);
! 
! void
! glitz_buffer_reference (glitz_buffer_t *buffer);
! 
! void
! glitz_buffer_set_data (glitz_buffer_t *buffer,
!                        int offset,
!                        unsigned int size,
!                        const void *data);
! 
! void
! glitz_buffer_get_data (glitz_buffer_t *buffer,
!                        int offset,
!                        unsigned int size,
!                        void *data);
!        
! void *
! glitz_buffer_map (glitz_buffer_t *buffer,
!                   glitz_buffer_access_t access);
    
+ glitz_status_t
+ glitz_buffer_unmap (glitz_buffer_t *buffer);
+ 
    
  /* glitz_pixel.c */
***************
*** 392,451 ****
  } glitz_pixel_format_t;
  
- typedef struct _glitz_pixel_buffer glitz_pixel_buffer_t;
- 
- typedef enum {
-   GLITZ_PIXEL_BUFFER_HINT_STREAM_DRAW,
-   GLITZ_PIXEL_BUFFER_HINT_STREAM_READ,
-   GLITZ_PIXEL_BUFFER_HINT_STREAM_COPY,
-   GLITZ_PIXEL_BUFFER_HINT_STATIC_DRAW,
-   GLITZ_PIXEL_BUFFER_HINT_STATIC_READ,
-   GLITZ_PIXEL_BUFFER_HINT_STATIC_COPY,
-   GLITZ_PIXEL_BUFFER_HINT_DYNAMIC_DRAW,
-   GLITZ_PIXEL_BUFFER_HINT_DYNAMIC_READ,
-   GLITZ_PIXEL_BUFFER_HINT_DYNAMIC_COPY
- } glitz_buffer_hint_t;
- 
- glitz_pixel_buffer_t *
- glitz_pixel_buffer_create (glitz_surface_t *surface,
-                            char *data,
-                            unsigned int size,
-                            glitz_buffer_hint_t hint);
-   
- glitz_pixel_buffer_t *
- glitz_pixel_buffer_create_for_data (char *data,
-                                     glitz_pixel_format_t *format);
- 
  void
! glitz_pixel_buffer_destroy (glitz_pixel_buffer_t *buffer);
! 
! void
! glitz_pixel_buffer_set_format (glitz_pixel_buffer_t *buffer,
!                                glitz_pixel_format_t *format);
! 
! void
! glitz_pixel_buffer_get_format (glitz_pixel_buffer_t *buffer,
!                                glitz_pixel_format_t *format);
! 
! typedef enum {
!   GLITZ_PIXEL_BUFFER_ACCESS_READ_ONLY,
!   GLITZ_PIXEL_BUFFER_ACCESS_WRITE_ONLY,
!   GLITZ_PIXEL_BUFFER_ACCESS_READ_WRITE
! } glitz_pixel_buffer_access_t;
! 
! char *
! glitz_pixel_buffer_get_data (glitz_pixel_buffer_t *buffer,
!                              glitz_pixel_buffer_access_t access);
!   
! void
! glitz_pixel_buffer_put_back_data (glitz_pixel_buffer_t *buffer);
! 
! void
! glitz_put_pixels (glitz_surface_t *dst,
                    int x_dst,
                    int y_dst,
                    int width,
                    int height,
!                   glitz_pixel_buffer_t *buffer);
!                   
  
  void
--- 363,374 ----
  } glitz_pixel_format_t;
  
  void
! glitz_set_pixels (glitz_surface_t *dst,
                    int x_dst,
                    int y_dst,
                    int width,
                    int height,
!                   glitz_pixel_format_t *format,
!                   glitz_buffer_t *buffer);                
  
  void
***************
*** 455,582 ****
                    int width,
                    int height,
!                   glitz_pixel_buffer_t *buffer);
!   
    
- /* glitz_rect.c */
- 
- void
- glitz_fill_rectangle (glitz_operator_t op,
-                       glitz_surface_t *dst,
-                       const glitz_color_t *color,
-                       int x,
-                       int y,
-                       unsigned int width,
-                       unsigned int height);
    
! void
! 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,
!                        int n_rects);
! 
! 
! /* glitz_trap.c */
! 
! void
! 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,
!                        int n_traps);
! 
! 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,
!                             glitz_surface_t *dst,
!                             int x_src,
!                             int y_src,
!                             int x_offset,
!                             int y_offset,
!                             unsigned short opacity,
!                             const glitz_trapezoid_t *traps,
!                             int n_traps);
! 
! void
! 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);
! 
  
! /* glitz_tri.c */
  
! void
! 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
! glitz_composite_triangles (glitz_operator_t op,
!                            glitz_surface_t *src,
!                            glitz_surface_t *dst,
!                            int x_src,
!                            int y_src,
!                            int x_offset,
!                            int y_offset,
!                            unsigned short opacity,
!                            const glitz_triangle_t *tris,
!                            int n_tris);
  
! void
! glitz_composite_tri_strip (glitz_operator_t op,
!                            glitz_surface_t *src,
!                            glitz_surface_t *dst,
!                            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,
!                          glitz_surface_t *dst,
!                          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_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);
    
  
--- 378,430 ----
                    int width,
                    int height,
!                   glitz_pixel_format_t *format,
!                   glitz_buffer_t *buffer);
    
    
! /* glitz_geometry.c */
  
! typedef enum {
!   GLITZ_GEOMETRY_MODE_DIRECT,
!   GLITZ_GEOMETRY_MODE_INDIRECT
! } glitz_geometry_mode_t;
  
! typedef enum {
!   GLITZ_GEOMETRY_EDGE_HINT_SHARP,
!   GLITZ_GEOMETRY_EDGE_HINT_FAST_SMOOTH,
!   GLITZ_GEOMETRY_EDGE_HINT_GOOD_SMOOTH,
!   GLITZ_GEOMETRY_EDGE_HINT_BEST_SMOOTH
! } glitz_geometry_edge_hint_t;
  
! typedef enum {
!   GLITZ_GEOMETRY_PRIMITIVE_TRIANGLES,
!   GLITZ_GEOMETRY_PRIMITIVE_TRIANGLE_STRIP,
!   GLITZ_GEOMETRY_PRIMITIVE_TRIANGLE_FAN,
!   GLITZ_GEOMETRY_PRIMITIVE_QUADS,
!   GLITZ_GEOMETRY_PRIMITIVE_QUAD_STRIP,
!   GLITZ_GEOMETRY_PRIMITIVE_POLYGON
! } glitz_geometry_primitive_t;
    
! typedef enum {
!   GLITZ_DATA_TYPE_SHORT,
!   GLITZ_DATA_TYPE_INT,
!   GLITZ_DATA_TYPE_FLOAT,
!   GLITZ_DATA_TYPE_DOUBLE
! } glitz_data_type_t;
  
! typedef struct _glitz_geometry_format {
!   glitz_geometry_mode_t mode;
!   glitz_geometry_edge_hint_t edge_hint;
!   glitz_geometry_primitive_t primitive;
!   glitz_data_type_t type;
!   int first;
!   unsigned int count;
! } glitz_geometry_format_t;
  
  void
! glitz_set_geometry (glitz_surface_t *dst,
!                     int x_dst,
!                     int y_dst,
!                     glitz_geometry_format_t *format,
!                     glitz_buffer_t *buffer);
    
  

Index: glitz_agl_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_context.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_agl_context.c	9 Aug 2004 22:57:35 -0000	1.7
--- glitz_agl_context.c	3 Sep 2004 14:27:58 -0000	1.8
***************
*** 32,35 ****
--- 32,37 ----
  #include "glitz_aglint.h"
  
+ extern glitz_gl_proc_address_list_t _glitz_agl_gl_proc_address;
+ 
  static void
  _glitz_agl_context_create (glitz_agl_thread_info_t *thread_info,
***************
*** 72,75 ****
--- 74,90 ----
                               context);
    context->offscreen = offscreen;
+ 
+   glitz_agl_surface_backend_init (&context->backend);
+ 
+   memcpy (&context->backend.gl,
+           &_glitz_agl_gl_proc_address,
+           sizeof (glitz_gl_proc_address_list_t));
+   
+   context->backend.formats = thread_info->formats;
+   context->backend.n_formats = thread_info->n_formats;
+   context->backend.program_map = &thread_info->program_map;
+   context->backend.feature_mask = thread_info->feature_mask;
+ 
+   context->backend.gl.need_lookup = 0;
    
    return context;

Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_extension.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_agl_extension.c	18 Aug 2004 12:30:24 -0000	1.6
--- glitz_agl_extension.c	3 Sep 2004 14:27:58 -0000	1.7
***************
*** 51,57 ****
      GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_HINT_MASK },
    { "GL_ARB_multitexture", GLITZ_AGL_FEATURE_MULTITEXTURE_MASK },
-   { "GL_ARB_vertex_program", GLITZ_AGL_FEATURE_VERTEX_PROGRAM_MASK },
    { "GL_ARB_fragment_program", GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK },
!   { "GL_EXT_pixel_buffer_object", GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
    { NULL, 0 }
  };
--- 51,61 ----
      GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_HINT_MASK },
    { "GL_ARB_multitexture", GLITZ_AGL_FEATURE_MULTITEXTURE_MASK },
    { "GL_ARB_fragment_program", GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK },
!   /* TODO: lookup all symbols not part of OpenGL 1.1
!      { "GL_ARB_vertex_buffer_object",
!      GLITZ_AGL_FEATURE_VERTEX_BUFFER_OBJECT_MASK },
!      { "GL_EXT_pixel_buffer_object",
!      GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
!   */
    { NULL, 0 }
  };
***************
*** 77,83 ****
    thread_info->texture_mask = GLITZ_TEXTURE_TARGET_2D_MASK;
  
-   if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_PBUFFER_MASK)
-     thread_info->feature_mask |= GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
- 
    if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK) {
      thread_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
--- 81,84 ----
***************
*** 134,144 ****
      }
      
-     if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_VERTEX_PROGRAM_MASK)
-       thread_info->feature_mask |= GLITZ_FEATURE_VERTEX_PROGRAM_MASK;
-     
      if (thread_info->agl_feature_mask &
          GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK)
        thread_info->feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
    }
    
    if (thread_info->agl_feature_mask &
--- 135,146 ----
      }
      
      if (thread_info->agl_feature_mask &
          GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK)
        thread_info->feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
    }
+ 
+   if (thread_info->agl_feature_mask &
+       GLITZ_AGL_FEATURE_VERTEX_BUFFER_OBJECT_MASK)
+     thread_info->feature_mask |= GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK;
    
    if (thread_info->agl_feature_mask &

Index: glitz_agl_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_format.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_agl_format.c	18 Aug 2004 12:30:24 -0000	1.6
--- glitz_agl_format.c	3 Sep 2004 14:27:58 -0000	1.7
***************
*** 296,300 ****
  
      format.read.onscreen = format.draw.onscreen = 1;
!     if (thread_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK)
        format.read.offscreen = format.draw.offscreen = 1;
      else
--- 296,300 ----
  
      format.read.onscreen = format.draw.onscreen = 1;
!     if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_PBUFFER_MASK)
        format.read.offscreen = format.draw.offscreen = 1;
      else

Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_info.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glitz_agl_info.c	18 Aug 2004 12:30:24 -0000	1.9
--- glitz_agl_info.c	3 Sep 2004 14:27:58 -0000	1.10
***************
*** 37,49 ****
    (glitz_gl_enable_t) glEnable,
    (glitz_gl_disable_t) glDisable,
!   (glitz_gl_begin_t) glBegin,
!   (glitz_gl_end_t) glEnd,
!   (glitz_gl_vertex_2i_t) glVertex2i,
!   (glitz_gl_vertex_2d_t) glVertex2d,
    (glitz_gl_tex_env_f_t) glTexEnvf,
    (glitz_gl_tex_env_fv_t) glTexEnvfv,
!   (glitz_gl_tex_coord_2d_t) glTexCoord2d,
    (glitz_gl_color_4us_t) glColor4us,
!   (glitz_gl_color_4d_t) glColor4d,
    (glitz_gl_scissor_t) glScissor,
    (glitz_gl_blend_func_t) glBlendFunc,
--- 37,50 ----
    (glitz_gl_enable_t) glEnable,
    (glitz_gl_disable_t) glDisable,
!   (glitz_gl_enable_client_state_t) glEnableClientState,
!   (glitz_gl_disable_client_state_t) glDisableClientState,
!   (glitz_gl_vertex_pointer_t) glVertexPointer,
!   (glitz_gl_draw_arrays_t) glDrawArrays,
    (glitz_gl_tex_env_f_t) glTexEnvf,
    (glitz_gl_tex_env_fv_t) glTexEnvfv,
!   (glitz_gl_tex_gen_i_t) glTexGeni,
!   (glitz_gl_tex_gen_fv_t) glTexGenfv,
    (glitz_gl_color_4us_t) glColor4us,
!   (glitz_gl_color_4f_t) glColor4f,
    (glitz_gl_scissor_t) glScissor,
    (glitz_gl_blend_func_t) glBlendFunc,
***************
*** 59,67 ****
    (glitz_gl_pop_matrix_t) glPopMatrix,
    (glitz_gl_load_identity_t) glLoadIdentity,
!   (glitz_gl_load_matrix_d_t) glLoadMatrixd,
!   (glitz_gl_mult_matrix_d_t) glMultMatrixd,
    (glitz_gl_depth_range_t) glDepthRange,
    (glitz_gl_viewport_t) glViewport,
!   (glitz_gl_raster_pos_2d_t) glRasterPos2d,
    (glitz_gl_bitmap_t) glBitmap,
    (glitz_gl_read_buffer_t) glReadBuffer,
--- 60,67 ----
    (glitz_gl_pop_matrix_t) glPopMatrix,
    (glitz_gl_load_identity_t) glLoadIdentity,
!   (glitz_gl_load_matrix_f_t) glLoadMatrixf,
    (glitz_gl_depth_range_t) glDepthRange,
    (glitz_gl_viewport_t) glViewport,
!   (glitz_gl_raster_pos_2f_t) glRasterPos2f,
    (glitz_gl_bitmap_t) glBitmap,
    (glitz_gl_read_buffer_t) glReadBuffer,
***************
*** 72,77 ****
    (glitz_gl_pixel_store_i_t) glPixelStorei,
    (glitz_gl_ortho_t) glOrtho,
!   (glitz_gl_scale_d_t) glScaled,
!   (glitz_gl_translate_d_t) glTranslated,
    (glitz_gl_hint_t) glHint,
    (glitz_gl_depth_mask_t) glDepthMask,
--- 72,77 ----
    (glitz_gl_pixel_store_i_t) glPixelStorei,
    (glitz_gl_ortho_t) glOrtho,
!   (glitz_gl_scale_f_t) glScalef,
!   (glitz_gl_translate_f_t) glTranslatef,
    (glitz_gl_hint_t) glHint,
    (glitz_gl_depth_mask_t) glDepthMask,
***************
*** 85,89 ****
    (glitz_gl_delete_textures_t) glDeleteTextures,
    (glitz_gl_bind_texture_t) glBindTexture,
-   (glitz_gl_tex_image_1d_t) glTexImage1D,
    (glitz_gl_tex_image_2d_t) glTexImage2D,
    (glitz_gl_tex_parameter_i_t) glTexParameteri,
--- 85,88 ----
***************
*** 93,109 ****
    
    (glitz_gl_active_texture_t) glActiveTextureARB,
-   (glitz_gl_multi_tex_coord_2d_t) glMultiTexCoord2dARB,
    (glitz_gl_gen_programs_t) glGenProgramsARB,
    (glitz_gl_delete_programs_t) glDeleteProgramsARB,
    (glitz_gl_program_string_t) glProgramStringARB,
    (glitz_gl_bind_program_t) glBindProgramARB,
!   (glitz_gl_program_local_param_4d_t) glProgramLocalParameter4dARB,
    (glitz_gl_get_program_iv_t) glGetProgramivARB,
    (glitz_gl_gen_buffers_t) 0,
    (glitz_gl_delete_buffers_t) 0,
    (glitz_gl_bind_buffer_t) 0,
    (glitz_gl_buffer_data_t) 0,
    (glitz_gl_map_buffer_t) 0,
    (glitz_gl_unmap_buffer_t) 0,
    0
  };
--- 92,112 ----
    
    (glitz_gl_active_texture_t) glActiveTextureARB,
    (glitz_gl_gen_programs_t) glGenProgramsARB,
    (glitz_gl_delete_programs_t) glDeleteProgramsARB,
    (glitz_gl_program_string_t) glProgramStringARB,
    (glitz_gl_bind_program_t) glBindProgramARB,
!   (glitz_gl_program_local_param_4fv_t) glProgramLocalParameter4fvARB,
    (glitz_gl_get_program_iv_t) glGetProgramivARB,
+ 
+   /* TODO: lookup all symbols not part of OpenGL 1.1 */
    (glitz_gl_gen_buffers_t) 0,
    (glitz_gl_delete_buffers_t) 0,
    (glitz_gl_bind_buffer_t) 0,
    (glitz_gl_buffer_data_t) 0,
+   (glitz_gl_buffer_sub_data_t) 0,
+   (glitz_gl_get_buffer_sub_data_t) 0,
    (glitz_gl_map_buffer_t) 0,
    (glitz_gl_unmap_buffer_t) 0,
+   
    0
  };
***************
*** 236,239 ****
--- 239,255 ----
    }
  
+   glitz_agl_surface_backend_init (&thread_info->root_context.backend);
+ 
+   memcpy (&thread_info->root_context.backend.gl,
+           &_glitz_agl_gl_proc_address,
+           sizeof (glitz_gl_proc_address_list_t));
+   
+   thread_info->root_context.backend.formats = thread_info->formats;
+   thread_info->root_context.backend.n_formats = thread_info->n_formats;
+   thread_info->root_context.backend.program_map = &thread_info->program_map;
+   thread_info->root_context.backend.feature_mask = thread_info->feature_mask;
+ 
+   thread_info->root_context.backend.gl.need_lookup = 0;
+ 
    thread_info->context_stack_size = 1;
    thread_info->context_stack->surface = NULL;

Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** glitz_agl_surface.c	18 Aug 2004 12:30:24 -0000	1.15
--- glitz_agl_surface.c	3 Sep 2004 14:27:58 -0000	1.16
***************
*** 32,56 ****
  #include "glitz_aglint.h"
  
- extern glitz_gl_proc_address_list_t _glitz_agl_gl_proc_address;
- 
- static glitz_surface_t *
- _glitz_agl_surface_create_similar (void *abstract_templ,
-                                    glitz_format_t *format,
-                                    int width,
-                                    int height);
- 
- static void
- _glitz_agl_surface_destroy (void *abstract_surface);
- 
- static glitz_texture_t *
- _glitz_agl_surface_get_texture (void *abstract_surface,
-                                 glitz_bool_t allocate);
- 
- static void
- _glitz_agl_surface_update_size (void *abstract_surface);
- 
- static void
- _glitz_agl_surface_swap_buffers (void *abstract_surface);
- 
  static glitz_bool_t
  _glitz_agl_surface_push_current (void *abstract_surface,
--- 32,35 ----
***************
*** 97,111 ****
  }
  
- static const struct glitz_surface_backend glitz_agl_surface_backend = {
-   _glitz_agl_surface_create_similar,
-   _glitz_agl_surface_destroy,
-   _glitz_agl_surface_push_current,
-   _glitz_agl_surface_pop_current,
-   _glitz_agl_surface_get_texture,
-   _glitz_agl_surface_update_size,
-   _glitz_agl_surface_swap_buffers,
-   _glitz_agl_surface_make_current_read
- };
- 
  static glitz_texture_t *
  _glitz_agl_surface_get_texture (void *abstract_surface,
--- 76,79 ----
***************
*** 113,117 ****
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
  
!   if (surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK) {
      glitz_bounding_box_t copy_box;
  
--- 81,85 ----
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
  
!   if (surface->base.flags & GLITZ_FLAG_DIRTY_MASK) {
      glitz_bounding_box_t copy_box;
  
***************
*** 123,127 ****
  
      if (!surface->base.texture.allocated)
!       glitz_texture_allocate (surface->base.gl, &surface->base.texture);  
        
      glitz_texture_copy_surface (&surface->base.texture, &surface->base,
--- 91,96 ----
  
      if (!surface->base.texture.allocated)
!       glitz_texture_allocate (&surface->base.backend->gl,
!                               &surface->base.texture);  
        
      glitz_texture_copy_surface (&surface->base.texture, &surface->base,
***************
*** 132,141 ****
                                  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);
    }
    
--- 101,112 ----
                                  copy_box.x1,
                                  copy_box.y1);
!     
!     surface->base.flags &= ~GLITZ_FLAG_DIRTY_MASK;
    }
  
    if (allocate) {
      if (!surface->base.texture.allocated)
!       glitz_texture_allocate (&surface->base.backend->gl,
!                               &surface->base.texture);
    }
    
***************
*** 147,153 ****
  
  static void
! _glitz_agl_surface_update_size_for_window (WindowRef window,
!                                            int *width,
!                                            int *height)
  {
    Rect window_bounds;
--- 118,124 ----
  
  static void
! _glitz_agl_surface_get_window_size (WindowRef window,
!                                     int *width,
!                                     int *height)
  {
    Rect window_bounds;
***************
*** 159,168 ****
  }
  
- static void
- _glitz_agl_set_features (glitz_agl_surface_t *surface)
- {
-   surface->base.feature_mask = surface->thread_info->feature_mask;
- }
- 
  static glitz_surface_t *
  _glitz_agl_surface_create (glitz_agl_thread_info_t *thread_info,
--- 130,133 ----
***************
*** 194,205 ****
  
    glitz_surface_init (&surface->base,
!                       &glitz_agl_surface_backend,
!                       &_glitz_agl_gl_proc_address,
                        format,
-                       thread_info->formats,
-                       thread_info->n_formats,
                        width,
                        height,
-                       &thread_info->program_map,
                        texture_mask);
    
--- 159,166 ----
  
    glitz_surface_init (&surface->base,
!                       &context->backend,
                        format,
                        width,
                        height,
                        texture_mask);
    
***************
*** 207,216 ****
    surface->context = context;
  
!   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);
  
    return &surface->base;
--- 168,175 ----
    surface->context = context;
  
!   surface->base.flags |= GLITZ_FLAG_OFFSCREEN_MASK;
  
    if (format->draw.offscreen)
!     surface->base.flags |= GLITZ_FLAG_DRAWABLE_MASK;
  
    return &surface->base;
***************
*** 240,244 ****
      return NULL;
  
!   _glitz_agl_surface_update_size_for_window (window, &width, &height);
  
    surface = (glitz_agl_surface_t *) calloc (1, sizeof (glitz_agl_surface_t));
--- 199,203 ----
      return NULL;
  
!   _glitz_agl_surface_get_window_size (window, &width, &height);
  
    surface = (glitz_agl_surface_t *) calloc (1, sizeof (glitz_agl_surface_t));
***************
*** 247,258 ****
  
    glitz_surface_init (&surface->base,
!                       &glitz_agl_surface_backend,
!                       &_glitz_agl_gl_proc_address,
                        format,
-                       thread_info->formats,
-                       thread_info->n_formats,
                        width,
                        height,
-                       &thread_info->program_map,
                        thread_info->texture_mask);
    
--- 206,213 ----
  
    glitz_surface_init (&surface->base,
!                       &context->backend,
                        format,
                        width,
                        height,
                        thread_info->texture_mask);
    
***************
*** 262,268 ****
    surface->drawable = GetWindowPort (window);
  
!   surface->base.hint_mask |= GLITZ_INT_HINT_DRAWABLE_MASK;
! 
!   _glitz_agl_set_features (surface);
    
    return &surface->base;
--- 217,221 ----
    surface->drawable = GetWindowPort (window);
  
!   surface->base.flags |= GLITZ_FLAG_DRAWABLE_MASK;
    
    return &surface->base;
***************
*** 317,359 ****
  
  static void
- _glitz_agl_surface_update_size (void *abstract_surface)
- {
-   glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
-   
-   if (surface->window) {
-     int width, height;
-     
-     _glitz_agl_surface_update_size_for_window (surface->window,
-                                                &width, &height);
- 
-     if (width != surface->base.width || height != surface->base.height) {
-       glitz_texture_t texture;
- 
-       glitz_texture_init (&texture,
-                           width, height,
-                           surface->base.texture.format,
-                           surface->thread_info->texture_mask);
-       
-       if (texture.width != surface->base.texture.width ||
-           texture.height != surface->base.texture.height ||
-           texture.target != surface->base.texture.target) {
-         texture.name = surface->base.texture.name;
-         surface->base.texture = texture;
-       }
-       
-       surface->base.width = width;
-       surface->base.height = height;
-     
-       glitz_agl_context_push_current (surface,
-                                       GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
-     
-       aglUpdateContext (surface->context->context);
-     
-       glitz_agl_context_pop_current (surface);
-     }
-   }
- }
- 
- static void
  _glitz_agl_surface_swap_buffers (void *abstract_surface)
  {
--- 270,273 ----
***************
*** 366,367 ****
--- 280,293 ----
    glitz_agl_context_pop_current (surface);
  }
+ 
+ void
+ glitz_agl_surface_backend_init (glitz_surface_backend_t *backend)
+ {
+   backend->create_similar = _glitz_agl_surface_create_similar;
+   backend->destroy = _glitz_agl_surface_destroy;
+   backend->push_current = _glitz_agl_surface_push_current;
+   backend->pop_current = _glitz_agl_surface_pop_current;
+   backend->get_texture = _glitz_agl_surface_get_texture;
+   backend->swap_buffers = _glitz_agl_surface_swap_buffers;
+   backend->make_current_read = _glitz_agl_surface_make_current_read;
+ }

Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glitz_aglint.h	18 Aug 2004 12:30:24 -0000	1.9
--- glitz_aglint.h	3 Sep 2004 14:27:58 -0000	1.10
***************
*** 47,52 ****
  #define GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK      (1L <<  8)
  #define GLITZ_AGL_FEATURE_TEXTURE_ENV_DOT3_MASK         (1L <<  9)
! #define GLITZ_AGL_FEATURE_VERTEX_PROGRAM_MASK           (1L << 10)
! #define GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 11)
  #define GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 12)
  
--- 47,52 ----
  #define GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK      (1L <<  8)
  #define GLITZ_AGL_FEATURE_TEXTURE_ENV_DOT3_MASK         (1L <<  9)
! #define GLITZ_AGL_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 10)
! #define GLITZ_AGL_FEATURE_VERTEX_BUFFER_OBJECT_MASK     (1L << 11)
  #define GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 12)
  
***************
*** 62,65 ****
--- 62,66 ----
    AGLPixelFormat pixel_format;
    glitz_bool_t offscreen;
+   glitz_surface_backend_t backend;
  } glitz_agl_context_t;
  
***************
*** 77,83 ****
    glitz_agl_context_t root_context;
  
!   long int feature_mask;
!   long int agl_feature_mask;
!   long int texture_mask;
  
    glitz_program_map_t program_map;
--- 78,84 ----
    glitz_agl_context_t root_context;
  
!   unsigned long feature_mask;
!   unsigned long agl_feature_mask;
!   unsigned long texture_mask;
  
    glitz_program_map_t program_map;
***************
*** 130,133 ****
--- 131,137 ----
  glitz_agl_pbuffer_destroy (AGLPbuffer pbuffer);
  
+ extern void __internal_linkage
+ glitz_agl_surface_backend_init (glitz_surface_backend_t *backend);
+ 
  
  /* Avoid unnecessary PLT entries.  */

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

Index: glitz_compose.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_compose.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_compose.c	18 Aug 2004 12:30:24 -0000	1.2
--- glitz_compose.c	3 Sep 2004 14:27:58 -0000	1.3
***************
*** 126,134 ****
      
    if (op->alpha_mask.red) {
!     op->gl->color_4d (1.0, 0.5, 0.5, 0.5);
    } else if (op->alpha_mask.green) {
!     op->gl->color_4d (0.5, 1.0, 0.5, 0.5);
    } else if (op->alpha_mask.blue) {
!     op->gl->color_4d (0.5, 0.5, 1.0, 0.5);
    } else {
      op->gl->active_texture (GLITZ_GL_TEXTURE0);
--- 126,134 ----
      
    if (op->alpha_mask.red) {
!     op->gl->color_4f (1.0f, 0.5f, 0.5f, 0.5f);
    } else if (op->alpha_mask.green) {
!     op->gl->color_4f (0.5f, 1.0f, 0.5f, 0.5f);
    } else if (op->alpha_mask.blue) {
!     op->gl->color_4f (0.5f, 0.5f, 1.0f, 0.5f);
    } else {
      op->gl->active_texture (GLITZ_GL_TEXTURE0);
***************
*** 306,313 ****
                         GLITZ_GL_SRC_ALPHA);
  
!     color[0] = (double) op->solid->red / 65536.0;
!     color[1] = (double) op->solid->green / 65536.0;
!     color[2] = (double) op->solid->blue / 65536.0;
!     color[3] = (double) op->solid->alpha / 65536.0;
      
      op->gl->tex_env_fv (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_COLOR,
--- 306,313 ----
                         GLITZ_GL_SRC_ALPHA);
  
!     color[0] = op->solid->red / 65536.0f;
!     color[1] = op->solid->green / 65536.0f;
!     color[2] = op->solid->blue / 65536.0f;
!     color[3] = op->solid->alpha / 65536.0f;
      
      op->gl->tex_env_fv (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_COLOR,
***************
*** 316,326 ****
      
    if (op->alpha_mask.red) {
!     op->gl->color_4d (1.0, 0.5, 0.5, 0.5);
    } else if (op->alpha_mask.green) {
!     op->gl->color_4d (0.5, 1.0, 0.5, 0.5);
    } else if (op->alpha_mask.blue) {
!     op->gl->color_4d (0.5, 0.5, 1.0, 0.5);
    } else {
!     static glitz_gl_float_t color[] = { 0.0, 0.0, 0.0, 0.0 };
      
      op->gl->active_texture (GLITZ_GL_TEXTURE0);
--- 316,326 ----
      
    if (op->alpha_mask.red) {
!     op->gl->color_4f (1.0f, 0.5f, 0.5f, 0.5f);
    } else if (op->alpha_mask.green) {
!     op->gl->color_4f (0.5f, 1.0f, 0.5f, 0.5f);
    } else if (op->alpha_mask.blue) {
!     op->gl->color_4f (0.5f, 0.5f, 1.0f, 0.5f);
    } else {
!     static glitz_gl_float_t color[] = { 0.0f, 0.0f, 0.0f, 0.0f };
      
      op->gl->active_texture (GLITZ_GL_TEXTURE0);
***************
*** 418,428 ****
      ) \
     : \
!    (SURFACE_CLIP (surface) || \
!     (SURFACE_PAD (surface)? \
!      ((surface)->texture.repeatable || \
!       (surface)->texture.target != GLITZ_GL_TEXTURE_2D) \
!      : \
!      ((feature_mask) & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
!      ) \
      ) \
     )
--- 418,426 ----
      ) \
     : \
!    (SURFACE_PAD (surface)? \
!     ((surface)->texture.repeatable || \
!      (surface)->texture.target != GLITZ_GL_TEXTURE_2D) \
!     : \
!     ((feature_mask) & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
      ) \
     )
***************
*** 478,482 ****
    op->combine = NULL;
    op->alpha_mask = _default_alpha_mask;
!   op->gl = dst->gl;
    op->src = src;
    op->mask = mask;
--- 476,480 ----
    op->combine = NULL;
    op->alpha_mask = _default_alpha_mask;
!   op->gl = &dst->backend->gl;
    op->src = src;
    op->mask = mask;
***************
*** 485,495 ****
    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;
--- 483,496 ----
    op->solid = NULL;
    op->component_alpha = GLITZ_COMPONENT_ALPHA_NONE;
!   op->fp = 0;
! 
!   if (dst->indirect && (dst->format->stencil_size < 1))
!     return;
    
!   src_type = _glitz_get_surface_type (src, dst->backend->feature_mask);
    if (src_type < 1)
      return;
  
!   mask_type = _glitz_get_surface_type (mask, dst->backend->feature_mask);
    if (mask_type < 0)
      return;
***************
*** 497,502 ****
    combine = &_glitz_combine_map[src_type][mask_type];
    if (combine->type == GLITZ_COMBINE_TYPE_NA) {
!     if (dst->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK)
!       op->type = GLITZ_COMBINE_TYPE_INTERMEDIATE;
      
      return;
--- 498,502 ----
    combine = &_glitz_combine_map[src_type][mask_type];
    if (combine->type == GLITZ_COMBINE_TYPE_NA) {
!     op->type = GLITZ_COMBINE_TYPE_INTERMEDIATE;
      
      return;
***************
*** 523,527 ****
      }
    } else if (mask_type != GLITZ_SURFACE_TYPE_NULL) {
!     if (dst->feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK) {
        if (mask_type == GLITZ_SURFACE_TYPE_ARGBC) {
          if (mask->format->alpha_size)
--- 523,527 ----
      }
    } else if (mask_type != GLITZ_SURFACE_TYPE_NULL) {
!     if (dst->backend->feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK) {
        if (mask_type == GLITZ_SURFACE_TYPE_ARGBC) {
          if (mask->format->alpha_size)
***************
*** 532,557 ****
        
        if (op->src) {
!         if (dst->feature_mask & GLITZ_FEATURE_MULTITEXTURE_MASK) {
            op->combine = combine;
!         } else if ((dst->feature_mask &
!                     GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK) &&
!                    (!op->component_alpha))
            op->type = GLITZ_COMBINE_TYPE_INTERMEDIATE; 
        } else
          op->combine = combine;
      }
!   } else {
!     if (SURFACE_POLYGON_OP (dst))
!       op->alpha_mask.alpha = dst->polyopacity;
!       
      op->combine = combine;
-   }
    
    if (op->combine == combine) {
      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;
      }
--- 532,550 ----
        
        if (op->src) {
!         if (dst->backend->feature_mask & GLITZ_FEATURE_MULTITEXTURE_MASK) {
            op->combine = combine;
!         } else if (!op->component_alpha)
            op->type = GLITZ_COMBINE_TYPE_INTERMEDIATE; 
        } else
          op->combine = combine;
      }
!   } else
      op->combine = combine;
    
    if (op->combine == combine) {
      op->type = combine->type;
      if (combine->fragment_processing) {
        op->fp = glitz_filter_get_fragment_program (src, op);
!       if (op->fp == 0)
          op->type = GLITZ_COMBINE_TYPE_NA;
      }
***************
*** 569,579 ****
  glitz_composite_disable (glitz_composite_op_t *op)
  {
!   if (op->vp) {
      op->gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
      op->gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
    }
-   if (op->fp) {
-     op->gl->bind_program (GLITZ_GL_VERTEX_PROGRAM, 0);
-     op->gl->disable (GLITZ_GL_VERTEX_PROGRAM);
-   }
  }
--- 562,568 ----
  glitz_composite_disable (glitz_composite_op_t *op)
  {
!   if (op->fp) {
      op->gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, 0);
      op->gl->disable (GLITZ_GL_FRAGMENT_PROGRAM);
    }
  }

Index: glitz_filter.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_filter.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_filter.c	18 Aug 2004 12:30:24 -0000	1.2
--- glitz_filter.c	3 Sep 2004 14:27:58 -0000	1.3
***************
*** 32,54 ****
  #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;
--- 32,38 ----
  #include <math.h>
  
  struct _glitz_filter_params_t {
    int fp_type;
!   int id;  
    glitz_vec4_t *vectors;
    int n_vectors;
***************
*** 79,89 ****
  
  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)--;
--- 63,73 ----
  
  static void
! _glitz_filter_params_set (glitz_float_t *value,
!                           const glitz_float_t default_value,
                            glitz_fixed16_16_t **params,
                            int *n_params)
  {
    if (*n_params > 0) {
!     *value = FIXED_TO_FLOAT (**params);
      (*params)++;
      (*n_params)--;
***************
*** 116,124 ****
    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;
--- 100,108 ----
    switch (filter) {
    case GLITZ_FILTER_CONVOLUTION: {
!     glitz_float_t dm, dn, sum, tx, ty;
      int cx, cy, m, n, j;
      
!     _glitz_filter_params_set (&dm, 3.0f, &params, &n_params);
!     _glitz_filter_params_set (&dn, 3.0f, &params, &n_params);
      m = dm;
      n = dn;
***************
*** 139,154 ****
      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;
          }
--- 123,139 ----
      ty = surface->texture.texcoord_height / surface->texture.height;
  
!     sum = 0.0f;
      for (i = 0; i < m; i++) {
        glitz_vec4_t *vec;
!       glitz_float_t weight;
        
        for (j = 0; j < n; j++) {
!         _glitz_filter_params_set (&weight, 0.0f, &params, &n_params);
!         if (weight != 0.0f) {
            vec = &vecs[surface->filter_params->id++];
            vec->v[0] = (i - cx) * tx;
            vec->v[1] = (cy - j) * ty;
            vec->v[2] = weight;
+           vec->v[3] = 0.0f;
            sum += weight;
          }
***************
*** 157,162 ****
  
      /* normalize */
!     if (sum != 0.0)
!       sum = 1.0 / sum;
      
      for (i = 0; i < surface->filter_params->id; i++)
--- 142,147 ----
  
      /* normalize */
!     if (sum != 0.0f)
!       sum = 1.0f / sum;
      
      for (i = 0; i < surface->filter_params->id; i++)
***************
*** 165,182 ****
    } 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)
--- 150,167 ----
    } break;
    case GLITZ_FILTER_GAUSSIAN: {
!     glitz_float_t radius, sigma, alpha, scale, xy_scale, sum, tx, ty;
      int half_size, x, y;
      
!     _glitz_filter_params_set (&radius, 1.0f, &params, &n_params);
!     glitz_clamp_value (&radius, 0.0f, 1024.0f);
  
!     _glitz_filter_params_set (&sigma, radius / 2.0f, &params, &n_params);
!     glitz_clamp_value (&sigma, 0.0f, 1024.0f);
      
      _glitz_filter_params_set (&alpha, radius, &params, &n_params);
!     glitz_clamp_value (&alpha, 0.0f, 1024.0f);
  
!     scale = 1.0f / (2.0f * GLITZ_PI * sigma * sigma);
!     half_size = alpha + 0.5f;
  
      if (half_size == 0)
***************
*** 184,189 ****
      
      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;
--- 169,174 ----
      
      size = half_size * 2 + 1;
!     xy_scale = 2.0f * radius / size;
! 
      if (_glitz_filter_params_ensure (&surface->filter_params, size * size))
        return GLITZ_STATUS_NO_MEMORY;
***************
*** 196,204 ****
      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);
--- 181,188 ----
      ty = surface->texture.texcoord_height / surface->texture.height;
  
!     sum = 0.0f;
      for (x = 0; x < size; x++) {
        glitz_vec4_t *vec;
!       glitz_float_t fx, fy, amp;
        
        fx = xy_scale * (x - half_size);
***************
*** 207,218 ****
          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;
          }
--- 191,203 ----
          fy = xy_scale * (y - half_size);
  
!         amp = scale * exp ((-1.0f * (fx * fx + fy * fy)) /
!                            (2.0f * sigma * sigma));
  
!         if (amp > 0.0f) {
            vec = &vecs[surface->filter_params->id++];
            vec->v[0] = fx * tx;
            vec->v[1] = fy * ty;
            vec->v[2] = amp;
+           vec->v[3] = 0.0f;
            sum += amp;
          }
***************
*** 221,226 ****
  
      /* normalize */
!     if (sum != 0.0)
!       sum = 1.0 / sum;
      
      for (i = 0; i < surface->filter_params->id; i++)
--- 206,211 ----
  
      /* normalize */
!     if (sum != 0.0f)
!       sum = 1.0f / sum;
      
      for (i = 0; i < surface->filter_params->id; i++)
***************
*** 240,284 ****
        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);
--- 225,282 ----
        size = 2;
  
!     if (_glitz_filter_params_ensure (&surface->filter_params, size + 1))
        return GLITZ_STATUS_NO_MEMORY;
+ 
+     vecs = surface->filter_params->vectors;
      
      if (filter == GLITZ_FILTER_LINEAR_GRADIENT) {
!       glitz_float_t length, angle, dh, dv;
!       glitz_point_t start, stop;
! 
!       _glitz_filter_params_set (&start.x, 0.0f, &params, &n_params);
!       _glitz_filter_params_set (&start.y, 0.0f, &params, &n_params);
!       _glitz_filter_params_set (&stop.x, 1.0f, &params, &n_params);
!       _glitz_filter_params_set (&stop.y, 0.0f, &params, &n_params);
! 
!       dh = stop.x - start.x;
!       dv = stop.y - start.y;
! 
!       length = sqrt (dh * dh + dv * dv);
! 
!       angle = -atan2 (dv, dh);
! 
!       vecs->v[2] = cos (angle);
!       vecs->v[3] = -sin (angle);
        
!       vecs->v[0] = vecs->v[2] * start.x;
!       vecs->v[0] += vecs->v[3] * start.y;
  
!       vecs->v[1] = (length)? 1.0f / length: 2147483647.0f;
!     } else {
!       glitz_float_t r0, r1;
!       
!       _glitz_filter_params_set (&vecs->v[0], 0.5f, &params, &n_params);
!       _glitz_filter_params_set (&vecs->v[1], 0.5f, &params, &n_params);
!       _glitz_filter_params_set (&r0, 0.0f, &params, &n_params);
!       _glitz_filter_params_set (&r1, 0.5f, &params, &n_params);
!       
!       glitz_clamp_value (&r0, 0.0f, r1);
!       
!       vecs->v[2] = r0;
        if (r1 != r0)
!         vecs->v[3] = 1.0f / (r1 - r0);
        else
!         vecs->v[3] = 2147483647.0f;
      }
  
!     vecs++;
      surface->filter_params->id = size;
      
      for (i = 0; i < size; i++) {
!       glitz_float_t x_default, y_default, o_default;
        
!       o_default = i / (glitz_float_t) (size - 1);
!       x_default = 0.5f + (surface->width * i) / (glitz_float_t) size;
!       y_default = 0.5f + (surface->height * i) / (glitz_float_t) size;
        
        _glitz_filter_params_set (&vecs[i].v[2], o_default, &params, &n_params);
***************
*** 286,296 ****
        _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];
--- 284,293 ----
        _glitz_filter_params_set (&vecs[i].v[1], y_default, &params, &n_params);
  
!       glitz_clamp_value (&vecs[i].v[2], 0.0f, 1.0f);
!       glitz_clamp_value (&vecs[i].v[0], 0.5f, surface->width - 0.5f);
!       glitz_clamp_value (&vecs[i].v[1], 0.5f, surface->height - 0.5f);
! 
!       vecs[i].v[0] *= surface->texture.texcoord_width_unit;
!       vecs[i].v[1] *= surface->texture.texcoord_height_unit;
        
        vecs[i].v[1] = surface->texture.texcoord_height - vecs[i].v[1];
***************
*** 300,317 ****
      /* 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;
--- 297,314 ----
      /* 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++) {
!       glitz_float_t diff;
  
        if ((i + 1) == size)
!         diff = 1.0f - vecs[i].v[2];
        else
          diff = vecs[i + 1].v[2] - vecs[i].v[2];
        
!       if (diff != 0.0f)
!         vecs[i].v[3] = 1.0f / diff;
        else
!         vecs[i].v[3] = 2147483647.0f; /* should be FLT_MAX, but this will do */
      }
      break;
***************
*** 336,346 ****
  
  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)
--- 333,336 ----
***************
*** 361,365 ****
      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;
--- 351,355 ----
      break;
    case GLITZ_FILTER_LINEAR_GRADIENT:
!     if (surface->flags & GLITZ_FLAG_REPEAT_MASK) {
        if (SURFACE_MIRRORED (surface))
          surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REFLECT;
***************
*** 372,376 ****
      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;
--- 362,366 ----
      break;
    case GLITZ_FILTER_RADIAL_GRADIENT:
!     if (surface->flags & GLITZ_FLAG_REPEAT_MASK) {
        if (SURFACE_MIRRORED (surface))
          surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REFLECT;
***************
*** 395,401 ****
    int i;
  
-   gl->enable (GLITZ_GL_VERTEX_PROGRAM);
-   gl->bind_program (GLITZ_GL_VERTEX_PROGRAM, op->vp);
-   
    gl->enable (GLITZ_GL_FRAGMENT_PROGRAM);
    gl->bind_program (GLITZ_GL_FRAGMENT_PROGRAM, op->fp);
--- 385,388 ----
***************
*** 404,492 ****
    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:
--- 391,434 ----
    case GLITZ_FILTER_GAUSSIAN:
    case GLITZ_FILTER_CONVOLUTION:
!     for (i = 0; i < surface->filter_params->id; i++)
!       gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, i,
!                                    surface->filter_params->vectors[i].v);
      break;
!   case GLITZ_FILTER_LINEAR_GRADIENT:
!   case GLITZ_FILTER_RADIAL_GRADIENT: {
      int j, fp_type = surface->filter_params->fp_type;
+     glitz_vec4_t *vec;
+ 
+     vec = surface->filter_params->vectors;
      
!     gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 0, vec->v);
  
!     vec++;
  
!     if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT ||
!         fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
!       glitz_vec4_t v;
  
!       v.v[0] = v.v[1] = -1.0f;
!       v.v[2] = 0.0f;
!       v.v[3] = (vec->v[3])? 1.0f / vec->v[3]: 1.0f;
        
!       gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, 1, v.v);
        j = 2;
      } else
        j = 1;
      
!     for (i = 0; i < surface->filter_params->id; i++, vec++)
!       gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, i + j, vec->v);
      
!     if (fp_type == GLITZ_FP_LINEAR_GRADIENT_TRANSPARENT ||
!         fp_type == GLITZ_FP_RADIAL_GRADIENT_TRANSPARENT) {
!       glitz_vec4_t v;
  
!       v.v[0] = v.v[1] = -1.0f;
!       v.v[2] = v.v[3] = 1.0f;
        
!       gl->program_local_param_4fv (GLITZ_GL_FRAGMENT_PROGRAM, i + j, v.v);
!     } 
    } break;
    case GLITZ_FILTER_BILINEAR:

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

Index: glitz_gl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_gl.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_gl.h	18 Aug 2004 12:30:24 -0000	1.7
--- glitz_gl.h	3 Sep 2004 14:27:58 -0000	1.8
***************
*** 44,47 ****
--- 44,48 ----
  typedef float glitz_gl_clampf_t;
  typedef unsigned char glitz_gl_ubyte_t;
+ typedef ptrdiff_t glitz_gl_intptr_t;
  typedef ptrdiff_t glitz_gl_sizeiptr_t;
  
***************
*** 67,74 ****
--- 68,84 ----
  #define GLITZ_GL_PROJECTION 0x1701
  
+ #define GLITZ_GL_SHORT  0x1402
+ #define GLITZ_GL_INT    0x1404
+ #define GLITZ_GL_FLOAT  0x1406
+ #define GLITZ_GL_DOUBLE 0x140A
+ 
  #define GLITZ_GL_TRIANGLES      0x0004
  #define GLITZ_GL_TRIANGLE_STRIP 0x0005
  #define GLITZ_GL_TRIANGLE_FAN   0x0006
  #define GLITZ_GL_QUADS          0x0007
+ #define GLITZ_GL_QUAD_STRIP     0x0008
+ #define GLITZ_GL_POLYGON        0x0009
+ 
+ #define GLITZ_GL_VERTEX_ARRAY   0x8074
  
  #define GLITZ_GL_FILL           0x1B02
***************
*** 90,93 ****
--- 100,111 ----
  #define GLITZ_GL_TEXTURE_MIN_FILTER     0x2801
  #define GLITZ_GL_TEXTURE_ENV_COLOR      0x2201
+ #define GLITZ_GL_TEXTURE_GEN_S          0x0C60
+ #define GLITZ_GL_TEXTURE_GEN_T          0x0C61
+ #define GLITZ_GL_TEXTURE_GEN_MODE       0x2500
+ #define GLITZ_GL_EYE_LINEAR             0x2400
+ #define GLITZ_GL_EYE_PLANE              0x2502
+ #define GLITZ_GL_S                      0x2000
+ #define GLITZ_GL_T                      0x2001
+ 
  #define GLITZ_GL_MODULATE               0x2100
  #define GLITZ_GL_NEAREST                0x2600
***************
*** 216,220 ****
  #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
--- 234,237 ----
***************
*** 224,227 ****
--- 241,245 ----
  #define GLITZ_GL_PROGRAM_NATIVE_INSTRUCTIONS 0x88A2
  
+ #define GLITZ_GL_ARRAY_BUFFER        0x8892
  #define GLITZ_GL_PIXEL_PACK_BUFFER   0x88EB
  #define GLITZ_GL_PIXEL_UNPACK_BUFFER 0x88EC
***************
*** 246,257 ****
  typedef glitz_gl_void_t (* glitz_gl_disable_t)
       (glitz_gl_enum_t cap);
! typedef glitz_gl_void_t (* glitz_gl_begin_t)
!      (glitz_gl_enum_t mode);
! typedef glitz_gl_void_t (* glitz_gl_end_t)
!      (glitz_gl_void_t);
! typedef glitz_gl_void_t (* glitz_gl_vertex_2i_t)
!      (glitz_gl_int_t x, glitz_gl_int_t y);
! typedef glitz_gl_void_t (* glitz_gl_vertex_2d_t)
!      (glitz_gl_double_t x, glitz_gl_double_t y);
  typedef glitz_gl_void_t (* glitz_gl_tex_env_f_t)
       (glitz_gl_enum_t target, glitz_gl_enum_t pname, glitz_gl_float_t param);
--- 264,276 ----
  typedef glitz_gl_void_t (* glitz_gl_disable_t)
       (glitz_gl_enum_t cap);
! typedef glitz_gl_void_t (* glitz_gl_enable_client_state_t)
!      (glitz_gl_enum_t cap);
! typedef glitz_gl_void_t (* glitz_gl_disable_client_state_t)
!      (glitz_gl_enum_t cap);
! typedef glitz_gl_void_t (* glitz_gl_vertex_pointer_t)
!      (glitz_gl_int_t size, glitz_gl_enum_t type, glitz_gl_sizei_t stride,
!       const glitz_gl_void_t *ptr);
! typedef glitz_gl_void_t (* glitz_gl_draw_arrays_t)
!      (glitz_gl_enum_t mode, glitz_gl_int_t first, glitz_gl_sizei_t count);
  typedef glitz_gl_void_t (* glitz_gl_tex_env_f_t)
       (glitz_gl_enum_t target, glitz_gl_enum_t pname, glitz_gl_float_t param);
***************
*** 259,264 ****
       (glitz_gl_enum_t target, glitz_gl_enum_t pname,
        const glitz_gl_float_t *params);
! typedef glitz_gl_void_t (* glitz_gl_tex_coord_2d_t)
!      (glitz_gl_double_t s, glitz_gl_double_t t);
  typedef glitz_gl_void_t (* glitz_gl_scissor_t)
       (glitz_gl_int_t x, glitz_gl_int_t y,
--- 278,286 ----
       (glitz_gl_enum_t target, glitz_gl_enum_t pname,
        const glitz_gl_float_t *params);
! typedef glitz_gl_void_t (* glitz_gl_tex_gen_i_t)
!      (glitz_gl_enum_t coord, glitz_gl_enum_t pname, glitz_gl_int_t param);
! typedef glitz_gl_void_t (* glitz_gl_tex_gen_fv_t)
!      (glitz_gl_enum_t coord, glitz_gl_enum_t pname,
!       const glitz_gl_float_t *params);
  typedef glitz_gl_void_t (* glitz_gl_scissor_t)
       (glitz_gl_int_t x, glitz_gl_int_t y,
***************
*** 267,273 ****
       (glitz_gl_ushort_t red, glitz_gl_ushort_t green, glitz_gl_ushort_t blue,
        glitz_gl_ushort_t alpha);
! typedef glitz_gl_void_t (* glitz_gl_color_4d_t)
!      (glitz_gl_double_t red, glitz_gl_double_t green, glitz_gl_double_t blue,
!       glitz_gl_double_t alpha);
  typedef glitz_gl_void_t (* glitz_gl_blend_func_t)
       (glitz_gl_enum_t sfactor, glitz_gl_enum_t dfactor);
--- 289,295 ----
       (glitz_gl_ushort_t red, glitz_gl_ushort_t green, glitz_gl_ushort_t blue,
        glitz_gl_ushort_t alpha);
! typedef glitz_gl_void_t (* glitz_gl_color_4f_t)
!      (glitz_gl_float_t red, glitz_gl_float_t green, glitz_gl_float_t blue,
!       glitz_gl_float_t alpha);
  typedef glitz_gl_void_t (* glitz_gl_blend_func_t)
       (glitz_gl_enum_t sfactor, glitz_gl_enum_t dfactor);
***************
*** 295,302 ****
  typedef glitz_gl_void_t (* glitz_gl_load_identity_t)
       (glitz_gl_void_t);
! typedef glitz_gl_void_t (* glitz_gl_load_matrix_d_t)
!      (const glitz_gl_double_t *m);
! typedef glitz_gl_void_t (* glitz_gl_mult_matrix_d_t)
!      (const glitz_gl_double_t *m);
  typedef glitz_gl_void_t (* glitz_gl_depth_range_t)
       (glitz_gl_clampd_t near_val, glitz_gl_clampd_t far_val);
--- 317,322 ----
  typedef glitz_gl_void_t (* glitz_gl_load_identity_t)
       (glitz_gl_void_t);
! typedef glitz_gl_void_t (* glitz_gl_load_matrix_f_t)
!      (const glitz_gl_float_t *m);
  typedef glitz_gl_void_t (* glitz_gl_depth_range_t)
       (glitz_gl_clampd_t near_val, glitz_gl_clampd_t far_val);
***************
*** 304,309 ****
       (glitz_gl_int_t x, glitz_gl_int_t y,
        glitz_gl_sizei_t width, glitz_gl_sizei_t height);
! typedef glitz_gl_void_t (* glitz_gl_raster_pos_2d_t)
!      (glitz_gl_double_t x, glitz_gl_double_t y);
  typedef glitz_gl_void_t (* glitz_gl_bitmap_t)
       (glitz_gl_sizei_t width, glitz_gl_sizei_t height,
--- 324,329 ----
       (glitz_gl_int_t x, glitz_gl_int_t y,
        glitz_gl_sizei_t width, glitz_gl_sizei_t height);
! typedef glitz_gl_void_t (* glitz_gl_raster_pos_2f_t)
!      (glitz_gl_float_t x, glitz_gl_float_t y);
  typedef glitz_gl_void_t (* glitz_gl_bitmap_t)
       (glitz_gl_sizei_t width, glitz_gl_sizei_t height,
***************
*** 329,336 ****
        glitz_gl_double_t bottom, glitz_gl_double_t top,
        glitz_gl_double_t near_val, glitz_gl_double_t far_val);
! typedef glitz_gl_void_t (* glitz_gl_scale_d_t)
!      (glitz_gl_double_t x, glitz_gl_double_t y, glitz_gl_double_t z);
! typedef glitz_gl_void_t (* glitz_gl_translate_d_t)
!      (glitz_gl_double_t x, glitz_gl_double_t y, glitz_gl_double_t z);
  typedef glitz_gl_void_t (* glitz_gl_hint_t)
       (glitz_gl_enum_t target, glitz_gl_enum_t mode);
--- 349,356 ----
        glitz_gl_double_t bottom, glitz_gl_double_t top,
        glitz_gl_double_t near_val, glitz_gl_double_t far_val);
! typedef glitz_gl_void_t (* glitz_gl_scale_f_t)
!      (glitz_gl_float_t x, glitz_gl_float_t y, glitz_gl_float_t z);
! typedef glitz_gl_void_t (* glitz_gl_translate_f_t)
!      (glitz_gl_float_t x, glitz_gl_float_t y, glitz_gl_float_t z);
  typedef glitz_gl_void_t (* glitz_gl_hint_t)
       (glitz_gl_enum_t target, glitz_gl_enum_t mode);
***************
*** 367,376 ****
  typedef glitz_gl_void_t (* glitz_gl_bind_texture_t)
       (glitz_gl_enum_t target, glitz_gl_uint_t texture);
- typedef glitz_gl_void_t (* glitz_gl_tex_image_1d_t)
-      (glitz_gl_enum_t target, glitz_gl_int_t level,
-       glitz_gl_int_t internal_format,
-       glitz_gl_sizei_t width, glitz_gl_int_t border,
-       glitz_gl_enum_t format, glitz_gl_enum_t type,
-       const glitz_gl_void_t *pixels);
  typedef glitz_gl_void_t (* glitz_gl_tex_image_2d_t)
       (glitz_gl_enum_t target, glitz_gl_int_t level,
--- 387,390 ----
***************
*** 395,400 ****
  typedef glitz_gl_void_t (* glitz_gl_active_texture_t)
       (glitz_gl_enum_t);
- typedef glitz_gl_void_t (* glitz_gl_multi_tex_coord_2d_t)
-      (glitz_gl_enum_t, glitz_gl_double_t, glitz_gl_double_t);
  typedef glitz_gl_void_t (* glitz_gl_gen_programs_t)
       (glitz_gl_sizei_t, glitz_gl_uint_t *);
--- 409,412 ----
***************
*** 406,413 ****
  typedef glitz_gl_void_t (* glitz_gl_bind_program_t)
       (glitz_gl_enum_t, glitz_gl_uint_t);
! typedef glitz_gl_void_t (* glitz_gl_program_local_param_4d_t)
!      (glitz_gl_enum_t, glitz_gl_uint_t,
!       glitz_gl_double_t, glitz_gl_double_t,
!       glitz_gl_double_t, glitz_gl_double_t);
  typedef glitz_gl_void_t (* glitz_gl_get_program_iv_t)
       (glitz_gl_enum_t, glitz_gl_enum_t, glitz_gl_uint_t *);
--- 418,423 ----
  typedef glitz_gl_void_t (* glitz_gl_bind_program_t)
       (glitz_gl_enum_t, glitz_gl_uint_t);
! typedef glitz_gl_void_t (* glitz_gl_program_local_param_4fv_t)
!      (glitz_gl_enum_t, glitz_gl_uint_t, const glitz_gl_float_t *);
  typedef glitz_gl_void_t (* glitz_gl_get_program_iv_t)
       (glitz_gl_enum_t, glitz_gl_enum_t, glitz_gl_uint_t *);
***************
*** 421,424 ****
--- 431,440 ----
       (glitz_gl_enum_t, glitz_gl_sizeiptr_t, const glitz_gl_void_t *,
        glitz_gl_enum_t);
+ typedef glitz_gl_void_t *(* glitz_gl_buffer_sub_data_t)
+      (glitz_gl_enum_t, glitz_gl_intptr_t, glitz_gl_sizeiptr_t,
+       const glitz_gl_void_t *);
+ typedef glitz_gl_void_t *(* glitz_gl_get_buffer_sub_data_t)
+      (glitz_gl_enum_t, glitz_gl_intptr_t, glitz_gl_sizeiptr_t,
+       glitz_gl_void_t *);
  typedef glitz_gl_void_t *(* glitz_gl_map_buffer_t)
       (glitz_gl_enum_t, glitz_gl_enum_t);

Index: glitz_glx_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_context.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** glitz_glx_context.c	18 Aug 2004 12:30:24 -0000	1.11
--- glitz_glx_context.c	3 Sep 2004 14:27:58 -0000	1.12
***************
*** 34,37 ****
--- 34,39 ----
  #include <stdlib.h>
  
+ extern glitz_gl_proc_address_list_t _glitz_glx_gl_proc_address;
+ 
  static void
  _glitz_glx_context_create_glx12 (glitz_glx_screen_info_t *screen_info,
***************
*** 178,186 ****
                                       context);
  
!   memcpy (&context->gl,
!           &screen_info->root_context.gl,
            sizeof (glitz_gl_proc_address_list_t));
    
!   context->gl.need_lookup = 1;
    
    return context;
--- 180,195 ----
                                       context);
  
!   glitz_glx_surface_backend_init (&context->backend);
! 
!   memcpy (&context->backend.gl,
!           &_glitz_glx_gl_proc_address,
            sizeof (glitz_gl_proc_address_list_t));
+ 
+   context->backend.formats = screen_info->formats;
+   context->backend.n_formats = screen_info->n_formats;
+   context->backend.program_map = &screen_info->program_map;
+   context->backend.feature_mask = 0;
    
!   context->backend.gl.need_lookup = 1;
    
    return context;
***************
*** 203,252 ****
      screen_info->display_info->thread_info;
      
!   context->gl.active_texture =
      (glitz_gl_active_texture_t)
      glitz_glx_get_proc_address (thread_info, "glActiveTextureARB");
-   context->gl.multi_tex_coord_2d =
-     (glitz_gl_multi_tex_coord_2d_t)
-     glitz_glx_get_proc_address (thread_info, "glMultiTexCoord2dARB");
  
!   context->gl.gen_programs =
      (glitz_gl_gen_programs_t)
      glitz_glx_get_proc_address (thread_info, "glGenProgramsARB");
!   context->gl.delete_programs =
      (glitz_gl_delete_programs_t)
      glitz_glx_get_proc_address (thread_info, "glDeleteProgramsARB");
!   context->gl.program_string =
      (glitz_gl_program_string_t)
      glitz_glx_get_proc_address (thread_info, "glProgramStringARB");
!   context->gl.bind_program =
      (glitz_gl_bind_program_t)
      glitz_glx_get_proc_address (thread_info, "glBindProgramARB");
!   context->gl.program_local_param_4d =
!     (glitz_gl_program_local_param_4d_t)
!     glitz_glx_get_proc_address (thread_info, "glProgramLocalParameter4dARB");
!   context->gl.get_program_iv =
      (glitz_gl_get_program_iv_t)
      glitz_glx_get_proc_address (thread_info, "glGetProgramivARB");
  
!   context->gl.gen_buffers =
      (glitz_gl_gen_buffers_t)
!     glitz_glx_get_proc_address (thread_info, "glGenBuffers");
!   context->gl.delete_buffers =
      (glitz_gl_delete_buffers_t)
!     glitz_glx_get_proc_address (thread_info, "glDeleteBuffers");
!   context->gl.bind_buffer =
      (glitz_gl_bind_buffer_t)
!     glitz_glx_get_proc_address (thread_info, "glBindBuffer");
!   context->gl.buffer_data =
      (glitz_gl_buffer_data_t)
!     glitz_glx_get_proc_address (thread_info, "glBufferData");
!   context->gl.map_buffer =
      (glitz_gl_map_buffer_t)
!     glitz_glx_get_proc_address (thread_info, "glMapBuffer");
!   context->gl.unmap_buffer =
      (glitz_gl_unmap_buffer_t)
!     glitz_glx_get_proc_address (thread_info, "glUnmapBuffer");
  
!   context->gl.need_lookup = 0;
  }
  
--- 212,303 ----
      screen_info->display_info->thread_info;
      
!   context->backend.gl.active_texture =
      (glitz_gl_active_texture_t)
      glitz_glx_get_proc_address (thread_info, "glActiveTextureARB");
  
!   context->backend.gl.gen_programs =
      (glitz_gl_gen_programs_t)
      glitz_glx_get_proc_address (thread_info, "glGenProgramsARB");
!   context->backend.gl.delete_programs =
      (glitz_gl_delete_programs_t)
      glitz_glx_get_proc_address (thread_info, "glDeleteProgramsARB");
!   context->backend.gl.program_string =
      (glitz_gl_program_string_t)
      glitz_glx_get_proc_address (thread_info, "glProgramStringARB");
!   context->backend.gl.bind_program =
      (glitz_gl_bind_program_t)
      glitz_glx_get_proc_address (thread_info, "glBindProgramARB");
!   context->backend.gl.program_local_param_4fv =
!     (glitz_gl_program_local_param_4fv_t)
!     glitz_glx_get_proc_address (thread_info, "glProgramLocalParameter4fvARB");
!   context->backend.gl.get_program_iv =
      (glitz_gl_get_program_iv_t)
      glitz_glx_get_proc_address (thread_info, "glGetProgramivARB");
  
!   context->backend.gl.gen_buffers =
      (glitz_gl_gen_buffers_t)
!     glitz_glx_get_proc_address (thread_info, "glGenBuffersARB");
!   context->backend.gl.delete_buffers =
      (glitz_gl_delete_buffers_t)
!     glitz_glx_get_proc_address (thread_info, "glDeleteBuffersARB");
!   context->backend.gl.bind_buffer =
      (glitz_gl_bind_buffer_t)
!     glitz_glx_get_proc_address (thread_info, "glBindBufferARB");
!   context->backend.gl.buffer_data =
      (glitz_gl_buffer_data_t)
!     glitz_glx_get_proc_address (thread_info, "glBufferDataARB");
!   context->backend.gl.buffer_sub_data =
!     (glitz_gl_buffer_sub_data_t)
!     glitz_glx_get_proc_address (thread_info, "glBufferSubDataARB");
!   context->backend.gl.get_buffer_sub_data =
!     (glitz_gl_get_buffer_sub_data_t)
!     glitz_glx_get_proc_address (thread_info, "glGetBufferSubDataARB");
!   context->backend.gl.map_buffer =
      (glitz_gl_map_buffer_t)
!     glitz_glx_get_proc_address (thread_info, "glMapBufferARB");
!   context->backend.gl.unmap_buffer =
      (glitz_gl_unmap_buffer_t)
!     glitz_glx_get_proc_address (thread_info, "glUnmapBufferARB");
  
!   context->backend.feature_mask = screen_info->feature_mask;
! 
!   context->backend.feature_mask &= ~GLITZ_FEATURE_MULTITEXTURE_MASK;
!   context->backend.feature_mask &= ~GLITZ_FEATURE_COMPONENT_ALPHA_MASK;
!   context->backend.feature_mask &= ~GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
!   context->backend.feature_mask &= ~GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK;
!   context->backend.feature_mask &= ~GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
! 
!   if (context->backend.gl.active_texture) {
!     context->backend.feature_mask |= GLITZ_FEATURE_MULTITEXTURE_MASK;
! 
!     if (screen_info->feature_mask & GLITZ_FEATURE_COMPONENT_ALPHA_MASK)
!       context->backend.feature_mask |= GLITZ_FEATURE_COMPONENT_ALPHA_MASK;
!     
!     if (context->backend.gl.gen_programs &&
!         context->backend.gl.delete_programs &&
!         context->backend.gl.program_string &&
!         context->backend.gl.bind_program &&
!         context->backend.gl.program_local_param_4fv) {
!       if (screen_info->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)
!         context->backend.feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
!     }
!   }
! 
!   if (context->backend.gl.gen_buffers &&
!       context->backend.gl.delete_buffers &&
!       context->backend.gl.bind_buffer &&
!       context->backend.gl.buffer_data &&
!       context->backend.gl.buffer_sub_data &&
!       context->backend.gl.get_buffer_sub_data &&
!       context->backend.gl.map_buffer &&
!       context->backend.gl.unmap_buffer) {
!     if (screen_info->feature_mask & GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK)
!       context->backend.feature_mask |= GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK;
!     
!     if (screen_info->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
!       context->backend.feature_mask |= GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
!   }
!   
!   context->backend.gl.need_lookup = 0;
  }
  
***************
*** 273,277 ****
                    drawable, context);
  
!   if (surface->context->gl.need_lookup)
      glitz_glx_context_proc_address_lookup (surface->screen_info,
                                             surface->context);
--- 324,328 ----
                    drawable, context);
  
!   if (surface->context->backend.gl.need_lookup)
      glitz_glx_context_proc_address_lookup (surface->screen_info,
                                             surface->context);

Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glitz_glx_extension.c	18 Aug 2004 12:30:24 -0000	1.9
--- glitz_glx_extension.c	3 Sep 2004 14:27:58 -0000	1.10
***************
*** 51,56 ****
      GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_HINT_MASK },
    { "GL_ARB_multitexture", GLITZ_GLX_FEATURE_MULTITEXTURE_MASK },
-   { "GL_ARB_vertex_program", GLITZ_GLX_FEATURE_VERTEX_PROGRAM_MASK },
    { "GL_ARB_fragment_program", GLITZ_GLX_FEATURE_FRAGMENT_PROGRAM_MASK },
    { "GL_EXT_pixel_buffer_object", GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
    { NULL, 0 }
--- 51,57 ----
      GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_HINT_MASK },
    { "GL_ARB_multitexture", GLITZ_GLX_FEATURE_MULTITEXTURE_MASK },
    { "GL_ARB_fragment_program", GLITZ_GLX_FEATURE_FRAGMENT_PROGRAM_MASK },
+   { "GL_ARB_vertex_buffer_object",
+     GLITZ_GLX_FEATURE_VERTEX_BUFFER_OBJECT_MASK },
    { "GL_EXT_pixel_buffer_object", GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
    { NULL, 0 }
***************
*** 93,105 ****
        glx->get_visual_from_fbconfig &&
        glx->create_pbuffer &&
!       glx->destroy_pbuffer) {
!     screen_info->feature_mask |= GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
      screen_info->glx_feature_mask |= GLITZ_GLX_FEATURE_GLX13_MASK;
-   }
  
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_MULTISAMPLE_MASK &&
        screen_info->glx_feature_mask &
        GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK) {
!     const char *renderer = (char *) glGetString (GL_RENDERER);
      
      screen_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
--- 94,104 ----
        glx->get_visual_from_fbconfig &&
        glx->create_pbuffer &&
!       glx->destroy_pbuffer)
      screen_info->glx_feature_mask |= GLITZ_GLX_FEATURE_GLX13_MASK;
  
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_MULTISAMPLE_MASK &&
        screen_info->glx_feature_mask &
        GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK) {
!     const glitz_gl_ubyte_t *renderer = glGetString (GL_RENDERER);
      
      screen_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
***************
*** 159,165 ****
      }
          
-     if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_VERTEX_PROGRAM_MASK)
-       screen_info->feature_mask |= GLITZ_FEATURE_VERTEX_PROGRAM_MASK;
- 
      if (screen_info->glx_feature_mask &
          GLITZ_GLX_FEATURE_FRAGMENT_PROGRAM_MASK)
--- 158,161 ----
***************
*** 168,171 ****
--- 164,171 ----
  
    if (screen_info->glx_feature_mask &
+       GLITZ_GLX_FEATURE_VERTEX_BUFFER_OBJECT_MASK)
+     screen_info->feature_mask |= GLITZ_FEATURE_VERTEX_BUFFER_OBJECT_MASK;
+ 
+   if (screen_info->glx_feature_mask &
        GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
      screen_info->feature_mask |= GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;

Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_format.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glitz_glx_format.c	18 Aug 2004 12:30:24 -0000	1.9
--- glitz_glx_format.c	3 Sep 2004 14:27:58 -0000	1.10
***************
*** 184,188 ****
    if (!fbconfigs) {
      /* GLX 1.3 is not support, falling back to GLX 1.2 */
-     screen_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
      screen_info->glx_feature_mask &= ~GLITZ_GLX_FEATURE_GLX13_MASK;
      return 1;
--- 184,187 ----
***************
*** 288,292 ****
   
    glitz_format_for_each_texture_format (&_glitz_glx_add_texture_format,
! 					&screen_info->root_context.gl,
  					(void *) screen_info);
    
--- 287,291 ----
   
    glitz_format_for_each_texture_format (&_glitz_glx_add_texture_format,
! 					&screen_info->root_context.backend.gl,
  					(void *) screen_info);
    

Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** glitz_glx_info.c	18 Aug 2004 12:30:24 -0000	1.14
--- glitz_glx_info.c	3 Sep 2004 14:27:58 -0000	1.15
***************
*** 35,50 ****
  #include <dlfcn.h>
  
! glitz_gl_proc_address_list_t _glitz_gl_proc_address = {
    (glitz_gl_enable_t) glEnable,
    (glitz_gl_disable_t) glDisable,
!   (glitz_gl_begin_t) glBegin,
!   (glitz_gl_end_t) glEnd,
!   (glitz_gl_vertex_2i_t) glVertex2i,
!   (glitz_gl_vertex_2d_t) glVertex2d,
    (glitz_gl_tex_env_f_t) glTexEnvf,
    (glitz_gl_tex_env_fv_t) glTexEnvfv,
!   (glitz_gl_tex_coord_2d_t) glTexCoord2d,
    (glitz_gl_color_4us_t) glColor4us,
!   (glitz_gl_color_4d_t) glColor4d,
    (glitz_gl_scissor_t) glScissor,
    (glitz_gl_blend_func_t) glBlendFunc,
--- 35,51 ----
  #include <dlfcn.h>
  
! glitz_gl_proc_address_list_t _glitz_glx_gl_proc_address = {
    (glitz_gl_enable_t) glEnable,
    (glitz_gl_disable_t) glDisable,
!   (glitz_gl_enable_client_state_t) glEnableClientState,
!   (glitz_gl_disable_client_state_t) glDisableClientState,
!   (glitz_gl_vertex_pointer_t) glVertexPointer,
!   (glitz_gl_draw_arrays_t) glDrawArrays,
    (glitz_gl_tex_env_f_t) glTexEnvf,
    (glitz_gl_tex_env_fv_t) glTexEnvfv,
!   (glitz_gl_tex_gen_i_t) glTexGeni,
!   (glitz_gl_tex_gen_fv_t) glTexGenfv,
    (glitz_gl_color_4us_t) glColor4us,
!   (glitz_gl_color_4f_t) glColor4f,
    (glitz_gl_scissor_t) glScissor,
    (glitz_gl_blend_func_t) glBlendFunc,
***************
*** 60,68 ****
    (glitz_gl_pop_matrix_t) glPopMatrix,
    (glitz_gl_load_identity_t) glLoadIdentity,
!   (glitz_gl_load_matrix_d_t) glLoadMatrixd,
!   (glitz_gl_mult_matrix_d_t) glMultMatrixd,
    (glitz_gl_depth_range_t) glDepthRange,
    (glitz_gl_viewport_t) glViewport,
!   (glitz_gl_raster_pos_2d_t) glRasterPos2d,
    (glitz_gl_bitmap_t) glBitmap,
    (glitz_gl_read_buffer_t) glReadBuffer,
--- 61,68 ----
    (glitz_gl_pop_matrix_t) glPopMatrix,
    (glitz_gl_load_identity_t) glLoadIdentity,
!   (glitz_gl_load_matrix_f_t) glLoadMatrixf,
    (glitz_gl_depth_range_t) glDepthRange,
    (glitz_gl_viewport_t) glViewport,
!   (glitz_gl_raster_pos_2f_t) glRasterPos2f,
    (glitz_gl_bitmap_t) glBitmap,
    (glitz_gl_read_buffer_t) glReadBuffer,
***************
*** 73,78 ****
    (glitz_gl_pixel_store_i_t) glPixelStorei,
    (glitz_gl_ortho_t) glOrtho,
!   (glitz_gl_scale_d_t) glScaled,
!   (glitz_gl_translate_d_t) glTranslated,
    (glitz_gl_hint_t) glHint,
    (glitz_gl_depth_mask_t) glDepthMask,
--- 73,78 ----
    (glitz_gl_pixel_store_i_t) glPixelStorei,
    (glitz_gl_ortho_t) glOrtho,
!   (glitz_gl_scale_f_t) glScalef,
!   (glitz_gl_translate_f_t) glTranslatef,
    (glitz_gl_hint_t) glHint,
    (glitz_gl_depth_mask_t) glDepthMask,
***************
*** 86,90 ****
    (glitz_gl_delete_textures_t) glDeleteTextures,
    (glitz_gl_bind_texture_t) glBindTexture,
-   (glitz_gl_tex_image_1d_t) glTexImage1D,
    (glitz_gl_tex_image_2d_t) glTexImage2D,
    (glitz_gl_tex_parameter_i_t) glTexParameteri,
--- 86,89 ----
***************
*** 94,103 ****
  
    (glitz_gl_active_texture_t) 0,
-   (glitz_gl_multi_tex_coord_2d_t) 0,
    (glitz_gl_gen_programs_t) 0,
    (glitz_gl_delete_programs_t) 0,
    (glitz_gl_program_string_t) 0,
    (glitz_gl_bind_program_t) 0,
!   (glitz_gl_program_local_param_4d_t) 0,
    (glitz_gl_get_program_iv_t) 0,
    (glitz_gl_gen_buffers_t) 0,
--- 93,101 ----
  
    (glitz_gl_active_texture_t) 0,
    (glitz_gl_gen_programs_t) 0,
    (glitz_gl_delete_programs_t) 0,
    (glitz_gl_program_string_t) 0,
    (glitz_gl_bind_program_t) 0,
!   (glitz_gl_program_local_param_4fv_t) 0,
    (glitz_gl_get_program_iv_t) 0,
    (glitz_gl_gen_buffers_t) 0,
***************
*** 105,110 ****
--- 103,111 ----
    (glitz_gl_bind_buffer_t) 0,
    (glitz_gl_buffer_data_t) 0,
+   (glitz_gl_buffer_sub_data_t) 0,
+   (glitz_gl_get_buffer_sub_data_t) 0,
    (glitz_gl_map_buffer_t) 0,
    (glitz_gl_unmap_buffer_t) 0,
+   
    1
  };
***************
*** 401,410 ****
  
    screen_info->root_context.fbconfig = (XID) 0;
!     
!   memcpy (&screen_info->root_context.gl,
!           &_glitz_gl_proc_address,
            sizeof (glitz_gl_proc_address_list_t));
    
!   screen_info->root_context.gl.need_lookup = 1;
  }
  
--- 402,418 ----
  
    screen_info->root_context.fbconfig = (XID) 0;
! 
!   glitz_glx_surface_backend_init (&screen_info->root_context.backend);
!   
!   memcpy (&screen_info->root_context.backend.gl,
!           &_glitz_glx_gl_proc_address,
            sizeof (glitz_gl_proc_address_list_t));
+ 
+   screen_info->root_context.backend.formats = NULL;
+   screen_info->root_context.backend.n_formats = 0;
+   screen_info->root_context.backend.program_map = &screen_info->program_map;
+   screen_info->root_context.backend.feature_mask = 0;
    
!   screen_info->root_context.backend.gl.need_lookup = 1;
  }
  
***************
*** 458,461 ****
--- 466,472 ----
      glitz_glx_query_formats (screen_info);
    }
+ 
+   screen_info->root_context.backend.formats = screen_info->formats;
+   screen_info->root_context.backend.n_formats = screen_info->n_formats;
    
    screen_info->context_stack_size = 1;
***************
*** 476,480 ****
                        screen_info->root_drawable,
                        screen_info->root_context.context)) {
!     glitz_program_map_fini (&screen_info->root_context.gl,
                              &screen_info->program_map);
      glXMakeCurrent (display, None, NULL);
--- 487,491 ----
                        screen_info->root_drawable,
                        screen_info->root_context.context)) {
!     glitz_program_map_fini (&screen_info->root_context.backend.gl,
                              &screen_info->program_map);
      glXMakeCurrent (display, None, NULL);

Index: glitz_glx_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_surface.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** glitz_glx_surface.c	18 Aug 2004 12:30:24 -0000	1.17
--- glitz_glx_surface.c	3 Sep 2004 14:27:58 -0000	1.18
***************
*** 32,54 ****
  #include "glitz_glxint.h"
  
- static glitz_surface_t *
- _glitz_glx_surface_create_similar (void *abstract_templ,
-                                    glitz_format_t *format,
-                                    int width,
-                                    int height);
- 
- static void
- _glitz_glx_surface_destroy (void *abstract_surface);
- 
- static glitz_texture_t *
- _glitz_glx_surface_get_texture (void *abstract_surface,
-                                 glitz_bool_t allocate);
- 
- static void
- _glitz_glx_surface_update_size (void *abstract_surface);
- 
- static void
- _glitz_glx_surface_swap_buffers (void *abstract_surface);
- 
  static glitz_bool_t
  _glitz_glx_surface_push_current (void *abstract_surface,
--- 32,35 ----
***************
*** 115,134 ****
  }
  
- static const struct glitz_surface_backend glitz_glx_surface_backend = {
-   _glitz_glx_surface_create_similar,
-   _glitz_glx_surface_destroy,
-   _glitz_glx_surface_push_current,
-   _glitz_glx_surface_pop_current,
-   _glitz_glx_surface_get_texture,
-   _glitz_glx_surface_update_size,
-   _glitz_glx_surface_swap_buffers,
-   _glitz_glx_surface_make_current_read
- };
- 
  static glitz_bool_t
! _glitz_glx_surface_update_size_for_window (Display *display,
!                                            Window drawable,
!                                            int *width,
!                                            int *height)
  {
    unsigned int uwidth, uheight, bwidth_ignore, depth_ignore;
--- 96,104 ----
  }
  
  static glitz_bool_t
! _glitz_glx_surface_get_window_size (Display *display,
!                                     Window drawable,
!                                     int *width,
!                                     int *height)
  {
    unsigned int uwidth, uheight, bwidth_ignore, depth_ignore;
***************
*** 152,156 ****
    glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
    
!   if (surface->base.hint_mask & GLITZ_INT_HINT_DIRTY_MASK) {
      glitz_bounding_box_t copy_box;
  
--- 122,126 ----
    glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
    
!   if (surface->base.flags & GLITZ_FLAG_DIRTY_MASK) {
      glitz_bounding_box_t copy_box;
  
***************
*** 162,166 ****
  
      if (!surface->base.texture.allocated)
!       glitz_texture_allocate (surface->base.gl, &surface->base.texture);  
        
      glitz_texture_copy_surface (&surface->base.texture, &surface->base,
--- 132,137 ----
  
      if (!surface->base.texture.allocated)
!       glitz_texture_allocate (&surface->base.backend->gl,
!                               &surface->base.texture);  
        
      glitz_texture_copy_surface (&surface->base.texture, &surface->base,
***************
*** 171,180 ****
                                  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);
    }
    
--- 142,153 ----
                                  copy_box.x1,
                                  copy_box.y1);
!     
!     surface->base.flags &= ~GLITZ_FLAG_DIRTY_MASK;
    }
  
    if (allocate) {
      if (!surface->base.texture.allocated)
!       glitz_texture_allocate (&surface->base.backend->gl,
!                               &surface->base.texture);
    }
    
***************
*** 185,239 ****
  }
  
- static void
- _glitz_glx_set_features (glitz_glx_surface_t *surface)
- {
-   surface->base.feature_mask = surface->screen_info->feature_mask;
- 
-   surface->base.feature_mask &= ~GLITZ_FEATURE_MULTITEXTURE_MASK;
-   surface->base.feature_mask &= ~GLITZ_FEATURE_COMPONENT_ALPHA_MASK;
-   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) {
-     surface->base.feature_mask |= GLITZ_FEATURE_MULTITEXTURE_MASK;
- 
-     if (surface->screen_info->feature_mask &
-         GLITZ_FEATURE_COMPONENT_ALPHA_MASK)
-       surface->base.feature_mask |= GLITZ_FEATURE_COMPONENT_ALPHA_MASK;
- 
-     if (surface->context->gl.gen_programs &&
-         surface->context->gl.delete_programs &&
-         surface->context->gl.program_string &&
-         surface->context->gl.bind_program &&
-         surface->context->gl.program_local_param_4d) {
-       if (surface->screen_info->feature_mask &
-           GLITZ_FEATURE_VERTEX_PROGRAM_MASK) {
-         surface->base.feature_mask |= GLITZ_FEATURE_VERTEX_PROGRAM_MASK;
-         
-         if (surface->screen_info->feature_mask &
-             GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK)
-           surface->base.feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
-       }
-     }
-   }
- 
-   if (surface->context->gl.gen_buffers &&
-       surface->context->gl.delete_buffers &&
-       surface->context->gl.bind_buffer &&
-       surface->context->gl.buffer_data &&
-       surface->context->gl.map_buffer &&
-       surface->context->gl.unmap_buffer)
-     if (surface->screen_info->feature_mask &
-         GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
-       surface->base.feature_mask |= GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
- }
- 
  static glitz_surface_t *
  _glitz_glx_surface_create (glitz_glx_screen_info_t *screen_info,
--- 158,161 ----
***************
*** 254,265 ****
  
    glitz_surface_init (&surface->base,
!                       &glitz_glx_surface_backend,
!                       &context->gl,
                        format,
-                       screen_info->formats,
-                       screen_info->n_formats,
                        width,
                        height,
-                       &screen_info->program_map,
                        screen_info->texture_mask);
    
--- 176,183 ----
  
    glitz_surface_init (&surface->base,
!                       &context->backend,
                        format,
                        width,
                        height,
                        screen_info->texture_mask);
    
***************
*** 267,276 ****
    surface->context = context;
    
!   surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
    if (format->draw.offscreen)
!     surface->base.hint_mask |= GLITZ_INT_HINT_DRAWABLE_MASK;
  
!   _glitz_glx_set_features (surface);
  
    return &surface->base;
--- 185,197 ----
    surface->context = context;
    
!   surface->base.flags |= GLITZ_FLAG_OFFSCREEN_MASK;
  
    if (format->draw.offscreen)
!     surface->base.flags |= GLITZ_FLAG_DRAWABLE_MASK;
  
!   if (surface->context->backend.gl.need_lookup) {
!     glitz_glx_context_push_current (surface, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
!     glitz_glx_context_pop_current (surface);
!   }
  
    return &surface->base;
***************
*** 308,313 ****
      return NULL;
  
!   if (!_glitz_glx_surface_update_size_for_window (display, window,
!                                                   &width, &height))
      return NULL;
  
--- 229,233 ----
      return NULL;
  
!   if (!_glitz_glx_surface_get_window_size (display, window, &width, &height))
      return NULL;
  
***************
*** 317,328 ****
  
    glitz_surface_init (&surface->base,
!                       &glitz_glx_surface_backend,
!                       &context->gl,
                        format,
-                       screen_info->formats,
-                       screen_info->n_formats,
                        width,
                        height,
-                       &screen_info->program_map,
                        screen_info->texture_mask);
    
--- 237,244 ----
  
    glitz_surface_init (&surface->base,
!                       &context->backend,
                        format,
                        width,
                        height,
                        screen_info->texture_mask);
    
***************
*** 331,337 ****
    surface->drawable = window;
  
!   surface->base.hint_mask |= GLITZ_INT_HINT_DRAWABLE_MASK;
  
!   _glitz_glx_set_features (surface);
    
    return &surface->base;
--- 247,256 ----
    surface->drawable = window;
  
!   surface->base.flags |= GLITZ_FLAG_DRAWABLE_MASK;
  
!   if (surface->context->backend.gl.need_lookup) {
!     glitz_glx_context_push_current (surface, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
!     glitz_glx_context_pop_current (surface);
!   }
    
    return &surface->base;
***************
*** 374,410 ****
  
  static void
- _glitz_glx_surface_update_size (void *abstract_surface)
- {
-   glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
-   
-   if ((!surface->pbuffer) && surface->drawable) {
-     int width, height;
-     
-     _glitz_glx_surface_update_size_for_window
-       (surface->screen_info->display_info->display, surface->drawable,
-        &width, &height);
- 
-     if (width != surface->base.width || height != surface->base.height) {
-       glitz_texture_t texture;
- 
-       glitz_texture_init (&texture,
-                           width, height,
-                           surface->base.texture.format,
-                           surface->screen_info->texture_mask);
-       
-       if (texture.width != surface->base.texture.width ||
-           texture.height != surface->base.texture.height ||
-           texture.target != surface->base.texture.target) {
-         texture.name = surface->base.texture.name;
-         surface->base.texture = texture;
-       }
-       
-       surface->base.width = width;
-       surface->base.height = height;
-     }
-   }
- }
- 
- static void
  _glitz_glx_surface_swap_buffers (void *abstract_surface)
  {
--- 293,296 ----
***************
*** 421,422 ****
--- 307,320 ----
    glitz_glx_context_pop_current (surface);
  }
+ 
+ void
+ glitz_glx_surface_backend_init (glitz_surface_backend_t *backend)
+ {
+   backend->create_similar = _glitz_glx_surface_create_similar;
+   backend->destroy = _glitz_glx_surface_destroy;
+   backend->push_current = _glitz_glx_surface_push_current;
+   backend->pop_current = _glitz_glx_surface_pop_current;
+   backend->get_texture = _glitz_glx_surface_get_texture;
+   backend->swap_buffers = _glitz_glx_surface_swap_buffers;
+   backend->make_current_read = _glitz_glx_surface_make_current_read;
+ }

Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxint.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** glitz_glxint.h	18 Aug 2004 12:30:24 -0000	1.13
--- glitz_glxint.h	3 Sep 2004 14:27:58 -0000	1.14
***************
*** 48,54 ****
  #define GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK      (1L <<  8)
  #define GLITZ_GLX_FEATURE_TEXTURE_ENV_DOT3_MASK         (1L <<  9)
! #define GLITZ_GLX_FEATURE_VERTEX_PROGRAM_MASK           (1L << 10)
! #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)
  
--- 48,54 ----
  #define GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK      (1L <<  8)
  #define GLITZ_GLX_FEATURE_TEXTURE_ENV_DOT3_MASK         (1L <<  9)
! #define GLITZ_GLX_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 10)
! #define GLITZ_GLX_FEATURE_GLX13_MASK                    (1L << 11)
! #define GLITZ_GLX_FEATURE_VERTEX_BUFFER_OBJECT_MASK     (1L << 12)
  #define GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 13)
  
***************
*** 91,96 ****
    GLXContext context;
    XID id;
-   glitz_gl_proc_address_list_t gl;
    GLXFBConfig fbconfig;
  } glitz_glx_context_t;
  
--- 91,96 ----
    GLXContext context;
    XID id;
    GLXFBConfig fbconfig;
+   glitz_surface_backend_t backend;
  } glitz_glx_context_t;
  
***************
*** 113,119 ****
    Colormap root_colormap;
  
!   long int feature_mask;
!   long int glx_feature_mask;
!   long int texture_mask;
  
    glitz_program_map_t program_map;
--- 113,119 ----
    Colormap root_colormap;
  
!   unsigned long feature_mask;
!   unsigned long glx_feature_mask;
!   unsigned long texture_mask;
  
    glitz_program_map_t program_map;
***************
*** 181,184 ****
--- 181,187 ----
                             GLXPbuffer pbuffer);
  
+ extern void __internal_linkage
+ glitz_glx_surface_backend_init (glitz_surface_backend_t *backend);
+ 
  /* Avoid unnecessary PLT entries.  */
  

Index: glitz_operator.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_operator.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glitz_operator.c	9 Aug 2004 22:57:35 -0000	1.4
--- glitz_operator.c	3 Sep 2004 14:27:58 -0000	1.5
***************
*** 97,135 ****
    }
  }
- 
- void
- glitz_set_stencil_operator (glitz_gl_proc_address_list_t *gl,
-                             glitz_stencil_operator_t op,
-                             unsigned int mask)
- {
-   gl->enable (GLITZ_GL_STENCIL_TEST);
- 
-   switch (op) {
-   case GLITZ_STENCIL_OPERATOR_SET:
-   case GLITZ_STENCIL_OPERATOR_UNION:
-   case GLITZ_STENCIL_OPERATOR_CLEAR:
-     gl->stencil_func (GLITZ_GL_ALWAYS, mask, ~0x0);
-     gl->stencil_op (GLITZ_GL_REPLACE, GLITZ_GL_REPLACE, GLITZ_GL_REPLACE);
-     break;
-   case GLITZ_STENCIL_OPERATOR_INTERSECT:
-     gl->stencil_func (GLITZ_GL_LESS, mask, ~0x0);
-     gl->stencil_op (GLITZ_GL_ZERO, GLITZ_GL_REPLACE, GLITZ_GL_REPLACE);
-     break;
-   case GLITZ_STENCIL_OPERATOR_INCR_EQUAL:
-     gl->stencil_func (GLITZ_GL_EQUAL, mask, mask);
-     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_INCR, GLITZ_GL_INCR);
-     break;
-   case GLITZ_STENCIL_OPERATOR_DECR_LESS:
-     gl->stencil_func (GLITZ_GL_LESS, mask, ~0x0);
-     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_REPLACE, GLITZ_GL_REPLACE);
-     break;
-   case GLITZ_STENCIL_OPERATOR_CLIP_EQUAL:
-     gl->stencil_func (GLITZ_GL_EQUAL, mask, ~0x0);
-     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_KEEP, GLITZ_GL_KEEP);
-     break;
-   case GLITZ_STENCIL_OPERATOR_CLIP:
-     gl->stencil_func (GLITZ_GL_LEQUAL, mask, ~0x0);
-     gl->stencil_op (GLITZ_GL_KEEP, GLITZ_GL_KEEP, GLITZ_GL_KEEP);
-     break;
-   }
- }
--- 97,98 ----

Index: glitz_pixel.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_pixel.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glitz_pixel.c	18 Aug 2004 12:30:24 -0000	1.4
--- glitz_pixel.c	3 Sep 2004 14:27:58 -0000	1.5
***************
*** 101,108 ****
  
  typedef struct _glitz_pixel_color {
!   double a;
!   double r;
!   double g;
!   double b;
  } glitz_pixel_color_t;
  
--- 101,105 ----
  
  typedef struct _glitz_pixel_color {
!   uint32_t r, g, b, a;
  } glitz_pixel_color_t;
  
***************
*** 115,121 ****
  
  #define FETCH(p, mask) ((mask)? \
!   (((double) (((uint32_t) (p)) & (mask))) / ((double) mask)): 0.0)
  #define FETCH_A(p, mask) ((mask)? \
!   (((double) (((uint32_t) (p)) & (mask))) / ((double) mask)): 1.0)
  
  typedef void (*glitz_pixel_fetch_function_t) (glitz_pixel_transform_op_t *op);
--- 112,121 ----
  
  #define FETCH(p, mask) ((mask)? \
!   ((uint32_t) ((((uint64_t) (((uint32_t) (p)) & (mask))) * 0xffffffff) / \
!   ((uint64_t) (mask)))): 0x0)
! 
  #define FETCH_A(p, mask) ((mask)? \
!   ((uint32_t) ((((uint64_t) (((uint32_t) (p)) & (mask))) * 0xffffffff) / \
!   ((uint64_t) (mask)))): 0xffffffff)
  
  typedef void (*glitz_pixel_fetch_function_t) (glitz_pixel_transform_op_t *op);
***************
*** 192,196 ****
  
  #define STORE(v, mask) \
!   (((uint32_t) (v * (double) mask)) & mask)
  
  static void
--- 192,196 ----
  
  #define STORE(v, mask) \
!   (((uint32_t) (((v) * (uint64_t) (mask)) / 0xffffffff)) & (mask))
  
  static void
***************
*** 407,655 ****
  }
  
- struct _glitz_pixel_buffer {
-   glitz_gl_sizei_t size;
-   glitz_gl_uint_t name;
-   glitz_gl_enum_t target;
-   char *data;
-   int owns_data;
-   glitz_surface_t *surface;
-   glitz_pixel_format_t format;
- };
- 
- glitz_pixel_buffer_t *
- glitz_pixel_buffer_create (glitz_surface_t *surface,
-                            char *data,
-                            unsigned int size,
-                            glitz_buffer_hint_t hint)
- {
-   glitz_pixel_buffer_t *buffer;
-   glitz_gl_enum_t usage;
- 
-   buffer = malloc (sizeof (glitz_pixel_buffer_t));
-   if (buffer == NULL)
-     return NULL;
- 
-   buffer->size = size;
-   buffer->name = 0;
-   
-   switch (hint) {
-   case GLITZ_PIXEL_BUFFER_HINT_STREAM_DRAW:
-     usage = GLITZ_GL_STREAM_DRAW;
-     buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
-     break;
-   case GLITZ_PIXEL_BUFFER_HINT_STREAM_READ:
-     usage = GLITZ_GL_STREAM_READ;
-     buffer->target = GLITZ_GL_PIXEL_PACK_BUFFER;
-     break;
-   case GLITZ_PIXEL_BUFFER_HINT_STREAM_COPY:
-     usage = GLITZ_GL_STREAM_COPY;
-     buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
-     break;
-   case GLITZ_PIXEL_BUFFER_HINT_STATIC_DRAW:
-     usage = GLITZ_GL_STATIC_DRAW;
-     buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
-     break;
-   case GLITZ_PIXEL_BUFFER_HINT_STATIC_READ:
-     usage = GLITZ_GL_STATIC_READ;
-     buffer->target = GLITZ_GL_PIXEL_PACK_BUFFER;
-     break;
-   case GLITZ_PIXEL_BUFFER_HINT_STATIC_COPY:
-     usage = GLITZ_GL_STATIC_COPY;
-     buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
-     break;
-   case GLITZ_PIXEL_BUFFER_HINT_DYNAMIC_DRAW:
-     usage = GLITZ_GL_DYNAMIC_DRAW;
-     buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
-     break;
-   case GLITZ_PIXEL_BUFFER_HINT_DYNAMIC_READ:
-     usage = GLITZ_GL_DYNAMIC_READ;
-     buffer->target = GLITZ_GL_PIXEL_PACK_BUFFER;
-     break;
-   default:
-     usage = GLITZ_GL_DYNAMIC_COPY;
-     buffer->target = GLITZ_GL_PIXEL_UNPACK_BUFFER;
-     break;
-   }
- 
-   if (surface->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK) {
-     buffer->surface = surface;
-     glitz_surface_reference (surface);
-     
-     glitz_surface_push_current (surface, GLITZ_CN_ANY_CONTEXT_CURRENT);
-     
-     surface->gl->gen_buffers (1, &buffer->name);
-     if (buffer->name) {
-       surface->gl->bind_buffer (buffer->target, buffer->name);
-       surface->gl->buffer_data (buffer->target, size, data, usage);
-     }
-     
-     glitz_surface_pop_current (surface); 
-   } else
-     buffer->surface = NULL;
-   
-   if (buffer->name == 0) {
-     buffer->data = malloc (size);
-     if (buffer->data == NULL) {
-       free (buffer);
-       return NULL;
-     }
- 
-     if (data)
-       memcpy (buffer->data, data, size);
-     
-     buffer->owns_data = 1;
-   }
-   
-   buffer->format = _glitz_best_gl_pixel_format (surface->format)->pixel;
-   
-   return buffer;
- }
- 
- glitz_pixel_buffer_t *
- glitz_pixel_buffer_create_for_data (char *data,
-                                     glitz_pixel_format_t *format)
- {
-   glitz_pixel_buffer_t *buffer;
- 
-   buffer = malloc (sizeof (glitz_pixel_buffer_t));
-   if (buffer == NULL)
-     return NULL;
- 
-   buffer->name = 0;
-   buffer->size = 0;
-   buffer->data = data;
-   buffer->owns_data = 0;
-   buffer->surface = NULL;
-   buffer->target = 0;
-   buffer->format = *format;
- 
-   return buffer;
- }
- 
- void
- glitz_pixel_buffer_destroy (glitz_pixel_buffer_t *buffer)
- {
-   glitz_surface_t *surface = buffer->surface;
-   
-   if (surface &&
-       surface->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK) {
-     glitz_surface_push_current (surface, GLITZ_CN_ANY_CONTEXT_CURRENT);
-     
-     surface->gl->delete_buffers (1, &buffer->name);
-     
-     glitz_surface_pop_current (surface);
-     
-     glitz_surface_destroy (surface);
-   } else if (buffer->owns_data)
-     free (buffer->data);
-   
-   free (buffer);
- }
- 
- void
- glitz_pixel_buffer_set_format (glitz_pixel_buffer_t *buffer,
-                                glitz_pixel_format_t *format)
- {
-   buffer->format = *format;
- }
- 
  void
! glitz_pixel_buffer_get_format (glitz_pixel_buffer_t *buffer,
!                                glitz_pixel_format_t *format)
! {
!   *format = buffer->format;
! }
! 
! char *
! glitz_pixel_buffer_get_data (glitz_pixel_buffer_t *buffer,
!                              glitz_pixel_buffer_access_t access)
! {
!   char *pointer = NULL;
!   glitz_surface_t *surface = buffer->surface;
!   
!   if (surface &&
!       surface->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK) {
!     glitz_gl_enum_t buffer_access;
!     
!     glitz_surface_push_current (surface, GLITZ_CN_ANY_CONTEXT_CURRENT);
! 
!     switch (access) {
!     case GLITZ_PIXEL_BUFFER_ACCESS_READ_ONLY:
!       buffer_access = GLITZ_GL_READ_ONLY;
!       break;
!     case GLITZ_PIXEL_BUFFER_ACCESS_WRITE_ONLY:
!       buffer_access = GLITZ_GL_WRITE_ONLY;
!       break;
!     default:
!       buffer_access = GLITZ_GL_READ_WRITE;
!       break;
!     }
! 
!     surface->gl->bind_buffer (buffer->target, buffer->name);
!     pointer = (char *) surface->gl->map_buffer (buffer->target,
!                                                 buffer_access);
!     
!     glitz_surface_pop_current (surface);
!   }
!   
!   if (pointer == NULL)
!     pointer = buffer->data;
!   
!   return pointer;
! }
! 
! void
! glitz_pixel_buffer_put_back_data (glitz_pixel_buffer_t *buffer)
! {
!   glitz_surface_t *surface = buffer->surface;
!   
!   if (surface &&
!       surface->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK) {
!     glitz_surface_push_current (surface, GLITZ_CN_ANY_CONTEXT_CURRENT);
!     
!     if (surface->gl->unmap_buffer (buffer->target)) {
!       /* don't know what to do here, maybe glitz_pixel_buffer_put_back_data
!          should return a status value */
!     }
!     surface->gl->bind_buffer (buffer->target, 0);
!     
!     glitz_surface_pop_current (surface);
!   }
! }
! 
! char *
! glitz_pixel_buffer_bind (glitz_pixel_buffer_t *buffer,
!                           glitz_gl_enum_t target)
! {
!   glitz_surface_t *surface = buffer->surface;
!   
!   if (surface &&
!       surface->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK) {
!     surface->gl->bind_buffer (target, buffer->name);
!     buffer->target = target;
!     
!     return NULL;
!   }
!   
!   return buffer->data;
! }
! 
! void
! glitz_pixel_buffer_unbind (glitz_pixel_buffer_t *buffer)
! {
!   glitz_surface_t *surface = buffer->surface;
!   
!   if (surface &&
!       surface->feature_mask & GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
!     surface->gl->bind_buffer (buffer->target, 0);
! }
! 
! void
! glitz_put_pixels (glitz_surface_t *dst,
                    int x_dst,
                    int y_dst,
                    int width,
                    int height,
!                   glitz_pixel_buffer_t *buffer)
  {
    glitz_gl_proc_address_list_t *gl;
--- 407,418 ----
  }
  
  void
! glitz_set_pixels (glitz_surface_t *dst,
                    int x_dst,
                    int y_dst,
                    int width,
                    int height,
!                   glitz_pixel_format_t *format,
!                   glitz_buffer_t *buffer)
  {
    glitz_gl_proc_address_list_t *gl;
***************
*** 657,661 ****
    glitz_texture_t *texture;
    char *pixels, *data = NULL;
!   glitz_gl_pixel_format_t *format = NULL;
    unsigned long transform = 0;
    int xoffset, bytes_per_line;
--- 420,424 ----
    glitz_texture_t *texture;
    char *pixels, *data = NULL;
!   glitz_gl_pixel_format_t *gl_format = NULL;
    unsigned long transform = 0;
    int xoffset, bytes_per_line;
***************
*** 667,680 ****
    }
  
!   gl = dst->gl;
  
!   if (buffer->format.scanline_order == GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN)
      transform |= GLITZ_TRANSFORM_SCANLINE_ORDER_MASK;
  
    /* find direct format */
!   format = _glitz_find_gl_pixel_format (&buffer->format);
!   if (format == NULL) {
      transform |= GLITZ_TRANSFORM_PIXELS_MASK;
!     format = _glitz_best_gl_pixel_format (dst->format);
    }
  
--- 430,443 ----
    }
  
!   gl = &dst->backend->gl;
  
!   if (format->scanline_order == GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN)
      transform |= GLITZ_TRANSFORM_SCANLINE_ORDER_MASK;
  
    /* find direct format */
!   gl_format = _glitz_find_gl_pixel_format (format);
!   if (gl_format == NULL) {
      transform |= GLITZ_TRANSFORM_PIXELS_MASK;
!     gl_format = _glitz_best_gl_pixel_format (dst->format);
    }
  
***************
*** 694,698 ****
      int stride;
      
!     stride = (((width * format->pixel.masks.bpp) / 8) + 3) & -4;
      
      data = malloc (stride * height);
--- 457,461 ----
      int stride;
      
!     stride = (((width * gl_format->pixel.masks.bpp) / 8) + 3) & -4;
      
      data = malloc (stride * height);
***************
*** 704,717 ****
  
      dst_image.data = data;
!     dst_image.format = &format->pixel;
      dst_image.width = width;
      dst_image.height = height;
  
!     src_image.data =
!       glitz_pixel_buffer_get_data (buffer,
!                                    GLITZ_PIXEL_BUFFER_ACCESS_READ_ONLY);
!     src_image.data += buffer->format.skip_lines *
!       buffer->format.bytes_per_line;
!     src_image.format = &buffer->format;
      src_image.width = width;
      src_image.height = height;
--- 467,477 ----
  
      dst_image.data = data;
!     dst_image.format = &gl_format->pixel;
      dst_image.width = width;
      dst_image.height = height;
  
!     src_image.data = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_READ_ONLY);
!     src_image.data += format->skip_lines * format->bytes_per_line;
!     src_image.format = format;
      src_image.width = width;
      src_image.height = height;
***************
*** 720,728 ****
                              &src_image,
                              &dst_image,
!                             buffer->format.xoffset,
                              0,
                              width, height);
  
!     glitz_pixel_buffer_put_back_data (buffer);
                                   
      pixels = data;
--- 480,488 ----
                              &src_image,
                              &dst_image,
!                             format->xoffset,
                              0,
                              width, height);
  
!     glitz_buffer_unmap (buffer);
                                   
      pixels = data;
***************
*** 730,737 ****
      bytes_per_line = stride;
    } else {
!     xoffset = buffer->format.xoffset;
!     bytes_per_line = buffer->format.bytes_per_line;
!     pixels = glitz_pixel_buffer_bind (buffer, GLITZ_GL_PIXEL_UNPACK_BUFFER);
!     pixels += buffer->format.skip_lines * bytes_per_line;
    }
  
--- 490,497 ----
      bytes_per_line = stride;
    } else {
!     xoffset = format->xoffset;
!     bytes_per_line = format->bytes_per_line;
!     pixels = glitz_buffer_bind (buffer, GLITZ_GL_PIXEL_UNPACK_BUFFER);
!     pixels += format->skip_lines * bytes_per_line;
    }
  
***************
*** 763,813 ****
                          x_dst, dst->height - y_dst - height,
                          width, height,
!                         format->format, format->type,
                          pixels);
  
    if (to_drawable) {
!     glitz_point_t tl, br;
  
-     gl->matrix_mode (GLITZ_GL_TEXTURE);
-     gl->load_identity ();
-     
      gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
                     GLITZ_GL_REPLACE);
      gl->color_4us (0x0, 0x0, 0x0, 0xffff);
      
-     glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
-     
      glitz_texture_ensure_wrap (gl, texture, GLITZ_GL_CLAMP_TO_EDGE);
      glitz_texture_ensure_filter (gl, texture, GLITZ_GL_NEAREST);
  
!     glitz_texture_tex_coord (texture, x_dst, y_dst, &tl.x, &tl.y);
!     glitz_texture_tex_coord (texture,
!                              x_dst + width, y_dst + height, &br.x, &br.y);
  
!     tl.y = texture->texcoord_height - tl.y;
!     br.y = texture->texcoord_height - br.y;
!     
!     gl->begin (GLITZ_GL_QUADS);
!     gl->tex_coord_2d (tl.x, tl.y);
!     gl->vertex_2d (x_dst, y_dst);
!     gl->tex_coord_2d (br.x, tl.y);
!     gl->vertex_2d (x_dst + width, y_dst);
!     gl->tex_coord_2d (br.x, br.y);
!     gl->vertex_2d (x_dst + width, y_dst + height);
!     gl->tex_coord_2d (tl.x, br.y);
!     gl->vertex_2d (x_dst, y_dst + height);
!     gl->end ();
  
      if (x_dst == 0 && y_dst == 0 &&
          width == dst->width && height == dst->height)
!       dst->hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
    }
    
    glitz_texture_unbind (gl, texture);
  
!   dst->hint_mask |= GLITZ_INT_HINT_SOLID_DIRTY_MASK;
  
    if (transform == 0)
!     glitz_pixel_buffer_unbind (buffer);
    
    glitz_surface_pop_current (dst);
--- 523,562 ----
                          x_dst, dst->height - y_dst - height,
                          width, height,
!                         gl_format->format, gl_format->type,
                          pixels);
  
    if (to_drawable) {
!     glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, height, ~0); 
  
      gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
                     GLITZ_GL_REPLACE);
      gl->color_4us (0x0, 0x0, 0x0, 0xffff);
      
      glitz_texture_ensure_wrap (gl, texture, GLITZ_GL_CLAMP_TO_EDGE);
      glitz_texture_ensure_filter (gl, texture, GLITZ_GL_NEAREST);
  
!     glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
  
!     gl->scissor (x_dst,
!                  dst->height - (y_dst + height),
!                  width, height);
! 
!     glitz_geometry_enable_default (gl, dst);
! 
!     gl->draw_arrays (GLITZ_GL_QUADS, 0, 4);
! 
!     glitz_geometry_disable (gl, dst);
  
      if (x_dst == 0 && y_dst == 0 &&
          width == dst->width && height == dst->height)
!       dst->flags &= ~GLITZ_FLAG_DIRTY_MASK;
    }
    
    glitz_texture_unbind (gl, texture);
  
!   dst->flags |= GLITZ_FLAG_SOLID_DIRTY_MASK;
  
    if (transform == 0)
!     glitz_buffer_unbind (buffer);
    
    glitz_surface_pop_current (dst);
***************
*** 823,827 ****
                    int width,
                    int height,
!                   glitz_pixel_buffer_t *buffer)
  {
    glitz_gl_proc_address_list_t *gl;
--- 572,577 ----
                    int width,
                    int height,
!                   glitz_pixel_format_t *format,
!                   glitz_buffer_t *buffer)
  {
    glitz_gl_proc_address_list_t *gl;
***************
*** 829,833 ****
    glitz_texture_t *texture = NULL;
    char *pixels, *data = NULL;
!   glitz_gl_pixel_format_t *format = NULL;
    unsigned long transform = 0;
    int src_x = 0, src_y = 0, src_w = width, src_h = height;
--- 579,583 ----
    glitz_texture_t *texture = NULL;
    char *pixels, *data = NULL;
!   glitz_gl_pixel_format_t *gl_format = NULL;
    unsigned long transform = 0;
    int src_x = 0, src_y = 0, src_w = width, src_h = height;
***************
*** 840,844 ****
    }
  
!   gl = src->gl;
  
    if (glitz_surface_push_current (src, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
--- 590,594 ----
    }
  
!   gl = &src->backend->gl;
  
    if (glitz_surface_push_current (src, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
***************
*** 856,867 ****
    }
    
!   if (buffer->format.scanline_order == GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN)
      transform |= GLITZ_TRANSFORM_SCANLINE_ORDER_MASK;
    
    /* find direct format */
!   format = _glitz_find_gl_pixel_format (&buffer->format);
!   if (format == NULL) {
      transform |= GLITZ_TRANSFORM_PIXELS_MASK;
!     format = _glitz_best_gl_pixel_format (src->format);
    }
    
--- 606,617 ----
    }
    
!   if (format->scanline_order == GLITZ_PIXEL_SCANLINE_ORDER_TOP_DOWN)
      transform |= GLITZ_TRANSFORM_SCANLINE_ORDER_MASK;
    
    /* find direct format */
!   gl_format = _glitz_find_gl_pixel_format (format);
!   if (gl_format == NULL) {
      transform |= GLITZ_TRANSFORM_PIXELS_MASK;
!     gl_format = _glitz_best_gl_pixel_format (src->format);
    }
    
***************
*** 876,880 ****
      }
  
!     stride = (((src_w * format->pixel.masks.bpp) / 8) + 3) & -4;
  
      data = malloc (stride * src_h);
--- 626,630 ----
      }
  
!     stride = (((src_w * gl_format->pixel.masks.bpp) / 8) + 3) & -4;
  
      data = malloc (stride * src_h);
***************
*** 887,894 ****
      bytes_per_line = stride;
    } else {
!     xoffset = buffer->format.xoffset;
!     bytes_per_line = buffer->format.bytes_per_line;
!     pixels = glitz_pixel_buffer_bind (buffer, GLITZ_GL_PIXEL_PACK_BUFFER);
!     pixels += buffer->format.skip_lines * bytes_per_line;
    }
    
--- 637,644 ----
      bytes_per_line = stride;
    } else {
!     xoffset = format->xoffset;
!     bytes_per_line = format->bytes_per_line;
!     pixels = glitz_buffer_bind (buffer, GLITZ_GL_PIXEL_PACK_BUFFER);
!     pixels += format->skip_lines * bytes_per_line;
    }
    
***************
*** 912,921 ****
      gl->read_pixels (x_src, src->height - y_src - height,
                       width, height,
!                      format->format, format->type,
                       pixels);
    } else {
      glitz_texture_bind (gl, texture);
      gl->get_tex_image (texture->target, 0,
!                        format->format, format->type,
                         pixels);
      glitz_texture_unbind (gl, texture);
--- 662,671 ----
      gl->read_pixels (x_src, src->height - y_src - height,
                       width, height,
!                      gl_format->format, gl_format->type,
                       pixels);
    } else {
      glitz_texture_bind (gl, texture);
      gl->get_tex_image (texture->target, 0,
!                        gl_format->format, gl_format->type,
                         pixels);
      glitz_texture_unbind (gl, texture);
***************
*** 925,939 ****
      glitz_image_t src_image, dst_image;
  
!     src_image.data = data + src_y * format->pixel.bytes_per_line;
!     src_image.format = &format->pixel;
      src_image.width = src_w;
      src_image.height = src_h;
  
!     dst_image.data =
!       glitz_pixel_buffer_get_data (buffer,
!                                    GLITZ_PIXEL_BUFFER_ACCESS_WRITE_ONLY);
!     dst_image.data += buffer->format.skip_lines *
!       buffer->format.bytes_per_line;
!     dst_image.format = &buffer->format;
      dst_image.width = width;
      dst_image.height = height;
--- 675,686 ----
      glitz_image_t src_image, dst_image;
  
!     src_image.data = data + src_y * gl_format->pixel.bytes_per_line;
!     src_image.format = &gl_format->pixel;
      src_image.width = src_w;
      src_image.height = src_h;
  
!     dst_image.data = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
!     dst_image.data += format->skip_lines * format->bytes_per_line;
!     dst_image.format = format;
      dst_image.width = width;
      dst_image.height = height;
***************
*** 943,952 ****
                              &dst_image,
                              src_x,
!                             buffer->format.xoffset,
                              width, height);
  
!     glitz_pixel_buffer_put_back_data (buffer);
    } else
!     glitz_pixel_buffer_unbind (buffer);
  
    glitz_surface_pop_current (src);
--- 690,699 ----
                              &dst_image,
                              src_x,
!                             format->xoffset,
                              width, height);
  
!     glitz_buffer_unmap (buffer);
    } else
!     glitz_buffer_unbind (buffer);
  
    glitz_surface_pop_current (src);

Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** glitz_program.c	18 Aug 2004 12:30:24 -0000	1.11
--- glitz_program.c	3 Sep 2004 14:27:58 -0000	1.12
***************
*** 39,71 ****
    "MUL result.color, color, fragment.color.a;"
  
! #define EXPAND_SRC_DECL "TEMP src_pos, src;"
  #define EXPAND_SRC_2D_IN_OP \
!   "DP4 src_pos.x, state.matrix.texture[1].row[0], fragment.texcoord[1];" \
!   "DP4 src_pos.y, state.matrix.texture[1].row[1], fragment.texcoord[1];" \
!   "DP4 src_pos.w, state.matrix.texture[1].row[3], fragment.texcoord[1];" \
!   "TXP src, src_pos, texture[1], 2D;" \
    "DP4 color.a, color, fragment.color;" \
    "MUL result.color, src, color.a;"
  #define EXPAND_SRC_RECT_IN_OP \
!   "DP4 src_pos.x, state.matrix.texture[1].row[0], fragment.texcoord[1];" \
!   "DP4 src_pos.y, state.matrix.texture[1].row[1], fragment.texcoord[1];" \
!   "DP4 src_pos.w, state.matrix.texture[1].row[3], fragment.texcoord[1];" \
!   "TEX src, fragment.texcoord[1], texture[1], RECT;" \
    "DP4 color.a, color, fragment.color;" \
    "MUL result.color, src, color.a;"
  
! #define EXPAND_MASK_DECL "TEMP mask_pos, mask;"
  #define EXPAND_MASK_2D_IN_OP \
!   "DP4 mask_pos.x, state.matrix.texture[0].row[0], fragment.texcoord[0];" \
!   "DP4 mask_pos.y, state.matrix.texture[0].row[1], fragment.texcoord[0];" \
!   "DP4 mask_pos.w, state.matrix.texture[0].row[3], fragment.texcoord[0];" \
!   "TXP mask, mask_pos, texture[0], 2D;" \
    "DP4 mask.a, mask, fragment.color;" \
    "MUL result.color, color, mask.a;"
  
  #define EXPAND_MASK_RECT_IN_OP \
-   "DP4 mask_pos.x, state.matrix.texture[0].row[0], fragment.texcoord[0];" \
-   "DP4 mask_pos.y, state.matrix.texture[0].row[1], fragment.texcoord[0];" \
-   "DP4 mask_pos.w, state.matrix.texture[0].row[3], fragment.texcoord[0];" \
    "TXP mask, fragment.texcoord[0], texture[0], RECT;" \
    "DP4 mask.a, mask, fragment.color;" \
--- 39,59 ----
    "MUL result.color, color, fragment.color.a;"
  
! #define EXPAND_SRC_DECL "TEMP src;"
  #define EXPAND_SRC_2D_IN_OP \
!   "TXP src, fragment.texcoord[1], texture[1], 2D;" \
    "DP4 color.a, color, fragment.color;" \
    "MUL result.color, src, color.a;"
  #define EXPAND_SRC_RECT_IN_OP \
!   "TXP src, fragment.texcoord[1], texture[1], RECT;" \
    "DP4 color.a, color, fragment.color;" \
    "MUL result.color, src, color.a;"
  
! #define EXPAND_MASK_DECL "TEMP mask;"
  #define EXPAND_MASK_2D_IN_OP \
!   "TXP mask, fragment.texcoord[0], texture[0], 2D;" \
    "DP4 mask.a, mask, fragment.color;" \
    "MUL result.color, color, mask.a;"
  
  #define EXPAND_MASK_RECT_IN_OP \
    "TXP mask, fragment.texcoord[0], texture[0], RECT;" \
    "DP4 mask.a, mask, fragment.color;" \
***************
*** 112,127 ****
  
  /*
-  * 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
- };
- 
- /*
   * general convolution filter (projective transformations might not
   * produce correct results).
--- 100,103 ----
***************
*** 130,150 ****
    "!!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
--- 106,121 ----
    "!!ARBfp1.0",
    "PARAM p[%d] = { program.local[0..%d] };",
    "ATTRIB pos = fragment.texcoord[%s];",
!   "TEMP color, in, coord;",
  
    /* extra declerations */
    "%s"
  
!   "MOV coord, pos;", NULL
  };
  
  static const char *_convolution_sample_first[] = {
!   "ADD coord.x, pos.x, p[0].x;",
!   "ADD coord.y, pos.y, p[0].y;",
    "TXP in, coord, texture[%s], %s;",
    "MUL color, in, p[0].z;", NULL
***************
*** 152,157 ****
  
  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
--- 123,128 ----
  
  static const char *_convolution_sample[] = {
!   "ADD coord.x, pos.x, p[%d].x;",
!   "ADD coord.y, pos.y, p[%d].y;",
    "TXP in, coord, texture[%s], %s;",
    "MAD color, in, p[%d].z, color;", NULL
***************
*** 166,179 ****
    "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 */
!   "%s",
! 
!   /* affine transform */
!   "DP4 position.x, m[0], pos;",
!   "DP4 position.y, m[1], pos;", NULL
  };
  
--- 137,145 ----
    "PARAM gradient = program.local[0];",
    "PARAM stops[%d] = { program.local[1..%d] };",
    "ATTRIB pos = fragment.texcoord[%s];",
    "TEMP color, second_color, stop0, stop1, position;",
  
    /* extra declerations */
!   "%s", NULL
  };
  
***************
*** 183,192 ****
   * 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
--- 149,158 ----
   * gradient.x = start offset
   * gradient.y = 1 / length
!  * gradient.z = cos (angle)
!  * gradient.w = -sin (angle)
   */
  static const char *_linear_gradient_calculations[] = {
!   "MUL position.x, gradient.z, pos.x;",
!   "MAD position.x, gradient.w, pos.y, position.x;",
    "SUB position.z, position.x, gradient.x;",
    "MUL position.z, position.z, gradient.y;", NULL
***************
*** 202,206 ****
   */
  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;",
--- 168,172 ----
   */
  static const char *_radial_gradient_calculations[] = {
!   "SUB position, pos, gradient;",
    "MUL position.x, position.x, position.x;",
    "MAD position.x, position.y, position.y, position.x;",
***************
*** 257,300 ****
  
  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);
-   gl->bind_program (GLITZ_GL_VERTEX_PROGRAM, program);
-   gl->program_string (GLITZ_GL_VERTEX_PROGRAM,
-                       GLITZ_GL_PROGRAM_FORMAT_ASCII,
-                       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)
--- 223,226 ----
***************
*** 349,362 ****
  }
  
- 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
--- 275,278 ----
***************
*** 399,403 ****
      
      _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);
--- 315,319 ----
      
      _string_array_to_char_array (buffer, _convolution_header);
!     p += sprintf (p, buffer, id, id - 1, tex, expand->declarations);
      
      _string_array_to_char_array (buffer, _convolution_sample_first);
***************
*** 426,430 ****
      
      _string_array_to_char_array (buffer, _gradient_header);
!     p += sprintf (p, buffer, id, id, tex, tex, expand->declarations);
      
      switch (fp_type) {
--- 342,346 ----
      
      _string_array_to_char_array (buffer, _gradient_header);
!     p += sprintf (p, buffer, id, id, tex, expand->declarations);
      
      switch (fp_type) {
***************
*** 520,528 ****
      }
    }
-   
-   if (map->vp > 0) {
-     program = map->vp;
-     gl->delete_programs (1, &program);
-   }
  }
  
--- 436,439 ----
***************
*** 537,559 ****
  
  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,
--- 448,451 ----
***************
*** 564,568 ****
    int t1 = TEXTURE_INDEX (op->mask);
  
!   program = &op->dst->program_map->filters[op->type][fp_type].fp[t0][t1];
    
    if (program->size < id) {
--- 456,461 ----
    int t1 = TEXTURE_INDEX (op->mask);
  
!   program =
!     &op->dst->backend->program_map->filters[op->type][fp_type].fp[t0][t1];
    
    if (program->size < id) {

Index: glitz_rect.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_rect.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_rect.c	18 Aug 2004 12:30:24 -0000	1.7
--- glitz_rect.c	3 Sep 2004 14:27:58 -0000	1.8
***************
*** 1,5 ****
  /*
!  * Copyright © 2004 David Reveman, Peter Nilsson
!  *
   * Permission to use, copy, modify, distribute, and sell this software
   * and its documentation for any purpose is hereby granted without
--- 1,5 ----
  /*
!  * Copyright © 2004 David Reveman
!  * 
   * Permission to use, copy, modify, distribute, and sell this software
   * and its documentation for any purpose is hereby granted without
***************
*** 7,27 ****
   * and that both that copyright notice and this permission notice
   * appear in supporting documentation, and that the names of
!  * David Reveman and Peter Nilsson not be used in advertising or
!  * publicity pertaining to distribution of the software without
!  * specific, written prior permission. David Reveman and Peter Nilsson
!  * makes no representations about the suitability of this software for
!  * any purpose. It is provided "as is" without express or implied warranty.
   *
!  * DAVID REVEMAN AND PETER NILSSON DISCLAIMS ALL WARRANTIES WITH
!  * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
!  * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DAVID REVEMAN AND
!  * PETER NILSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
!  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
!  * OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
!  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
!  * PERFORMANCE OF THIS SOFTWARE.
   *
!  * Authors: David Reveman <c99drn at cs.umu.se>
!  *          Peter Nilsson <c99pnn at cs.umu.se>
   */
  
--- 7,25 ----
   * and that both that copyright notice and this permission notice
   * appear in supporting documentation, and that the names of
!  * David Reveman not be used in advertising or publicity pertaining to
!  * distribution of the software without specific, written prior permission.
!  * David Reveman makes no representations about the suitability of this
!  * software for any purpose. It is provided "as is" without express or
!  * implied warranty.
   *
!  * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
!  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
!  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
!  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
!  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
!  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
!  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   *
!  * Author: David Reveman <c99drn at cs.umu.se>
   */
  
***************
*** 39,46 ****
  
  static void
! glitz_rectangle_bounds (int x_offset,
!                         int y_offset,
                          int n_rects,
-                         const glitz_rectangle_t *rects,
                          glitz_bounding_box_t *box)
  {
--- 37,42 ----
  
  static void
! glitz_rectangle_bounds (const glitz_rectangle_t *rects,
                          int n_rects,
                          glitz_bounding_box_t *box)
  {
***************
*** 60,171 ****
        box->y2 = rects->y + rects->height;
    }
- 
-   box->x1 += x_offset;
-   box->x2 += x_offset;
-   box->y1 += y_offset;
-   box->y2 += y_offset;
  }
  
  void
! 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,
!                            int n_rects)
  {
!   glitz_gl_proc_address_list_t *gl = dst->gl;
!   glitz_gl_bitfield_t clear_mask;
    
!   if (op == GLITZ_OPERATOR_SRC && (!*dst->stencil_mask)) {
!     clear_mask = GLITZ_GL_COLOR_BUFFER_BIT;
      gl->clear_color (color->red / (glitz_gl_clampf_t) 0xffff,
                       color->green / (glitz_gl_clampf_t) 0xffff,
                       color->blue / (glitz_gl_clampf_t) 0xffff,
                       color->alpha / (glitz_gl_clampf_t) 0xffff);
!   } else if (op == (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SET) {
!     clear_mask = GLITZ_GL_STENCIL_BUFFER_BIT;
!     gl->clear_stencil (*dst->stencil_mask);
!   } else {
!     if (op == (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SRC)
!       op = GLITZ_OPERATOR_SRC;
!     
!     clear_mask = 0x0;
!   }
!   
!   if (clear_mask) {
      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);
!       gl->clear (clear_mask);
      }
!     dst->update_mask |= GLITZ_UPDATE_SCISSOR_MASK;
    } else {
!     glitz_gl_vertex_2i_t vertex_2i = gl->vertex_2i;
!     
!     gl->color_4us (color->red, color->green, color->blue, color->alpha);
!       
!     glitz_set_operator (gl, op);
!       
!     gl->begin (GLITZ_GL_QUADS);
!       
!     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);
      }
!   
!     gl->end ();
!   }
! }
  
! /* This is a hack that allows drawing with GLITZ_OPERATOR_SRC
!    to all solid surfaces (1x1 surfaces) just by scaling the color
!    to the appropriate format and storing it in the surface's solid
!    color. */
! static void
! _glitz_fill_solid (glitz_surface_t *dst,
!                    const glitz_color_t *color)
! {  
!   STORE_16 (dst->solid.red, dst->format->red_size, color->red);
!   STORE_16 (dst->solid.green, dst->format->green_size, color->green);
!   STORE_16 (dst->solid.blue, dst->format->blue_size, color->blue);
!   STORE_16 (dst->solid.alpha, dst->format->alpha_size, color->alpha);
    
!   dst->hint_mask |= GLITZ_INT_HINT_DRAWABLE_DIRTY_MASK;
  }
  
  void
! glitz_fill_rectangle (glitz_operator_t op,
!                       glitz_surface_t *dst,
!                       const glitz_color_t *color,
!                       int x,
!                       int y,
!                       unsigned int width,
!                       unsigned int height)
  {
-   glitz_bounding_box_t bounds;
    glitz_rectangle_t rect;
  
-   bounds.x1 = x;
-   bounds.x2 = x + width;
-   bounds.y1 = y;
-   bounds.y2 = y + height;
-   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
-       bounds.x2 < 0 || bounds.y2 < 0)
-     return;
- 
-   if (SURFACE_SOLID (dst) && SURFACE_OFFSCREEN (dst) &&
-       op == GLITZ_OPERATOR_SRC && width > 0 && height > 0) {
-     _glitz_fill_solid (dst, color);
-     return;
-   }
- 
    rect.x = x;
    rect.y = y;
--- 56,159 ----
        box->y2 = rects->y + rects->height;
    }
  }
  
  void
! glitz_set_rectangles (glitz_surface_t *dst,
!                       const glitz_color_t *color,
!                       const glitz_rectangle_t *rects,
!                       int n_rects)
  {
!   glitz_bounding_box_t bounds;
!   glitz_gl_proc_address_list_t *gl = &dst->backend->gl;
! 
!   glitz_rectangle_bounds (rects, n_rects, &bounds);
!   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
!       bounds.x2 < 0 || bounds.y2 < 0)
!     return;
! 
!   if (SURFACE_SOLID (dst) && SURFACE_OFFSCREEN (dst) &&
!       (bounds.x2 - bounds.x1) > 0 && (bounds.y2 - bounds.y1) > 0) {
!     STORE_16 (dst->solid.red, dst->format->red_size, color->red);
!     STORE_16 (dst->solid.green, dst->format->green_size, color->green);
!     STORE_16 (dst->solid.blue, dst->format->blue_size, color->blue);
!     STORE_16 (dst->solid.alpha, dst->format->alpha_size, color->alpha);
!     
!     dst->flags |= GLITZ_FLAG_DRAWABLE_DIRTY_MASK;
!     return;
!   }
    
!   if (glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
      gl->clear_color (color->red / (glitz_gl_clampf_t) 0xffff,
                       color->green / (glitz_gl_clampf_t) 0xffff,
                       color->blue / (glitz_gl_clampf_t) 0xffff,
                       color->alpha / (glitz_gl_clampf_t) 0xffff);
! 
      for (; n_rects; n_rects--, rects++) {
!       gl->scissor (rects->x,
!                    dst->height - rects->y - rects->height,
                     rects->width,
                     rects->height);
!       gl->clear (GLITZ_GL_COLOR_BUFFER_BIT);
      }
!     glitz_surface_dirty (dst, &bounds);
    } else {
!     static glitz_pixel_format_t pf = {
!       {
!         32,
!         0xff000000,
!         0x00ff0000,
!         0x0000ff00,
!         0x000000ff
!       },
!       0, 0, 0,
!       GLITZ_PIXEL_SCANLINE_ORDER_BOTTOM_UP
!     };
!     glitz_buffer_t *buffer;
!     unsigned int size, pixel, *p;
! 
!     size = (bounds.x2 - bounds.x1) * (bounds.y2 - bounds.y1);
!     buffer =
!       glitz_pixel_buffer_create (dst,
!                                  NULL,
!                                  size * 4,
!                                  GLITZ_BUFFER_HINT_STREAM_DRAW);
!     if (!buffer) {
!       glitz_surface_status_add (dst, GLITZ_STATUS_NO_MEMORY_MASK);
!       return;
      }
!     
!     pixel =
!       ((((unsigned int) color->red * 0xff) / 0xffff) << 24) |
!       ((((unsigned int) color->green * 0xff) / 0xffff) << 16) |
!       ((((unsigned int) color->blue * 0xff) / 0xffff) << 8) |
!       ((((unsigned int) color->alpha * 0xff) / 0xffff));
!     
!     p = glitz_buffer_map (buffer, GLITZ_BUFFER_ACCESS_WRITE_ONLY);
!     
!     for (; size; size--, p++)
!       *p = pixel;
!     
!     glitz_buffer_unmap (buffer);
  
!     for (; n_rects; n_rects--, rects++)
!       glitz_set_pixels (dst,
!                         rects->x, rects->y,
!                         rects->width, rects->height,
!                         &pf, buffer);
!   }
    
!   glitz_surface_pop_current (dst);
  }
  
  void
! glitz_set_rectangle (glitz_surface_t *dst,
!                      const glitz_color_t *color,
!                      int x,
!                      int y,
!                      unsigned int width,
!                      unsigned int height)
  {
    glitz_rectangle_t rect;
  
    rect.x = x;
    rect.y = y;
***************
*** 173,223 ****
    rect.height = height;
  
!   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;
!   }
! 
!   glitz_int_fill_rectangles (op, dst, 0, 0, color, &rect, 1);
! 
!   glitz_surface_dirty (dst, &bounds);
!   glitz_surface_pop_current (dst);
! }
! slim_hidden_def(glitz_fill_rectangle);
! 
! void
! 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,
!                        int n_rects)
! {
!   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)
!     return;
! 
!   if (SURFACE_SOLID (dst) && SURFACE_OFFSCREEN (dst) &&
!       op == GLITZ_OPERATOR_SRC &&
!       (bounds.x2 - bounds.x1) > 0 && (bounds.y2 - bounds.y1) > 0) {
!     _glitz_fill_solid (dst, color);
!     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;
!   }
! 
!   glitz_int_fill_rectangles (op, dst, x_offset, y_offset,
!                              color, rects, n_rects);
! 
!   glitz_surface_dirty (dst, &bounds);
!   glitz_surface_pop_current (dst);
  }
! slim_hidden_def(glitz_fill_rectangles);
--- 161,165 ----
    rect.height = height;
  
!   glitz_set_rectangles (dst, color, &rect, 1);
  }
! slim_hidden_def(glitz_set_rectangle);

Index: glitz_status.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_status.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_status.c	9 Aug 2004 22:57:35 -0000	1.2
--- glitz_status.c	3 Sep 2004 14:27:58 -0000	1.3
***************
*** 38,49 ****
    case GLITZ_STATUS_NO_MEMORY:
      return GLITZ_STATUS_NO_MEMORY_MASK;
-   case GLITZ_STATUS_NULL_POINTER:
-     return GLITZ_STATUS_NULL_POINTER_MASK;
    case GLITZ_STATUS_BAD_COORDINATE:
      return GLITZ_STATUS_BAD_COORDINATE_MASK;
    case GLITZ_STATUS_NOT_SUPPORTED:
      return GLITZ_STATUS_NOT_SUPPORTED_MASK;
!   case GLITZ_STATUS_INVALID_MATRIX:
!     return GLITZ_STATUS_INVALID_MATRIX_MASK;
    case GLITZ_STATUS_SUCCESS:
      break;
--- 38,47 ----
    case GLITZ_STATUS_NO_MEMORY:
      return GLITZ_STATUS_NO_MEMORY_MASK;
    case GLITZ_STATUS_BAD_COORDINATE:
      return GLITZ_STATUS_BAD_COORDINATE_MASK;
    case GLITZ_STATUS_NOT_SUPPORTED:
      return GLITZ_STATUS_NOT_SUPPORTED_MASK;
!   case GLITZ_STATUS_CONTENT_DESTROYED:
!     return GLITZ_STATUS_CONTENT_DESTROYED_MASK;
    case GLITZ_STATUS_SUCCESS:
      break;
***************
*** 59,65 ****
      *mask &= ~GLITZ_STATUS_NO_MEMORY_MASK;
      return GLITZ_STATUS_NO_MEMORY;
-   } else if (*mask & GLITZ_STATUS_NULL_POINTER_MASK) {
-     *mask &= ~GLITZ_STATUS_NULL_POINTER_MASK;
-     return GLITZ_STATUS_NULL_POINTER;
    } else if (*mask & GLITZ_STATUS_BAD_COORDINATE_MASK) {
      *mask &= ~GLITZ_STATUS_BAD_COORDINATE_MASK;
--- 57,60 ----
***************
*** 68,75 ****
      *mask &= ~GLITZ_STATUS_NOT_SUPPORTED_MASK;
      return GLITZ_STATUS_NOT_SUPPORTED;
!   } else if (*mask & GLITZ_STATUS_INVALID_MATRIX_MASK) {
!     *mask &= ~GLITZ_STATUS_INVALID_MATRIX_MASK;
!     return GLITZ_STATUS_INVALID_MATRIX;
!   }
    
    return GLITZ_STATUS_SUCCESS;
--- 63,70 ----
      *mask &= ~GLITZ_STATUS_NOT_SUPPORTED_MASK;
      return GLITZ_STATUS_NOT_SUPPORTED;
!   } else if (*mask & GLITZ_STATUS_CONTENT_DESTROYED_MASK) {
!     *mask &= ~GLITZ_STATUS_CONTENT_DESTROYED_MASK;
!     return GLITZ_STATUS_CONTENT_DESTROYED;
!   } 
    
    return GLITZ_STATUS_SUCCESS;
***************
*** 84,95 ****
    case GLITZ_STATUS_NO_MEMORY:
      return "out of memory";
-   case GLITZ_STATUS_NULL_POINTER:
-     return "NULL pointer";
    case GLITZ_STATUS_BAD_COORDINATE:
      return "bad coordinate";
    case GLITZ_STATUS_NOT_SUPPORTED:
      return "not supported";
!   case GLITZ_STATUS_INVALID_MATRIX:
!     return "invalid matrix";
    }
  
--- 79,88 ----
    case GLITZ_STATUS_NO_MEMORY:
      return "out of memory";
    case GLITZ_STATUS_BAD_COORDINATE:
      return "bad coordinate";
    case GLITZ_STATUS_NOT_SUPPORTED:
      return "not supported";
!   case GLITZ_STATUS_CONTENT_DESTROYED:
!     return "content destroyed";
    }
  

--- glitz_stencil.c DELETED ---

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** glitz_surface.c	18 Aug 2004 12:30:24 -0000	1.18
--- glitz_surface.c	3 Sep 2004 14:27:58 -0000	1.19
***************
*** 1,5 ****
  /*
!  * Copyright © 2004 David Reveman, Peter Nilsson
!  *
   * Permission to use, copy, modify, distribute, and sell this software
   * and its documentation for any purpose is hereby granted without
--- 1,5 ----
  /*
!  * Copyright © 2004 David Reveman
!  * 
   * Permission to use, copy, modify, distribute, and sell this software
[...1178 lines suppressed...]
- 
- unsigned long
- glitz_surface_get_hints (glitz_surface_t *surface)
- {
-   unsigned hint_mask;
- 
-   hint_mask = surface->hint_mask & GLITZ_HINT_OFFSCREEN_MASK;
- 
-   if (*surface->stencil_mask)
-     hint_mask |= GLITZ_HINT_CLIPPING_MASK;
-   
-   if (surface->polyedge == GLITZ_POLYEDGE_SMOOTH &&
-       surface->format->multisample.samples < 2 &&
-       surface->format->stencil_size >= 4)
-     hint_mask |= GLITZ_HINT_MULTISAMPLE_MASK;
-   
-   return hint_mask;
- }
- slim_hidden_def(glitz_surface_get_hints);
--- 643,644 ----

Index: glitz_texture.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_texture.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** glitz_texture.c	9 Aug 2004 22:57:35 -0000	1.10
--- glitz_texture.c	3 Sep 2004 14:27:58 -0000	1.11
***************
*** 50,54 ****
      texture->target = GLITZ_GL_TEXTURE_2D;
      texture->repeatable = 1;
!     texture->texcoord_width = texture->texcoord_height = 1.0;
    } else {
      
--- 50,54 ----
      texture->target = GLITZ_GL_TEXTURE_2D;
      texture->repeatable = 1;
!     texture->texcoord_width = texture->texcoord_height = 1.0f;
    } else {
      
***************
*** 56,60 ****
        texture->target = GLITZ_GL_TEXTURE_2D;
        texture->repeatable = 1;
!       texture->texcoord_width = texture->texcoord_height = 1.0;
      } else {
        texture->repeatable = 0;
--- 56,60 ----
        texture->target = GLITZ_GL_TEXTURE_2D;
        texture->repeatable = 1;
!       texture->texcoord_width = texture->texcoord_height = 1.0f;
      } else {
        texture->repeatable = 0;
***************
*** 72,80 ****
            texture->height = glitz_uint_to_power_of_two (texture->height);
  
!         texture->texcoord_width = (double) width / (double) texture->width;
!         texture->texcoord_height = (double) height / (double) texture->height;
        }
      }
    }
  }
  
--- 72,83 ----
            texture->height = glitz_uint_to_power_of_two (texture->height);
  
!         texture->texcoord_width = (glitz_float_t) width / texture->width;
!         texture->texcoord_height = (glitz_float_t) height / texture->height;
        }
      }
    }
+ 
+   texture->texcoord_width_unit = texture->texcoord_width / texture->width;
+   texture->texcoord_height_unit = texture->texcoord_height / texture->height;
  }
  
***************
*** 178,225 ****
                              int y_texture)
  {
    int tex_height;
    
    glitz_surface_push_current (surface, GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
    
!   glitz_texture_bind (surface->gl, texture);
  
    if (surface->format->doublebuffer)
!     surface->gl->read_buffer (surface->read_buffer);
  
    if (texture->target == GLITZ_GL_TEXTURE_2D)
!     tex_height = (int) ((double) texture->height * texture->texcoord_height);
    else
      tex_height = (int) texture->texcoord_height;
    
!   surface->gl->copy_tex_sub_image_2d (texture->target, 0,
!                                       x_texture,
!                                       tex_height - y_texture - height,
!                                       x_surface,
!                                       surface->height - y_surface - height,
!                                       width, height);
  
!   glitz_texture_unbind (surface->gl, texture);
    glitz_surface_pop_current (surface);
  }
  
  void
! glitz_texture_tex_coord (glitz_texture_t *texture,
!                          double x,
!                          double y,
!                          double *return_x,
!                          double *return_y)
  {
!   if (texture->texcoord_width > 1.0) {
!     *return_x = x;
    } else {
!     *return_x = (x / (texture->width * texture->texcoord_width)) *
!       texture->texcoord_width;
!   }
    
!   if (texture->texcoord_height > 1.0) {
!     *return_y = y;
    } else {
!     *return_y = (y / (texture->height * texture->texcoord_height)) *
!       texture->texcoord_height;
    }
  }
--- 181,248 ----
                              int y_texture)
  {
+   glitz_gl_proc_address_list_t *gl = &surface->backend->gl;
    int tex_height;
    
    glitz_surface_push_current (surface, GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
    
!   glitz_texture_bind (gl, texture);
  
    if (surface->format->doublebuffer)
!     gl->read_buffer (surface->read_buffer);
  
    if (texture->target == GLITZ_GL_TEXTURE_2D)
!     tex_height = (int) (texture->height * texture->texcoord_height);
    else
      tex_height = (int) texture->texcoord_height;
    
!   gl->copy_tex_sub_image_2d (texture->target, 0,
!                              x_texture,
!                              tex_height - y_texture - height,
!                              x_surface,
!                              surface->height - y_surface - height,
!                              width, height);
  
!   glitz_texture_unbind (gl, texture);
    glitz_surface_pop_current (surface);
  }
  
  void
! glitz_texture_set_tex_gen (glitz_gl_proc_address_list_t *gl,
!                            glitz_texture_t *texture,
!                            int x_src,
!                            int y_src,
!                            int height,
!                            unsigned long flags)
  {
!   glitz_vec4_t plane;
! 
!   if (flags & GLITZ_FLAG_TEXTURE_COORDS_MASK) {
!     plane.v[1] = plane.v[2] = 0.0f;
!     plane.v[0] = texture->texcoord_width_unit;
!     plane.v[3] = -x_src * texture->texcoord_width_unit;
    } else {
!     plane.v[1] = plane.v[2] = 0.0f;
!     plane.v[0] = 1.0;
!     plane.v[3] = -x_src;
!   }   
    
!   gl->tex_gen_i (GLITZ_GL_S, GLITZ_GL_TEXTURE_GEN_MODE,
!                  GLITZ_GL_EYE_LINEAR);
!   gl->tex_gen_fv (GLITZ_GL_S, GLITZ_GL_EYE_PLANE, plane.v);
!   gl->enable (GLITZ_GL_TEXTURE_GEN_S);
! 
!   if (flags & GLITZ_FLAG_TEXTURE_COORDS_MASK) {
!     plane.v[0] = 0.0f;
!     plane.v[1] = -texture->texcoord_height_unit;
!     plane.v[3] = (y_src + height) * texture->texcoord_height_unit;
    } else {
!     plane.v[0] = 0.0f;
!     plane.v[1] = 1.0;
!     plane.v[3] = -y_src;
    }
+   
+   gl->tex_gen_i (GLITZ_GL_T, GLITZ_GL_TEXTURE_GEN_MODE,
+                  GLITZ_GL_EYE_LINEAR);
+   gl->tex_gen_fv (GLITZ_GL_T, GLITZ_GL_EYE_PLANE, plane.v);
+   gl->enable (GLITZ_GL_TEXTURE_GEN_T);
  }

--- glitz_trap.c DELETED ---

--- glitz_tri.c DELETED ---

Index: glitz_util.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_util.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_util.c	18 Aug 2004 12:30:24 -0000	1.8
--- glitz_util.c	3 Sep 2004 14:27:58 -0000	1.9
***************
*** 128,132 ****
    gl->viewport (-1, -1, 2, 2);
    
!   gl->raster_pos_2d (0, 0);
    gl->bitmap (0, 0, 1, 1, x, y, NULL);
    
--- 128,132 ----
    gl->viewport (-1, -1, 2, 2);
    
!   gl->raster_pos_2f (0, 0);
    gl->bitmap (0, 0, 1, 1, x, y, NULL);
    
***************
*** 138,142 ****
  
  void
! glitz_clamp_value (double *value, double min, double max)
  {
    if (*value < min)
--- 138,143 ----
  
  void
! glitz_clamp_value (glitz_float_t *value,
!                    glitz_float_t min, glitz_float_t max)
  {
    if (*value < min)
***************
*** 145,147 ****
      *value = max;
  }
- 
--- 146,147 ----

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** glitzint.h	18 Aug 2004 12:30:24 -0000	1.22
--- glitzint.h	3 Sep 2004 14:27:58 -0000	1.23
***************
*** 1,5 ****
  /*
!  * Copyright © 2004 David Reveman, Peter Nilsson
!  *
   * Permission to use, copy, modify, distribute, and sell this software
   * and its documentation for any purpose is hereby granted without
--- 1,5 ----
  /*
!  * Copyright © 2004 David Reveman
!  * 
   * Permission to use, copy, modify, distribute, and sell this software
   * and its documentation for any purpose is hereby granted without
***************
*** 7,27 ****
   * and that both that copyright notice and this permission notice
   * appear in supporting documentation, and that the names of
!  * David Reveman and Peter Nilsson not be used in advertising or
!  * publicity pertaining to distribution of the software without
!  * specific, written prior permission. David Reveman and Peter Nilsson
!  * makes no representations about the suitability of this software for
!  * any purpose. It is provided "as is" without express or implied warranty.
   *
!  * DAVID REVEMAN AND PETER NILSSON DISCLAIMS ALL WARRANTIES WITH
!  * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF
!  * MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DAVID REVEMAN AND
!  * PETER NILSSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
!  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
!  * OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
!  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
!  * PERFORMANCE OF THIS SOFTWARE.
   *
!  * Authors: David Reveman <c99drn at cs.umu.se>
!  *          Peter Nilsson <c99pnn at cs.umu.se>
   */
  
--- 7,25 ----
   * and that both that copyright notice and this permission notice
   * appear in supporting documentation, and that the names of
!  * David Reveman not be used in advertising or publicity pertaining to
!  * distribution of the software without specific, written prior permission.
!  * David Reveman makes no representations about the suitability of this
!  * software for any purpose. It is provided "as is" without express or
!  * implied warranty.
   *
!  * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
!  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
!  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
!  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
!  * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
!  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
!  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   *
!  * Author: David Reveman <c99drn at cs.umu.se>
   */
  
***************
*** 66,73 ****
  
  #define GLITZ_STATUS_NO_MEMORY_MASK          (1L << 0)
! #define GLITZ_STATUS_NULL_POINTER_MASK       (1L << 1)
! #define GLITZ_STATUS_BAD_COORDINATE_MASK     (1L << 2)
! #define GLITZ_STATUS_NOT_SUPPORTED_MASK      (1L << 3)
! #define GLITZ_STATUS_INVALID_MATRIX_MASK     (1L << 4)
  
  #define GLITZ_TEXTURE_TARGET_2D_MASK               (1L << 0)
--- 64,70 ----
  
  #define GLITZ_STATUS_NO_MEMORY_MASK          (1L << 0)
! #define GLITZ_STATUS_BAD_COORDINATE_MASK     (1L << 1)
! #define GLITZ_STATUS_NOT_SUPPORTED_MASK      (1L << 2)
! #define GLITZ_STATUS_CONTENT_DESTROYED_MASK  (1L << 3)
  
  #define GLITZ_TEXTURE_TARGET_2D_MASK               (1L << 0)
***************
*** 84,96 ****
    glitz_gl_enable_t enable;
    glitz_gl_disable_t disable;
!   glitz_gl_begin_t begin;
!   glitz_gl_end_t end;
!   glitz_gl_vertex_2i_t vertex_2i;
!   glitz_gl_vertex_2d_t vertex_2d;
    glitz_gl_tex_env_f_t tex_env_f;
    glitz_gl_tex_env_fv_t tex_env_fv;
!   glitz_gl_tex_coord_2d_t tex_coord_2d;
    glitz_gl_color_4us_t color_4us;
!   glitz_gl_color_4d_t color_4d;
    glitz_gl_scissor_t scissor;
    glitz_gl_blend_func_t blend_func;
--- 81,94 ----
    glitz_gl_enable_t enable;
    glitz_gl_disable_t disable;
!   glitz_gl_enable_client_state_t enable_client_state;
!   glitz_gl_disable_client_state_t disable_client_state;
!   glitz_gl_vertex_pointer_t vertex_pointer;
!   glitz_gl_draw_arrays_t draw_arrays;
    glitz_gl_tex_env_f_t tex_env_f;
    glitz_gl_tex_env_fv_t tex_env_fv;
!   glitz_gl_tex_gen_i_t tex_gen_i;
!   glitz_gl_tex_gen_fv_t tex_gen_fv;
    glitz_gl_color_4us_t color_4us;
!   glitz_gl_color_4f_t color_4f;
    glitz_gl_scissor_t scissor;
    glitz_gl_blend_func_t blend_func;
***************
*** 106,114 ****
    glitz_gl_pop_matrix_t pop_matrix;
    glitz_gl_load_identity_t load_identity;
!   glitz_gl_load_matrix_d_t load_matrix_d;
!   glitz_gl_mult_matrix_d_t mult_matrix_d;
    glitz_gl_depth_range_t depth_range;
    glitz_gl_viewport_t viewport;
!   glitz_gl_raster_pos_2d_t raster_pos_2d;
    glitz_gl_bitmap_t bitmap;
    glitz_gl_read_buffer_t read_buffer;
--- 104,111 ----
    glitz_gl_pop_matrix_t pop_matrix;
    glitz_gl_load_identity_t load_identity;
!   glitz_gl_load_matrix_f_t load_matrix_f;
    glitz_gl_depth_range_t depth_range;
    glitz_gl_viewport_t viewport;
!   glitz_gl_raster_pos_2f_t raster_pos_2f;
    glitz_gl_bitmap_t bitmap;
    glitz_gl_read_buffer_t read_buffer;
***************
*** 119,124 ****
    glitz_gl_pixel_store_i_t pixel_store_i;
    glitz_gl_ortho_t ortho;
!   glitz_gl_scale_d_t scale_d;
!   glitz_gl_translate_d_t translate_d;
    glitz_gl_hint_t hint;
    glitz_gl_depth_mask_t depth_mask;
--- 116,121 ----
    glitz_gl_pixel_store_i_t pixel_store_i;
    glitz_gl_ortho_t ortho;
!   glitz_gl_scale_f_t scale_f;
!   glitz_gl_translate_f_t translate_f;
    glitz_gl_hint_t hint;
    glitz_gl_depth_mask_t depth_mask;
***************
*** 132,136 ****
    glitz_gl_delete_textures_t delete_textures;
    glitz_gl_bind_texture_t bind_texture;
-   glitz_gl_tex_image_1d_t tex_image_1d;
    glitz_gl_tex_image_2d_t tex_image_2d;
    glitz_gl_tex_parameter_i_t tex_parameter_i;
--- 129,132 ----
***************
*** 140,149 ****
    
    glitz_gl_active_texture_t active_texture;
-   glitz_gl_multi_tex_coord_2d_t multi_tex_coord_2d;
    glitz_gl_gen_programs_t gen_programs;
    glitz_gl_delete_programs_t delete_programs;
    glitz_gl_program_string_t program_string;
    glitz_gl_bind_program_t bind_program;
!   glitz_gl_program_local_param_4d_t program_local_param_4d;
    glitz_gl_get_program_iv_t get_program_iv;
    glitz_gl_gen_buffers_t gen_buffers;
--- 136,144 ----
    
    glitz_gl_active_texture_t active_texture;
    glitz_gl_gen_programs_t gen_programs;
    glitz_gl_delete_programs_t delete_programs;
    glitz_gl_program_string_t program_string;
    glitz_gl_bind_program_t bind_program;
!   glitz_gl_program_local_param_4fv_t program_local_param_4fv;
    glitz_gl_get_program_iv_t get_program_iv;
    glitz_gl_gen_buffers_t gen_buffers;
***************
*** 151,156 ****
--- 146,154 ----
    glitz_gl_bind_buffer_t bind_buffer;
    glitz_gl_buffer_data_t buffer_data;
+   glitz_gl_buffer_sub_data_t buffer_sub_data;
+   glitz_gl_get_buffer_sub_data_t get_buffer_sub_data;
    glitz_gl_map_buffer_t map_buffer;
    glitz_gl_unmap_buffer_t unmap_buffer;
+   
    glitz_bool_t need_lookup;
  } glitz_gl_proc_address_list_t;
***************
*** 215,219 ****
  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;
  
--- 213,216 ----
***************
*** 225,234 ****
  } glitz_constraint_t;
  
- typedef enum {
-   GLITZ_TRIANGLE_TYPE_NORMAL,
-   GLITZ_TRIANGLE_TYPE_STRIP,
-   GLITZ_TRIANGLE_TYPE_FAN
- } glitz_triangle_type_t;
- 
  typedef struct _glitz_bounding_box_t {
    int x1, x2, y1, y2;
--- 222,225 ----
***************
*** 236,244 ****
  
  typedef struct _glitz_point_t {
!   double x, y;
  } glitz_point_t;
  
  typedef struct _glitz_vec_t {
!   double v[4];
  } glitz_vec4_t;
  
--- 227,235 ----
  
  typedef struct _glitz_point_t {
!   glitz_float_t x, y;
  } glitz_point_t;
  
  typedef struct _glitz_vec_t {
!   glitz_float_t v[4];
  } glitz_vec4_t;
  
***************
*** 255,264 ****
    unsigned int height;
  
!   double texcoord_width;
!   double texcoord_height;
  
    glitz_bool_t repeatable;
  } glitz_texture_t;
  
  typedef struct glitz_surface_backend {
    glitz_surface_t *
--- 246,280 ----
    unsigned int height;
  
!   glitz_float_t texcoord_width;
!   glitz_float_t texcoord_height;
!   glitz_float_t texcoord_width_unit;
!   glitz_float_t texcoord_height_unit;
  
    glitz_bool_t repeatable;
  } glitz_texture_t;
  
+ struct _glitz_buffer {
+   glitz_gl_sizei_t size;
+   glitz_gl_uint_t name;
+   glitz_gl_enum_t target;
+   void *data;
+   int owns_data;
+   int ref_count;
+   glitz_surface_t *surface;
+ };
+ 
+ typedef struct _glitz_geometry {
+   glitz_gl_enum_t primitive;
+   glitz_gl_enum_t type;
+   glitz_gl_int_t first;
+   glitz_gl_sizei_t count;
+   glitz_buffer_t *buffer;
+   glitz_float_t x_offset;
+   glitz_float_t y_offset;
+ 
+   glitz_gl_uint_t default_name;
+   glitz_gl_float_t data[8];
+ } glitz_geometry_t;
+ 
  typedef struct glitz_surface_backend {
    glitz_surface_t *
***************
*** 283,366 ****
    
    void
-   (*update_size) (void *surface);
- 
-   void
    (*swap_buffers) (void *surface);
  
    glitz_bool_t
    (*make_current_read) (void *surface);
  } 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) \
!   ((surface)->hint_mask & GLITZ_HINT_OFFSCREEN_MASK)
  
  #define SURFACE_SOLID(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_SOLID_MASK)
  
  #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) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_MIRRORED_MASK)
  
  #define SURFACE_PAD(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_PAD_MASK)
  
  #define SURFACE_DIRTY(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_DIRTY_MASK)
  
  #define SURFACE_COMPONENT_ALPHA(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_COMPONENT_ALPHA_MASK)
  
  #define SURFACE_MULTISAMPLE(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_MULTISAMPLE_MASK)
  
  #define SURFACE_SOLID_DIRTY(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_SOLID_DIRTY_MASK)
  
  #define SURFACE_DRAWABLE_DIRTY(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_DRAWABLE_DIRTY_MASK)
! 
! #define SURFACE_POLYGON_OP(surface) \
!   ((surface)->hint_mask & GLITZ_INT_HINT_POLYGON_OP_MASK)
  
  #define SURFACE_FRAGMENT_FILTER(surface) \
!   ((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;
!   double y;
  } glitz_sample_offset_t;
  
--- 299,380 ----
    
    void
    (*swap_buffers) (void *surface);
  
    glitz_bool_t
    (*make_current_read) (void *surface);
+ 
+   glitz_gl_proc_address_list_t gl;
+   glitz_format_t *formats;
+   int n_formats;
+   glitz_program_map_t *program_map;
+   unsigned long feature_mask;
  } glitz_surface_backend_t;
  
! #define GLITZ_FLAG_SOLID_MASK                   (1L <<  0)
! #define GLITZ_FLAG_OFFSCREEN_MASK               (1L <<  1)
! #define GLITZ_FLAG_REPEAT_MASK                  (1L <<  2)
! #define GLITZ_FLAG_MIRRORED_MASK                (1L <<  3)
! #define GLITZ_FLAG_PAD_MASK                     (1L <<  4)
! #define GLITZ_FLAG_DIRTY_MASK                   (1L <<  5)
! #define GLITZ_FLAG_COMPONENT_ALPHA_MASK         (1L <<  6)
! #define GLITZ_FLAG_MULTISAMPLE_MASK             (1L <<  7)
! #define GLITZ_FLAG_NICEST_MULTISAMPLE_MASK      (1L <<  8)
! #define GLITZ_FLAG_SOLID_DIRTY_MASK             (1L <<  9)
! #define GLITZ_FLAG_DRAWABLE_DIRTY_MASK          (1L << 10)
! #define GLITZ_FLAG_FRAGMENT_FILTER_MASK         (1L << 11)
! #define GLITZ_FLAG_LINEAR_TRANSFORM_FILTER_MASK (1L << 12)
! #define GLITZ_FLAG_DRAWABLE_MASK                (1L << 13)
! #define GLITZ_FLAG_IGNORE_REPEAT_MASK           (1L << 14)
! #define GLITZ_FLAG_TEXTURE_COORDS_MASK          (1L << 15)
  
  #define SURFACE_OFFSCREEN(surface) \
!   ((surface)->flags & GLITZ_FLAG_OFFSCREEN_MASK)
  
  #define SURFACE_SOLID(surface) \
!   ((surface)->flags & GLITZ_FLAG_SOLID_MASK)
  
  #define SURFACE_REPEAT(surface) \
!   (((surface)->flags & GLITZ_FLAG_REPEAT_MASK) && \
!    (!((surface)->flags & GLITZ_FLAG_IGNORE_REPEAT_MASK)))
  
  #define SURFACE_MIRRORED(surface) \
!   ((surface)->flags & GLITZ_FLAG_MIRRORED_MASK)
  
  #define SURFACE_PAD(surface) \
!   ((surface)->flags & GLITZ_FLAG_PAD_MASK)
  
  #define SURFACE_DIRTY(surface) \
!   ((surface)->flags & GLITZ_FLAG_DIRTY_MASK)
  
  #define SURFACE_COMPONENT_ALPHA(surface) \
!   ((surface)->flags & GLITZ_FLAG_COMPONENT_ALPHA_MASK)
  
  #define SURFACE_MULTISAMPLE(surface) \
!   ((surface)->flags & GLITZ_FLAG_MULTISAMPLE_MASK)
! 
! #define SURFACE_NICEST_MULTISAMPLE(surface) \
!   ((surface)->flags & GLITZ_FLAG_NICEST_MULTISAMPLE_MASK)
  
  #define SURFACE_SOLID_DIRTY(surface) \
!   ((surface)->flags & GLITZ_FLAG_SOLID_DIRTY_MASK)
  
  #define SURFACE_DRAWABLE_DIRTY(surface) \
!   ((surface)->flags & GLITZ_FLAG_DRAWABLE_DIRTY_MASK)
  
  #define SURFACE_FRAGMENT_FILTER(surface) \
!   ((surface)->flags & GLITZ_FLAG_FRAGMENT_FILTER_MASK)
  
  #define SURFACE_LINEAR_TRANSFORM_FILTER(surface) \
!   ((surface)->flags & GLITZ_FLAG_LINEAR_TRANSFORM_FILTER_MASK)
  
  #define SURFACE_DRAWABLE(surface) \
!   ((surface)->flags & GLITZ_FLAG_DRAWABLE_MASK)
  
! #define SURFACE_TEXTURE_COORDS(surface) \
!   ((surface)->flags & GLITZ_FLAG_TEXTURE_COORDS_MASK)
  
  typedef struct _glitz_sample_offset {
!   glitz_float_t x;
!   glitz_float_t y;
  } glitz_sample_offset_t;
  
***************
*** 369,419 ****
    unsigned short *weights;
    int n_samples;
! } glitz_multi_sample_info_t;
! 
! /* GLITZ_BUFFER_BACK and GLITZ_BUFFER_FRONT */
! #define GLITZ_N_STENCIL_MASKS 2
  
  typedef struct _glitz_filter_params_t glitz_filter_params_t;
  
! typedef struct _glitz_projective_transform {
!   double m[16];
!   double m_norm[16];
! } glitz_projective_transform_t;
  
  #define GLITZ_UPDATE_VIEWPORT_MASK    (1L << 0)
! #define GLITZ_UPDATE_SCISSOR_MASK     (1L << 1)
! #define GLITZ_UPDATE_DRAW_BUFFER_MASK (1L << 2)
! #define GLITZ_UPDATE_STENCIL_OP_MASK  (1L << 3)
! #define GLITZ_UPDATE_MULTISAMPLE_MASK (1L << 4)
! #define GLITZ_UPDATE_ALL_MASK         ((1L << 5) - 1)
  
  struct _glitz_surface {
!   const glitz_surface_backend_t *backend;
  
    int ref_count;
    glitz_format_t *format;
-   glitz_format_t *formats;
-   int n_formats;
    glitz_texture_t texture;
    unsigned long status_mask;
-   unsigned long feature_mask;
    unsigned long update_mask;
    glitz_filter_t filter;
    glitz_filter_params_t *filter_params;
!   glitz_polyedge_t polyedge;
!   glitz_polyedge_smooth_hint_t polyedge_smooth_hint;
!   glitz_projective_transform_t *transform;
    int width, height;
    glitz_bounding_box_t dirty_box;
!   glitz_gl_proc_address_list_t *gl;
!   glitz_program_map_t *program_map;
!   unsigned int stencil_masks[GLITZ_N_STENCIL_MASKS];
!   unsigned int *stencil_mask;
!   unsigned long hint_mask;
!   unsigned short polyopacity;
    glitz_gl_enum_t draw_buffer;
    glitz_gl_enum_t read_buffer;
!   glitz_multi_sample_info_t *multi_sample;
    glitz_color_t solid;
  };
  
--- 383,419 ----
    unsigned short *weights;
    int n_samples;
! } glitz_sample_info_t;
  
  typedef struct _glitz_filter_params_t glitz_filter_params_t;
  
! typedef struct _glitz_matrix {
!   glitz_float_t t[16];
!   glitz_float_t m[16];
! } glitz_matrix_t;
  
  #define GLITZ_UPDATE_VIEWPORT_MASK    (1L << 0)
! #define GLITZ_UPDATE_DRAW_BUFFER_MASK (1L << 1)
! #define GLITZ_UPDATE_MULTISAMPLE_MASK (1L << 2)
! #define GLITZ_UPDATE_ALL_MASK         ((1L << 3) - 1)
  
  struct _glitz_surface {
!   glitz_surface_backend_t *backend;
  
    int ref_count;
    glitz_format_t *format;
    glitz_texture_t texture;
    unsigned long status_mask;
    unsigned long update_mask;
    glitz_filter_t filter;
    glitz_filter_params_t *filter_params;
!   glitz_matrix_t *transform;
    int width, height;
    glitz_bounding_box_t dirty_box;
!   unsigned long flags;
    glitz_gl_enum_t draw_buffer;
    glitz_gl_enum_t read_buffer;
!   glitz_sample_info_t *indirect;
    glitz_color_t solid;
+   glitz_geometry_t geometry;
  };
  
***************
*** 446,450 ****
    glitz_component_alpha_type_t component_alpha;
    glitz_gl_uint_t fp;
-   glitz_gl_uint_t vp;
    int count;
  };
--- 446,449 ----
***************
*** 455,482 ****
  } glitz_extension_map;
  
- typedef enum glitz_int_operator {
-   GLITZ_INT_OPERATOR_STENCIL_RECT_SET = 1000,
-   GLITZ_INT_OPERATOR_STENCIL_RECT_SRC
- } glitz_int_operator_t;
- 
  extern void __internal_linkage
  glitz_set_operator (glitz_gl_proc_address_list_t *gl, glitz_operator_t op);
  
- typedef enum glitz_stencil_operator {
-   GLITZ_STENCIL_OPERATOR_SET = GLITZ_CLIP_OPERATOR_SET,
-   GLITZ_STENCIL_OPERATOR_UNION = GLITZ_CLIP_OPERATOR_UNION,
-   GLITZ_STENCIL_OPERATOR_INTERSECT = GLITZ_CLIP_OPERATOR_INTERSECT,
-   GLITZ_STENCIL_OPERATOR_CLEAR,
-   GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
-   GLITZ_STENCIL_OPERATOR_DECR_LESS,
-   GLITZ_STENCIL_OPERATOR_CLIP_EQUAL,
-   GLITZ_STENCIL_OPERATOR_CLIP
- } glitz_stencil_operator_t;
- 
- extern void __internal_linkage
- glitz_set_stencil_operator (glitz_gl_proc_address_list_t *gl,
-                             glitz_stencil_operator_t op,
-                             unsigned int mask);
- 
  void
  glitz_intersect_bounding_box (glitz_bounding_box_t *box1,
--- 454,460 ----
***************
*** 502,506 ****
  
  extern void __internal_linkage
! glitz_clamp_value (double *value, double min, double max);
  
  void
--- 480,485 ----
  
  extern void __internal_linkage
! glitz_clamp_value (glitz_float_t *value,
!                    glitz_float_t min, glitz_float_t max);
  
  void
***************
*** 548,567 ****
  
  void
! glitz_texture_tex_coord (glitz_texture_t *texture,
!                          double x,
!                          double y,
!                          double *return_x,
!                          double *return_y);
  
  void
  glitz_surface_init (glitz_surface_t *surface,
!                     const glitz_surface_backend_t *backend,
!                     glitz_gl_proc_address_list_t *gl,
                      glitz_format_t *format,
-                     glitz_format_t *formats,
-                     int n_formats,
                      int width,
                      int height,
-                     glitz_program_map_t *program_map,
                      unsigned long texture_mask);
  
--- 527,543 ----
  
  void
! glitz_texture_set_tex_gen (glitz_gl_proc_address_list_t *gl,
!                            glitz_texture_t *texture,
!                            int x_src,
!                            int y_src,
!                            int height,
!                            unsigned long flags);
  
  void
  glitz_surface_init (glitz_surface_t *surface,
!                     glitz_surface_backend_t *backend,
                      glitz_format_t *format,
                      int width,
                      int height,
                      unsigned long texture_mask);
  
***************
*** 574,583 ****
  
  extern void __internal_linkage
- glitz_surface_reference (glitz_surface_t *surface);
- 
- extern void __internal_linkage
- glitz_surface_destory (glitz_surface_t *surface);
- 
- extern void __internal_linkage
  glitz_surface_ensure_solid (glitz_surface_t *surface);
  
--- 550,553 ----
***************
*** 602,611 ****
  glitz_surface_update_state (glitz_surface_t *surface);
  
- extern void __internal_linkage
- glitz_surface_enable_anti_aliasing (glitz_surface_t *surface);
- 
- extern void __internal_linkage
- glitz_surface_disable_anti_aliasing (glitz_surface_t *surface);
- 
  extern unsigned long __internal_linkage
  glitz_status_to_status_mask (glitz_status_t status);
--- 572,575 ----
***************
*** 618,622 ****
  void
  glitz_format_for_each_texture_format (glitz_format_call_back_t call_back,
! 				      glitz_gl_proc_address_list_t *gl,
                                        void *ptr);
  
--- 582,586 ----
  void
  glitz_format_for_each_texture_format (glitz_format_call_back_t call_back,
!                                       glitz_gl_proc_address_list_t *gl,
                                        void *ptr);
  
***************
*** 646,652 ****
  
  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,
--- 610,613 ----
***************
*** 654,710 ****
  
  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,
-                            int n_rects);
- 
- extern void __internal_linkage
- glitz_int_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,
-                            int n_traps);
- 
- extern void __internal_linkage
- glitz_int_fill_triangles (glitz_operator_t op,
-                           glitz_surface_t *dst,
-                           glitz_triangle_type_t type,
-                           int x_offset,
-                           int y_offset,
-                           const glitz_color_t *color,
-                           const glitz_point_fixed_t *points,
-                           int n_points);
- 
- 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,
-                          int n_points);
- 
- extern void __internal_linkage
  glitz_composite_op_init (glitz_composite_op_t *op,
                           glitz_surface_t *src,
--- 615,618 ----
***************
*** 718,727 ****
  glitz_composite_disable (glitz_composite_op_t *op);
  
! extern char *__internal_linkage
! glitz_pixel_buffer_bind (glitz_pixel_buffer_t *buffer,
!                          glitz_gl_enum_t target);
  
  extern void __internal_linkage
! glitz_pixel_buffer_unbind (glitz_pixel_buffer_t *buffer);
  
  extern glitz_status_t __internal_linkage
--- 626,635 ----
  glitz_composite_disable (glitz_composite_op_t *op);
  
! extern void *__internal_linkage
! glitz_buffer_bind (glitz_buffer_t *buffer,
!                    glitz_gl_enum_t target);
  
  extern void __internal_linkage
! glitz_buffer_unbind (glitz_buffer_t *buffer);
  
  extern glitz_status_t __internal_linkage
***************
*** 750,753 ****
--- 658,676 ----
                       glitz_composite_op_t *op);
  
+ extern void __internal_linkage
+ glitz_geometry_enable_default (glitz_gl_proc_address_list_t *gl,
+                                glitz_surface_t *dst);
+ 
+ extern void __internal_linkage
+ glitz_geometry_enable (glitz_gl_proc_address_list_t *gl,
+                        glitz_surface_t *dst,
+                        glitz_gl_enum_t *primitive,
+                        glitz_gl_int_t *first,
+                        glitz_gl_sizei_t *count);
+ 
+ extern void __internal_linkage
+ glitz_geometry_disable (glitz_gl_proc_address_list_t *gl,
+                         glitz_surface_t *dst);
+ 
  #define MAXSHORT SHRT_MAX
  #define MINSHORT SHRT_MIN
***************
*** 767,771 ****
  #endif
  
! #define GLITZ_PI 3.14159265358979323846
  
  /* Fixed point updates from Carl Worth, USC, Information Sciences Institute */
--- 690,694 ----
  #endif
  
! #define GLITZ_PI 3.14159265358979323846f
  
  /* Fixed point updates from Carl Worth, USC, Information Sciences Institute */
***************
*** 814,819 ****
  #define FIXED_MOD2(f) ((f) & (FIXED1 | FIXED1_MINUS_E))
  
! #define FIXED_TO_DOUBLE(f) (((double) (f)) / 65536)
! #define DOUBLE_TO_FIXED(f) ((int) ((f) * 65536))
  
  #define SHORT_MULT(s1, s2) \
--- 737,742 ----
  #define FIXED_MOD2(f) ((f) & (FIXED1 | FIXED1_MINUS_E))
  
! #define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536)
! #define FLOAT_TO_FIXED(f) ((int) ((f) * 65536))
  
  #define SHORT_MULT(s1, s2) \
***************
*** 833,867 ****
  slim_hidden_proto(glitz_surface_set_component_alpha)
  slim_hidden_proto(glitz_surface_set_filter)
- slim_hidden_proto(glitz_surface_set_polyedge)
  slim_hidden_proto(glitz_surface_get_width)
  slim_hidden_proto(glitz_surface_get_height)
! slim_hidden_proto(glitz_surface_update_size)
! slim_hidden_proto(glitz_surface_set_read_buffer)
! slim_hidden_proto(glitz_surface_set_draw_buffer)
  slim_hidden_proto(glitz_surface_flush)
  slim_hidden_proto(glitz_surface_swap_buffers)
  slim_hidden_proto(glitz_surface_finish)
  slim_hidden_proto(glitz_surface_get_status)
- slim_hidden_proto(glitz_surface_get_gl_texture)
- slim_hidden_proto(glitz_surface_gl_begin)
- slim_hidden_proto(glitz_surface_gl_end)
  slim_hidden_proto(glitz_surface_get_features)
- slim_hidden_proto(glitz_surface_clip_rectangles)
- slim_hidden_proto(glitz_surface_clip_trapezoids)
- slim_hidden_proto(glitz_surface_clip_triangles)
  slim_hidden_proto(glitz_surface_get_format)
! slim_hidden_proto(glitz_surface_get_hints)
! slim_hidden_proto(glitz_fill_rectangle)
! 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)
! slim_hidden_proto(glitz_composite_tri_fan)
! slim_hidden_proto(glitz_color_triangles)
  
  #endif /* GLITZINT_H_INCLUDED */
--- 756,774 ----
  slim_hidden_proto(glitz_surface_set_component_alpha)
  slim_hidden_proto(glitz_surface_set_filter)
  slim_hidden_proto(glitz_surface_get_width)
  slim_hidden_proto(glitz_surface_get_height)
! slim_hidden_proto(glitz_surface_set_read_color_buffer)
! slim_hidden_proto(glitz_surface_set_draw_color_buffer)
  slim_hidden_proto(glitz_surface_flush)
  slim_hidden_proto(glitz_surface_swap_buffers)
  slim_hidden_proto(glitz_surface_finish)
  slim_hidden_proto(glitz_surface_get_status)
  slim_hidden_proto(glitz_surface_get_features)
  slim_hidden_proto(glitz_surface_get_format)
! slim_hidden_proto(glitz_set_rectangle)
! slim_hidden_proto(glitz_set_rectangles)
! slim_hidden_proto(glitz_set_geometry)
! slim_hidden_proto(glitz_buffer_set_data)
! slim_hidden_proto(glitz_buffer_get_data)
  
  #endif /* GLITZINT_H_INCLUDED */




More information about the cairo-commit mailing list