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

David Reveman commit at pdx.freedesktop.org
Mon Aug 9 15:57:38 PDT 2004


Committed by: davidr

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

Modified Files:
	Makefile.am glitz-agl.h glitz-glx.h glitz.c glitz.h glitz.man 
	glitz_agl_context.c glitz_agl_extension.c glitz_agl_format.c 
	glitz_agl_info.c glitz_agl_surface.c glitz_aglint.h 
	glitz_format.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_matrix.c 
	glitz_operator.c glitz_pixel.c glitz_program.c glitz_rect.c 
	glitz_status.c glitz_stencil.c glitz_surface.c glitz_texture.c 
	glitz_trap.c glitz_tri.c glitz_util.c glitzint.h 
Added Files:
	glitz_compose.c glitz_filter.c 
Removed Files:
	glitz_color_range.c glitz_programmatic.c glitz_render.c 
Log Message:
New internal composite interface

Index: Makefile.am
===================================================================
RCS file: /cvs/cairo/glitz/src/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** Makefile.am	21 Jun 2004 21:26:56 -0000	1.4
--- Makefile.am	9 Aug 2004 22:57:35 -0000	1.5
***************
*** 39,47 ****
  	glitz_format.c \
  	glitz_program.c \
! 	glitz_programmatic.c \
! 	glitz_color_range.c \
! 	glitz_render.c \
  	glitz_stencil.c \
  	glitz_pixel.c \
  	glitz_gl.h \
  	glitzint.h
--- 39,46 ----
  	glitz_format.c \
  	glitz_program.c \
! 	glitz_compose.c \
  	glitz_stencil.c \
  	glitz_pixel.c \
+ 	glitz_filter.c \
  	glitz_gl.h \
  	glitzint.h

Index: glitz-agl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz-agl.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** glitz-agl.h	24 May 2004 07:16:42 -0000	1.3
--- glitz-agl.h	9 Aug 2004 22:57:35 -0000	1.4
***************
*** 54,59 ****
    
  glitz_format_t *
! glitz_agl_find_standard_format (unsigned long option_mask,
!                                 glitz_format_name_t format_name);
  
    
--- 54,58 ----
    
  glitz_format_t *
! glitz_agl_find_standard_format (glitz_format_name_t format_name);
  
    

Index: glitz-glx.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz-glx.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** glitz-glx.h	24 May 2004 07:16:42 -0000	1.3
--- glitz-glx.h	9 Aug 2004 22:57:35 -0000	1.4
***************
*** 59,63 ****
  glitz_glx_find_standard_format (Display *display,
                                  int screen,
-                                 unsigned long option_mask,
                                  glitz_format_name_t format_name);
  
--- 59,62 ----

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** glitz.c	20 Jul 2004 07:51:14 -0000	1.18
--- glitz.c	9 Aug 2004 22:57:35 -0000	1.19
***************
*** 30,126 ****
  #include "glitzint.h"
  
- static void
- glitz_mask_bounds (glitz_surface_t *src,
-                    glitz_surface_t *mask,
-                    glitz_surface_t *dst,
-                    int x_src,
-                    int y_src,
-                    int x_mask,
-                    int y_mask,
[...1385 lines suppressed...]
!                                         GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!       glitz_texture_copy_surface (&dst->texture, src,
!                                   x_src, y_src, width, height, x_dst, y_dst);
!       status = 1;
      }
      glitz_surface_pop_current (src);
--- 767,779 ----
  
    if (!status) {
!     if (glitz_surface_push_current (src, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!       glitz_texture_t *texture;
! 
!       texture = glitz_surface_get_texture (dst, 1);
!       if (texture) {
!         glitz_texture_copy_surface (texture, src,
!                                     x_src, y_src, width, height, x_dst, y_dst);
!         status = 1;
!       }
      }
      glitz_surface_pop_current (src);

Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** glitz.h	20 Jul 2004 07:51:14 -0000	1.16
--- glitz.h	9 Aug 2004 22:57:35 -0000	1.17
***************
*** 108,119 ****
  
  typedef enum {
-   GLITZ_FILTER_FAST,
-   GLITZ_FILTER_GOOD,
-   GLITZ_FILTER_BEST,
    GLITZ_FILTER_NEAREST,
!   GLITZ_FILTER_BILINEAR
  } glitz_filter_t;
  
  typedef enum {
    GLITZ_OPERATOR_CLEAR,
    GLITZ_OPERATOR_SRC,
--- 108,124 ----
  
  typedef enum {
    GLITZ_FILTER_NEAREST,
!   GLITZ_FILTER_BILINEAR,
!   GLITZ_FILTER_CONVOLUTION,
!   GLITZ_FILTER_LINEAR_GRADIENT,
!   GLITZ_FILTER_RADIAL_GRADIENT
  } glitz_filter_t;
  
  typedef enum {
+   GLITZ_POLYEDGE_SHARP,
+   GLITZ_POLYEDGE_SMOOTH
+ } glitz_polyedge_t;
+ 
+ typedef enum {
    GLITZ_OPERATOR_CLEAR,
    GLITZ_OPERATOR_SRC,
***************
*** 132,151 ****
  } glitz_operator_t;
  
! #define GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK       (1L <<  0)
! #define GLITZ_FEATURE_CONVOLUTION_FILTER_MASK      (1L <<  1)
! #define GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK       (1L <<  2)
! #define GLITZ_FEATURE_TEXTURE_NPOT_MASK            (1L <<  3)
! #define GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK (1L <<  4)
! #define GLITZ_FEATURE_MULTISAMPLE_MASK             (1L <<  5)
! #define GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK   (1L <<  6)
! #define GLITZ_FEATURE_ARB_MULTITEXTURE_MASK        (1L <<  7)
! #define GLITZ_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK (1L <<  8)
! #define GLITZ_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK    (1L <<  9)  
! #define GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK      (1L << 10)
! #define GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK    (1L << 11)
! #define GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK     (1L << 12)
! #define GLITZ_FEATURE_COMPONENT_ALPHA_MASK         (1L << 13)
  
! typedef enum {  
    GLITZ_STANDARD_ARGB32,
    GLITZ_STANDARD_RGB24,
--- 137,158 ----
  } glitz_operator_t;
  
! #define GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK        (1L <<  0)
! #define GLITZ_FEATURE_CONVOLUTION_FILTER_MASK       (1L <<  1)
! #define GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK        (1L <<  2)
! #define GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK (1L <<  3)
! #define GLITZ_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK  (1L <<  4)
! #define GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK     (1L <<  5)
! #define GLITZ_FEATURE_MULTISAMPLE_MASK              (1L <<  6)
! #define GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK    (1L <<  7)
! #define GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK  (1L <<  8)
! #define GLITZ_FEATURE_MULTITEXTURE_MASK             (1L <<  9)
! #define GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK      (1L << 10)
! #define GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK         (1L << 11)  
! #define GLITZ_FEATURE_VERTEX_PROGRAM_MASK           (1L << 12)
! #define GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK         (1L << 13)
! #define GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 14)
! #define GLITZ_FEATURE_COMPONENT_ALPHA_MASK          (1L << 15)
  
! typedef enum {
    GLITZ_STANDARD_ARGB32,
    GLITZ_STANDARD_RGB24,
***************
*** 197,208 ****
  } glitz_format_t;
  
- #define GLITZ_FORMAT_OPTION_DOUBLEBUFFER_MASK   (1L << 0)
- #define GLITZ_FORMAT_OPTION_SINGLEBUFFER_MASK   (1L << 1)
- #define GLITZ_FORMAT_OPTION_ONSCREEN_MASK       (1L << 2)
- #define GLITZ_FORMAT_OPTION_OFFSCREEN_MASK      (1L << 3)
- #define GLITZ_FORMAT_OPTION_MULTISAMPLE_MASK    (1L << 4)
- #define GLITZ_FORMAT_OPTION_NO_MULTISAMPLE_MASK (1L << 5)
- #define GLITZ_FORMAT_OPTION_READDRAW_MASK       (1L << 6)
- #define GLITZ_FORMAT_OPTION_READONLY_MASK       (1L << 7)
  
  /* glitz_status.c */
--- 204,207 ----
***************
*** 221,278 ****
  
    
- /* glitz_color_range.c */
- 
- typedef struct _glitz_surface glitz_surface_t;
- typedef struct _glitz_color_range glitz_color_range_t;
-   
- typedef enum {
-   GLITZ_EXTEND_PAD,
-   GLITZ_EXTEND_REPEAT,
-   GLITZ_EXTEND_REFLECT
- } glitz_extend_t;
-   
- glitz_color_range_t *
- glitz_color_range_create (glitz_surface_t *surface,
-                           unsigned int size);
- 
- void
- glitz_color_range_destroy (glitz_color_range_t *color_range);
- 
- char *
- glitz_color_range_get_data (glitz_color_range_t *color_range);
- 
- void
- glitz_color_range_put_back_data (glitz_color_range_t *color_range);
- 
- void
- glitz_color_range_set_filter (glitz_color_range_t *color_range,
-                               glitz_filter_t filter);
-   
- void
- glitz_color_range_set_extend (glitz_color_range_t *color_range,
-                               glitz_extend_t extend);
- 
-   
  /* glitz_surface.c */
  
! typedef enum {
!   GLITZ_POLYEDGE_SHARP,
!   GLITZ_POLYEDGE_SMOOTH
! } glitz_polyedge_t;
! 
! glitz_surface_t *
! glitz_surface_create_solid (glitz_color_t *color);
!   
! glitz_surface_t *
! glitz_surface_create_linear (glitz_point_fixed_t *start,
!                              glitz_point_fixed_t *end,
!                              glitz_color_range_t *color_range);
  
- glitz_surface_t *
- glitz_surface_create_radial (glitz_point_fixed_t *center,
-                              glitz_fixed16_16_t radius0,
-                              glitz_fixed16_16_t radius1,
-                              glitz_color_range_t *color_range);
-   
  void
  glitz_surface_destroy (glitz_surface_t *surface);
--- 220,227 ----
  
    
  /* glitz_surface.c */
  
! typedef struct _glitz_surface glitz_surface_t;
  
  void
  glitz_surface_destroy (glitz_surface_t *surface);
***************
*** 282,292 ****
                               glitz_transform_t *transform);
  
! void
! glitz_surface_set_convolution (glitz_surface_t *surface,
!                                glitz_convolution_t *convolution);
  
  void
! glitz_surface_set_repeat (glitz_surface_t *surface,
!                           glitz_bool_t repeat);
  
  void
--- 231,244 ----
                               glitz_transform_t *transform);
  
! typedef enum {
!   GLITZ_FILL_TRANSPARENT,
!   GLITZ_FILL_NEAREST,
!   GLITZ_FILL_REPEAT,
!   GLITZ_FILL_REFLECT
! } glitz_fill_t;
  
  void
! glitz_surface_set_fill (glitz_surface_t *surface,
!                         glitz_fill_t fill);
  
  void
***************
*** 294,300 ****
                                     glitz_bool_t component_alpha);
  
  void
  glitz_surface_set_filter (glitz_surface_t *surface,
!                           glitz_filter_t filter);
    
  void
--- 246,263 ----
                                     glitz_bool_t component_alpha);
  
+ typedef enum {
+   GLITZ_CORRECTNESS_HINT_CAPABILITY,
+   GLITZ_CORRECTNESS_HINT_QUALITY
+ } glitz_correctness_hint_t;
+   
+ void
+ glitz_surface_set_correctness_hint (glitz_surface_t *surface,
+                                     glitz_correctness_hint_t hint);
+ 
  void
  glitz_surface_set_filter (glitz_surface_t *surface,
!                           glitz_filter_t filter,
!                           glitz_fixed16_16_t *params,
!                           int n_params);
    
  void
***************
*** 369,378 ****
  
  void
  glitz_surface_get_gl_texture (glitz_surface_t *surface,
                                unsigned int *name,
                                unsigned int *target,
                                double *texcoord_width,
!                               double *texcoord_height,
!                               glitz_bool_t *repeatable);  
  
  void
--- 332,343 ----
  
  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
***************
*** 393,397 ****
  glitz_format_t *
  glitz_surface_find_similar_standard_format (glitz_surface_t *surface,
-                                             unsigned long option_mask,
                                              glitz_format_name_t format_name);
  
--- 358,361 ----
***************
*** 410,415 ****
  #define GLITZ_HINT_CLIPPING_MASK     (1L << 0)
  #define GLITZ_HINT_OFFSCREEN_MASK    (1L << 1)
! #define GLITZ_HINT_PROGRAMMATIC_MASK (1L << 2)
! #define GLITZ_HINT_MULTISAMPLE_MASK  (1L << 3)
  
  unsigned long
--- 374,378 ----
  #define GLITZ_HINT_CLIPPING_MASK     (1L << 0)
  #define GLITZ_HINT_OFFSCREEN_MASK    (1L << 1)
! #define GLITZ_HINT_MULTISAMPLE_MASK  (1L << 2)
  
  unsigned long

Index: glitz.man
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.man,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glitz.man	30 Mar 2004 17:07:18 -0000	1.1.1.1
--- glitz.man	9 Aug 2004 22:57:35 -0000	1.2
***************
*** 10,14 ****
  
  .SH NAME
! GLITZ \- OpenGL compositing library
  
  .SH SYNOPSIS
--- 10,14 ----
  
  .SH NAME
! GLITZ \- OpenGL image compositing library
  
  .SH SYNOPSIS
***************
*** 18,21 ****
  .SH DESCRIPTION
  
  .SH AUTHOR
! David Reveman, Peter Nilsson
--- 18,38 ----
  .SH DESCRIPTION
  
+ Glitz is an OpenGL image compositing library. Glitz provides
+ Porter/Duff compositing of images and implicit mask generation for
+ geometric primitives including trapezoids, triangles, and rectangles.
+ 
+ The semantics of glitz are designed to precisely match the
+ specification of the X Render extension. Glitz does not only implement
+ X Render features like component alpha and image transformations, but
+ also support for additional features like convolution filters and color
+ gradients, which are not currently part of the X Render specification.
+ 
+ The performance and capabilities of glitz are much dependent on
+ graphics hardware. Glitz does not in any way handle software
+ fall-backs when graphics hardware is insufficient. However, glitz
+ will report if any requested operation cannot be carried out by
+ graphics hardware, hence making a higher level software layer
+ responsible for appropriate actions.
+ 
  .SH AUTHOR
! David Reveman

Index: glitz_agl_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_context.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_agl_context.c	20 Jul 2004 07:51:14 -0000	1.6
--- glitz_agl_context.c	9 Aug 2004 22:57:35 -0000	1.7
***************
*** 84,106 ****
  }
  
- static void
- glitz_agl_context_set_surface_anti_aliasing (glitz_agl_surface_t *surface)
- {
-   if (surface->base.format->multisample.supported) {
-     if (surface->base.polyedge == GLITZ_POLYEDGE_SMOOTH) {
-       glEnable (GLITZ_GL_MULTISAMPLE);
-       if (surface->thread_info->agl_feature_mask &
-           GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_MASK) {
-         if (surface->base.polyedge_smooth_hint ==
-             GLITZ_POLYEDGE_SMOOTH_HINT_FAST)
-           glHint (GLITZ_GL_MULTISAMPLE_FILTER_HINT, GLITZ_GL_FASTEST);
-         else
-           glHint (GLITZ_GL_MULTISAMPLE_FILTER_HINT, GLITZ_GL_NICEST);
-       }
-     } else
-       glDisable (GLITZ_GL_MULTISAMPLE);
-   }
- }
- 
  void
  glitz_agl_context_make_current (glitz_agl_surface_t *surface,
--- 84,87 ----
***************
*** 120,127 ****
      pbuffer = surface->pbuffer;
      drawable = surface->drawable;
    }
  
    if (pbuffer)
!     aglSetPBuffer (context, pbuffer, 0, 0, 0);
    else
      aglSetDrawable (context, drawable);
--- 101,109 ----
      pbuffer = surface->pbuffer;
      drawable = surface->drawable;
+     surface->base.update_mask |= GLITZ_UPDATE_ALL_MASK;
    }
  
    if (pbuffer)
!     aglSetPBuffer (context, pbuffer, 0, 0, aglGetVirtualScreen (context));
    else
      aglSetDrawable (context, drawable);
***************
*** 166,171 ****
        }
      }
-     
-     glitz_agl_context_set_surface_anti_aliasing (surface);
      break;
    }
--- 148,151 ----
***************
*** 183,192 ****
  
    index = thread_info->context_stack_size++;
! 
!   thread_info->context_stack =
!     realloc (thread_info->context_stack,
!              sizeof (glitz_agl_context_info_t) *
!              thread_info->context_stack_size);
! 
    context_info = &thread_info->context_stack[index];
    context_info->surface = surface;
--- 163,167 ----
  
    index = thread_info->context_stack_size++;
!   
    context_info = &thread_info->context_stack[index];
    context_info->surface = surface;
***************
*** 213,221 ****
    index = thread_info->context_stack_size - 1;
  
-   thread_info->context_stack =
-     realloc (thread_info->context_stack,
-              sizeof (glitz_agl_context_info_t) *
-              thread_info->context_stack_size);
-   
    context_info = &thread_info->context_stack[index];
  
--- 188,191 ----

Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_extension.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glitz_agl_extension.c	20 Jul 2004 07:51:14 -0000	1.4
--- glitz_agl_extension.c	9 Aug 2004 22:57:35 -0000	1.5
***************
*** 32,51 ****
  #include "glitz_aglint.h"
  
  static glitz_extension_map gl_extensions[] = {
    { "GL_APPLE_pixel_buffer", GLITZ_AGL_FEATURE_PBUFFER_MASK },
    { "GL_EXT_texture_rectangle", GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
    { "GL_NV_texture_rectangle", GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { "GL_ARB_texture_non_power_of_two", GLITZ_AGL_FEATURE_TEXTURE_NPOT_MASK },
    { "GL_ARB_texture_mirrored_repeat",
      GLITZ_AGL_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK },
!   { "GL_ARB_texture_env_combine",
!     GLITZ_AGL_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK },
!   { "GL_ARB_texture_env_dot3", GLITZ_AGL_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK },
    { "GL_ARB_multisample", GLITZ_AGL_FEATURE_MULTISAMPLE_MASK },
    { "GL_NV_multisample_filter_hint",
!     GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_MASK },
!   { "GL_ARB_multitexture", GLITZ_AGL_FEATURE_ARB_MULTITEXTURE_MASK },
!   { "GL_ARB_vertex_program", GLITZ_AGL_FEATURE_ARB_VERTEX_PROGRAM_MASK },
!   { "GL_ARB_fragment_program", GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK },
    { "GL_EXT_pixel_buffer_object", GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
    { NULL, 0 }
--- 32,56 ----
  #include "glitz_aglint.h"
  
+ extern glitz_gl_proc_address_list_t _glitz_agl_gl_proc_address;
+ 
  static glitz_extension_map gl_extensions[] = {
    { "GL_APPLE_pixel_buffer", GLITZ_AGL_FEATURE_PBUFFER_MASK },
    { "GL_EXT_texture_rectangle", GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
    { "GL_NV_texture_rectangle", GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { "GL_ARB_texture_non_power_of_two",
!     GLITZ_AGL_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK },
    { "GL_ARB_texture_mirrored_repeat",
      GLITZ_AGL_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK },
!   { "GL_ARB_texture_border_clamp",
!     GLITZ_AGL_FEATURE_TEXTURE_BORDER_CLAMP_MASK },
!   { "GL_ARB_texture_env_combine", GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK },
!   { "GL_EXT_texture_env_combine", GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK },
!   { "GL_ARB_texture_env_dot3", GLITZ_AGL_FEATURE_TEXTURE_ENV_DOT3_MASK },
    { "GL_ARB_multisample", GLITZ_AGL_FEATURE_MULTISAMPLE_MASK },
    { "GL_NV_multisample_filter_hint",
!     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 }
***************
*** 77,80 ****
--- 82,89 ----
    if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK) {
      thread_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
+ 
+     if (thread_info->agl_feature_mask &
+         GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_HINT_MASK)
+       thread_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK;
      
      /*
***************
*** 85,91 ****
    }
  
!   if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_TEXTURE_NPOT_MASK) {
!     thread_info->texture_mask |= GLITZ_TEXTURE_TARGET_NPOT_MASK;
!     thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_NPOT_MASK;
    } 
  
--- 94,101 ----
    }
  
!   if (thread_info->agl_feature_mask &
!       GLITZ_AGL_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) {
!     thread_info->texture_mask |= GLITZ_TEXTURE_TARGET_NON_POWER_OF_TWO_MASK;
!     thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK;
    } 
  
***************
*** 101,119 ****
  
    if (thread_info->agl_feature_mask &
!       GLITZ_AGL_FEATURE_ARB_MULTITEXTURE_MASK) {
!     thread_info->feature_mask |= GLITZ_FEATURE_ARB_MULTITEXTURE_MASK;
  
      if (thread_info->agl_feature_mask &
!         GLITZ_AGL_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK)
!       thread_info->feature_mask |= GLITZ_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK;
      
      if (thread_info->agl_feature_mask &
!         GLITZ_AGL_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK)
!       thread_info->feature_mask |= GLITZ_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK;
      
!     if ((thread_info->feature_mask &
!          GLITZ_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK) &&
!         (thread_info->feature_mask &
!          GLITZ_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK)) {
        GLint max_texture_units;
        
--- 111,130 ----
  
    if (thread_info->agl_feature_mask &
!       GLITZ_AGL_FEATURE_TEXTURE_BORDER_CLAMP_MASK)
!     thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK;
! 
!   if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTITEXTURE_MASK) {
!     thread_info->feature_mask |= GLITZ_FEATURE_MULTITEXTURE_MASK;
  
      if (thread_info->agl_feature_mask &
!         GLITZ_AGL_FEATURE_TEXTURE_ENV_COMBINE_MASK)
!       thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK;
      
      if (thread_info->agl_feature_mask &
!         GLITZ_AGL_FEATURE_TEXTURE_ENV_DOT3_MASK)
!       thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK;
      
!     if ((thread_info->feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK) &&
!         (thread_info->feature_mask & GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK)) {
        GLint max_texture_units;
        
***************
*** 123,136 ****
      }
      
!     if (thread_info->agl_feature_mask &
!         GLITZ_AGL_FEATURE_ARB_VERTEX_PROGRAM_MASK)
!       thread_info->feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
      
      if (thread_info->agl_feature_mask &
!         GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
!       thread_info->feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
!   }
  
!     if (thread_info->agl_feature_mask &
        GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
      thread_info->feature_mask |= GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
--- 134,159 ----
      }
      
!     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) {
!       glitz_gl_uint_t texture_indirections;
  
!       thread_info->feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
!     
!       _glitz_agl_gl_proc_address.get_program_iv
!         (GLITZ_GL_FRAGMENT_PROGRAM,
!          GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS,
!          &texture_indirections);
!       
!       /* Convolution filter programs require support for at least nine
!          texture indirections. */
!       if (texture_indirections >= 9)
!         thread_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
!     }
!   }
!   
!   if (thread_info->agl_feature_mask &
        GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK)
      thread_info->feature_mask |= GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;

Index: glitz_agl_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_format.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** glitz_agl_format.c	21 Jun 2004 21:26:56 -0000	1.4
--- glitz_agl_format.c	9 Aug 2004 22:57:35 -0000	1.5
***************
*** 368,373 ****
  
  glitz_format_t *
! glitz_agl_find_standard_format (unsigned long option_mask,
!                                 glitz_format_name_t format_name)
  {
    glitz_agl_thread_info_t *thread_info = glitz_agl_thread_info_get ();
--- 368,372 ----
  
  glitz_format_t *
! glitz_agl_find_standard_format (glitz_format_name_t format_name)
  {
    glitz_agl_thread_info_t *thread_info = glitz_agl_thread_info_get ();
***************
*** 375,379 ****
    return
      glitz_format_find_standard (thread_info->formats, thread_info->n_formats,
!                                 option_mask, format_name);
  }
  slim_hidden_def(glitz_agl_find_standard_format);
--- 374,378 ----
    return
      glitz_format_find_standard (thread_info->formats, thread_info->n_formats,
!                                 format_name);
  }
  slim_hidden_def(glitz_agl_find_standard_format);

Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_info.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_agl_info.c	24 Jul 2004 00:09:27 -0000	1.7
--- glitz_agl_info.c	9 Aug 2004 22:57:35 -0000	1.8
***************
*** 59,62 ****
--- 59,64 ----
    (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,
***************
*** 67,70 ****
--- 69,73 ----
    (glitz_gl_copy_pixels_t) glCopyPixels,
    (glitz_gl_flush_t) glFlush,
+   (glitz_gl_finish_t) glFinish,
    (glitz_gl_pixel_store_i_t) glPixelStorei,
    (glitz_gl_ortho_t) glOrtho,
***************
*** 179,190 ****
    NULL,
    0,
!   NULL,
    0,
!   { (AGLITZontext) 0, (AGLPixelFormat) 0, 0 },
    0,
    0,
    0,
    0,
!   { 0, 0, 0, 0 }
  };
  
--- 182,193 ----
    NULL,
    0,
!   { 0 },
    0,
!   { 0 },
    0,
    0,
    0,
    0,
!   { 0 }
  };
  
***************
*** 199,203 ****
  glitz_agl_thread_info_get (void)
  {
!   if (_thread_info.context_stack == NULL)
      glitz_agl_thread_info_init (&_thread_info);
        
--- 202,206 ----
  glitz_agl_thread_info_get (void)
  {
!   if (_thread_info.context_stack_size == 0)
      glitz_agl_thread_info_init (&_thread_info);
        
***************
*** 226,255 ****
    thread_info->root_context.pixel_format =
      aglChoosePixelFormat (NULL, 0, attrib);
!   thread_info->root_context.context =
!     aglCreateContext (thread_info->root_context.pixel_format, NULL);
  
!   aglSetCurrentContext (thread_info->root_context.context);
    
!   glitz_agl_query_extensions (thread_info);
! 
!   if ((thread_info->feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
!       (thread_info->feature_mask &
!        GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)) {
!     glitz_gl_uint_t texture_indirections;
!     
!      _glitz_agl_gl_proc_address.get_program_iv
!        (GLITZ_GL_FRAGMENT_PROGRAM,
!         GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS,
!         &texture_indirections);
! 
!     /* Convolution filter programs require support for at least nine
!        texture indirections. */
!     if (texture_indirections >= 9)
!       thread_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
    }
-   
-   glitz_agl_query_formats (thread_info);
  
-   thread_info->context_stack = malloc (sizeof (glitz_agl_context_info_t));
    thread_info->context_stack_size = 1;
    thread_info->context_stack->surface = NULL;
--- 229,244 ----
    thread_info->root_context.pixel_format =
      aglChoosePixelFormat (NULL, 0, attrib);
!   if (thread_info->root_context.pixel_format) {
!     thread_info->root_context.context =
!       aglCreateContext (thread_info->root_context.pixel_format, NULL);
!     if (thread_info->root_context.context) {
  
!       aglSetCurrentContext (thread_info->root_context.context);
    
!       glitz_agl_query_extensions (thread_info);  
!       glitz_agl_query_formats (thread_info);
!     }
    }
  
    thread_info->context_stack_size = 1;
    thread_info->context_stack->surface = NULL;
***************
*** 261,272 ****
  {
    int i;
-   
-   aglSetCurrentContext (thread_info->root_context.context);
-   glitz_program_map_fini (&_glitz_agl_gl_proc_address,
-                           &thread_info->program_map);
-   aglSetCurrentContext (NULL);
  
!   if (thread_info->context_stack)
!     free (thread_info->context_stack);
  
    for (i = 0; i < thread_info->n_contexts; i++)
--- 250,260 ----
  {
    int i;
  
!   if (thread_info->root_context.context) {
!     aglSetCurrentContext (thread_info->root_context.context);
!     glitz_program_map_fini (&_glitz_agl_gl_proc_address,
!                             &thread_info->program_map);
!     aglSetCurrentContext (NULL);
!   }
  
    for (i = 0; i < thread_info->n_contexts; i++)
***************
*** 282,286 ****
      free (thread_info->format_ids);
  
!   aglDestroyContext (thread_info->root_context.context);
  }
  
--- 270,275 ----
      free (thread_info->format_ids);
  
!   if (thread_info->root_context.context)
!     aglDestroyContext (thread_info->root_context.context);
  }
  

Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** glitz_agl_surface.c	24 Jul 2004 00:09:27 -0000	1.13
--- glitz_agl_surface.c	9 Aug 2004 22:57:35 -0000	1.14
***************
*** 44,48 ****
  
  static glitz_texture_t *
! _glitz_agl_surface_get_texture (void *abstract_surface);
  
  static void
--- 44,49 ----
  
  static glitz_texture_t *
! _glitz_agl_surface_get_texture (void *abstract_surface,
!                                 glitz_bool_t allocate);
  
  static void
***************
*** 60,66 ****
    
    if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT &&
!       ((!surface->pbuffer) && (!surface->drawable))) {
!     constraint = GLITZ_CN_ANY_CONTEXT_CURRENT;
!     success = 0;
    }
    
--- 61,71 ----
    
    if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT &&
!       (!surface->pbuffer) && (!surface->drawable)) {
!     if (surface->base.format->draw.offscreen) {
!       surface->pbuffer = glitz_agl_pbuffer_create (&surface->base.texture);
!     } else {
!       constraint = GLITZ_CN_ANY_CONTEXT_CURRENT;
!       success = 0;
!     }
    }
    
***************
*** 68,72 ****
  
    if (surface) {
!     glitz_surface_setup_environment (&surface->base);
      return 1;
    }
--- 73,77 ----
  
    if (surface) {
!     glitz_surface_update_state (&surface->base);
      return 1;
    }
***************
*** 83,87 ****
    
    if (surface)
!     glitz_surface_setup_environment (&surface->base);
  }
  
--- 88,92 ----
    
    if (surface)
!     glitz_surface_update_state (&surface->base);
  }
  
***************
*** 104,108 ****
  
  static glitz_texture_t *
! _glitz_agl_surface_get_texture (void *abstract_surface) {
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
  
--- 109,114 ----
  
  static glitz_texture_t *
! _glitz_agl_surface_get_texture (void *abstract_surface,
!                                 glitz_bool_t allocate) {
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
  
***************
*** 112,115 ****
--- 118,123 ----
  
        if (surface->base.read_buffer != surface->bound_buffer) {
+         glitz_surface_push_current (&surface->base,
+                                     GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
          glitz_agl_pbuffer_bind (surface->pbuffer,
                                  surface->context->context,
***************
*** 117,120 ****
--- 125,129 ----
                                  surface->base.read_buffer);
          surface->bound_buffer = surface->base.read_buffer;
+         glitz_surface_pop_current (&surface->base);
        }
  
***************
*** 128,131 ****
--- 137,144 ----
        glitz_intersect_bounding_box (&surface->base.dirty_box,
                                      &copy_box, &copy_box);
+       
+       if (!surface->base.texture.allocated)
+         glitz_texture_allocate (surface->base.gl, &surface->base.texture);
+       
        glitz_texture_copy_surface (&surface->base.texture, &surface->base,
                                    copy_box.x1,
***************
*** 140,143 ****
--- 153,175 ----
    }
  
+   if (allocate) {
+     if (!surface->base.texture.allocated) {
+       if (SURFACE_RENDER_TEXTURE (&surface->base)) {
+         if (!surface->pbuffer)
+           surface->pbuffer = glitz_agl_pbuffer_create (&surface->base.texture);
+ 
+         glitz_surface_push_current (&surface->base,
+                                     GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
+         glitz_agl_pbuffer_bind (surface->pbuffer,
+                                 surface->context->context,
+                                 &surface->base.texture,
+                                 surface->base.read_buffer);
+         surface->bound_buffer = surface->base.read_buffer;
+         glitz_surface_pop_current (&surface->base);
+       } else
+         glitz_texture_allocate (surface->base.gl, &surface->base.texture);
+     }
+   }
+ 
    if (surface->base.texture.allocated)
      return &surface->base.texture;
***************
*** 163,181 ****
  {
    surface->base.feature_mask = surface->thread_info->feature_mask;
- 
-   surface->base.feature_mask &= ~GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
-   surface->base.feature_mask &= ~GLITZ_FEATURE_MULTISAMPLE_MASK;
-   surface->base.feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
- 
-   if (surface->thread_info->feature_mask &
-       GLITZ_FEATURE_CONVOLUTION_FILTER_MASK)
-     surface->base.feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
- 
-   if (surface->thread_info->feature_mask & GLITZ_FEATURE_MULTISAMPLE_MASK)
-     surface->base.feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
-   
-   if (surface->thread_info->feature_mask &
-       GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK)
-     surface->base.feature_mask |= GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
  }
  
--- 195,198 ----
***************
*** 224,243 ****
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
!   _glitz_agl_set_features (surface);
! 
!   if (surface->base.format->draw.offscreen) {
!     surface->pbuffer = glitz_agl_pbuffer_create (&surface->base.texture);
!     if (surface->pbuffer) {
!       glitz_surface_push_current (&surface->base,
!                                   GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
!       glitz_agl_pbuffer_bind (surface->pbuffer,
!                               surface->context->context,
!                               &surface->base.texture,
!                               surface->base.read_buffer);
!       surface->bound_buffer = surface->base.read_buffer;
!       glitz_surface_pop_current (&surface->base);
!     }
    }
  
    return &surface->base;
  }
--- 241,251 ----
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
!   if (format->draw.offscreen) {
!     surface->base.hint_mask |= GLITZ_INT_HINT_DRAWABLE_MASK;
!     surface->base.hint_mask |= GLITZ_INT_HINT_RENDER_TEXTURE_MASK;
    }
  
+   _glitz_agl_set_features (surface);
+ 
    return &surface->base;
  }
***************
*** 288,291 ****
--- 296,301 ----
    surface->drawable = GetWindowPort (window);
  
+   surface->base.hint_mask |= GLITZ_INT_HINT_DRAWABLE_MASK;
+ 
    _glitz_agl_set_features (surface);
    
***************
*** 384,392 ****
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
    
-   if (!surface->window)
-     return;
- 
    glitz_agl_context_push_current (surface, GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
!   
    aglSwapBuffers (surface->context->context);
    
--- 394,399 ----
    glitz_agl_surface_t *surface = (glitz_agl_surface_t *) abstract_surface;
    
    glitz_agl_context_push_current (surface, GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
! 
    aglSwapBuffers (surface->context->context);
    

Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_aglint.h	20 Jul 2004 07:51:14 -0000	1.7
--- glitz_aglint.h	9 Aug 2004 22:57:35 -0000	1.8
***************
*** 37,52 ****
  #include <AGL/agl.h>
  
! #define GLITZ_AGL_FEATURE_PBUFFER_MASK                 (1L <<  0)
! #define GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK       (1L <<  1)
! #define GLITZ_AGL_FEATURE_TEXTURE_NPOT_MASK            (1L <<  2)
! #define GLITZ_AGL_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK (1L <<  3)
! #define GLITZ_AGL_FEATURE_MULTISAMPLE_MASK             (1L <<  4)
! #define GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_MASK      (1L <<  5)
! #define GLITZ_AGL_FEATURE_ARB_MULTITEXTURE_MASK        (1L <<  6)
! #define GLITZ_AGL_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK (1L <<  7)
! #define GLITZ_AGL_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK    (1L <<  8)
! #define GLITZ_AGL_FEATURE_ARB_VERTEX_PROGRAM_MASK      (1L <<  9)
! #define GLITZ_AGL_FEATURE_ARB_FRAGMENT_PROGRAM_MASK    (1L << 10)
! #define GLITZ_AGL_FEATURE_PIXEL_BUFFER_OBJECT_MASK     (1L << 11)
  
  typedef struct _glitz_agl_surface_t glitz_agl_surface_t;
--- 37,53 ----
  #include <AGL/agl.h>
  
! #define GLITZ_AGL_FEATURE_PBUFFER_MASK                  (1L <<  0)
! #define GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK        (1L <<  1)
! #define GLITZ_AGL_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK (1L <<  2)
! #define GLITZ_AGL_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK  (1L <<  3)
! #define GLITZ_AGL_FEATURE_TEXTURE_BORDER_CLAMP_MASK     (1L <<  4)
! #define GLITZ_AGL_FEATURE_MULTISAMPLE_MASK              (1L <<  5)
! #define GLITZ_AGL_FEATURE_MULTISAMPLE_FILTER_HINT_MASK  (1L <<  6)
! #define GLITZ_AGL_FEATURE_MULTITEXTURE_MASK             (1L <<  7)
! #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)
  
  typedef struct _glitz_agl_surface_t glitz_agl_surface_t;
***************
*** 72,76 ****
    int n_contexts;
    
!   glitz_agl_context_info_t *context_stack;
    int context_stack_size;
    
--- 73,77 ----
    int n_contexts;
    
!   glitz_agl_context_info_t context_stack[GLITZ_CONTEXT_STACK_SIZE];
    int context_stack_size;
    

--- glitz_color_range.c DELETED ---

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

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

Index: glitz_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_format.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_format.c	20 Jul 2004 07:51:14 -0000	1.6
--- glitz_format.c	9 Aug 2004 22:57:35 -0000	1.7
***************
*** 48,52 ****
      GLITZ_GL_RGB4, 4, 4, 4, 0, 0, 0, 0, { 0, 1 }, { 0, 0 }, { 0, 0 }
    }, {
!     GLITZ_GL_RGB5,5, 5, 5, 0, 0, 0, 0, { 0, 1 }, { 0, 0 }, { 0, 0 }
    }, {
      GLITZ_GL_RGB8, 8, 8, 8, 0, 0, 0, 0, { 0, 1 }, { 0, 0 }, { 0, 0 }
--- 48,52 ----
      GLITZ_GL_RGB4, 4, 4, 4, 0, 0, 0, 0, { 0, 1 }, { 0, 0 }, { 0, 0 }
    }, {
!     GLITZ_GL_RGB5, 5, 5, 5, 0, 0, 0, 0, { 0, 1 }, { 0, 0 }, { 0, 0 }
    }, {
      GLITZ_GL_RGB8, 8, 8, 8, 0, 0, 0, 0, { 0, 1 }, { 0, 0 }, { 0, 0 }
***************
*** 189,321 ****
  }
  
- static glitz_format_t *
- glitz_format_find_best (glitz_format_t *formats,
-                         int n_formats,
-                         unsigned long mask,
-                         const glitz_format_t *templ)
- {
-   glitz_format_t *format, *best_format;
-   int best_diff, best_above;
-   int i, diff, above, red_diff, green_diff, blue_diff, alpha_diff;
-   unsigned long templ_mask;
-   
-   best_diff = MAXSHORT;
-   best_above = 0;
-   best_format = NULL;
-   
-   templ_mask = mask & ~(GLITZ_FORMAT_RED_SIZE_MASK |
-                         GLITZ_FORMAT_GREEN_SIZE_MASK |
-                         GLITZ_FORMAT_BLUE_SIZE_MASK |
-                         GLITZ_FORMAT_ALPHA_SIZE_MASK);
-   
-   i = 0;
-   do {
-     format = glitz_format_find (formats, n_formats, templ_mask, templ, i++);
-     if (format) {
-       if (mask & GLITZ_FORMAT_RED_SIZE_MASK) {
-         if (templ->red_size != 0 && format->red_size == 0)
-           continue;
-         
-         red_diff = format->red_size - templ->red_size;
-       } else
-         red_diff = format->red_size;
- 
-       if (mask & GLITZ_FORMAT_GREEN_SIZE_MASK) {
-         if (templ->green_size != 0 && format->green_size == 0)
-           continue;
- 
-         green_diff = format->green_size - templ->green_size;
-       } else
-         green_diff = format->green_size;
- 
-       if (mask & GLITZ_FORMAT_BLUE_SIZE_MASK) {
-         if (templ->blue_size != 0 && format->blue_size == 0)
-           continue;
- 
-         blue_diff = format->blue_size - templ->blue_size;
-       } else
-         blue_diff = format->blue_size;
- 
-       if (mask & GLITZ_FORMAT_ALPHA_SIZE_MASK) {
-         if (templ->alpha_size != 0 && format->alpha_size == 0)
-           continue;
- 
-         alpha_diff = format->alpha_size - templ->alpha_size;
-       } else
-         alpha_diff = format->alpha_size;
-       
-       if (red_diff < 0 || green_diff < 0 || blue_diff < 0 || alpha_diff < 0)
-         above = 0;
-       else
-         above = 1;
-     
-       diff = abs (red_diff) + abs (green_diff) + abs (blue_diff) +
-         abs (alpha_diff);
-       
-       if (above > best_above || (above == best_above && diff < best_diff)) {
-         best_diff = diff;
-         best_above = above;
-         best_format = format;
-       }
-     }
-   } while (format);
- 
-   return best_format;
- }
- 
- static void
- _glitz_format_add_options (unsigned long options,
-                            glitz_format_t *format,
-                            unsigned long *mask)
- {
-   if (options & GLITZ_FORMAT_OPTION_DOUBLEBUFFER_MASK) {
-     format->doublebuffer = 1;
-     *mask |= GLITZ_FORMAT_DOUBLEBUFFER_MASK;
-   }
- 
-   if (options & GLITZ_FORMAT_OPTION_SINGLEBUFFER_MASK) {
-     format->doublebuffer = 0;
-     *mask |= GLITZ_FORMAT_DOUBLEBUFFER_MASK;
-   }
- 
-   if (options & GLITZ_FORMAT_OPTION_ONSCREEN_MASK) {
-     format->draw.onscreen = 1;
-     *mask |= GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
-   }
- 
-   if (options & GLITZ_FORMAT_OPTION_OFFSCREEN_MASK) {
-     format->read.offscreen = 1;
-     *mask |= GLITZ_FORMAT_READ_OFFSCREEN_MASK;
-   }
- 
-   if (options & GLITZ_FORMAT_OPTION_MULTISAMPLE_MASK) {
-     format->multisample.supported = 1;
-     *mask |= GLITZ_FORMAT_MULTISAMPLE_MASK;
-   }
- 
-   if (options & GLITZ_FORMAT_OPTION_NO_MULTISAMPLE_MASK) {
-     format->multisample.supported = 0;
-     *mask |= GLITZ_FORMAT_MULTISAMPLE_MASK;
-   }
- 
-   if (options & GLITZ_FORMAT_OPTION_READDRAW_MASK) {
-     if (*mask & GLITZ_FORMAT_READ_OFFSCREEN_MASK) {
-       format->draw.offscreen = 1;
-       *mask |= GLITZ_FORMAT_DRAW_OFFSCREEN_MASK;
-     }
-   }
-   
-   if (options & GLITZ_FORMAT_OPTION_READONLY_MASK) {
-     format->draw.offscreen = 0;
-     format->draw.onscreen = 0;
-     *mask |= GLITZ_FORMAT_DRAW_OFFSCREEN_MASK;
-     *mask |= GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
-   }
- }
- 
  glitz_format_t *
  glitz_format_find_standard (glitz_format_t *formats,
                              int n_formats,
-                             unsigned long options,
                              glitz_format_name_t format_name)
  {
--- 189,195 ----
***************
*** 323,327 ****
    unsigned long mask = GLITZ_FORMAT_RED_SIZE_MASK |
      GLITZ_FORMAT_GREEN_SIZE_MASK | GLITZ_FORMAT_BLUE_SIZE_MASK |
!     GLITZ_FORMAT_ALPHA_SIZE_MASK;
  
    switch (format_name) {
--- 197,204 ----
    unsigned long mask = GLITZ_FORMAT_RED_SIZE_MASK |
      GLITZ_FORMAT_GREEN_SIZE_MASK | GLITZ_FORMAT_BLUE_SIZE_MASK |
!     GLITZ_FORMAT_ALPHA_SIZE_MASK | GLITZ_FORMAT_READ_OFFSCREEN_MASK;
! 
!   /* only pick offscreen formats */
!   templ.read.offscreen = 1;
  
    switch (format_name) {
***************
*** 352,358 ****
    }
  
!   _glitz_format_add_options (options, &templ, &mask);
! 
!   return glitz_format_find_best (formats, n_formats, mask, &templ);
  }
  
--- 229,233 ----
    }
  
!   return glitz_format_find (formats, n_formats, mask, &templ, 0);
  }
  
***************
*** 368,383 ****
      sizeof (_texture_formats) / sizeof (glitz_format_t);
    
!   if ((!format->read.offscreen) ||
!       format->draw.offscreen || format->draw.onscreen) {
!     templ = *format;
      templ.draw.offscreen = templ.draw.onscreen = 0;
      templ.read.offscreen = 1;
!   
!     mask = GLITZ_FORMAT_RED_SIZE_MASK | GLITZ_FORMAT_GREEN_SIZE_MASK | 
!       GLITZ_FORMAT_BLUE_SIZE_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK |
!       GLITZ_FORMAT_READ_OFFSCREEN_MASK | GLITZ_FORMAT_DRAW_ONSCREEN_MASK |
        GLITZ_FORMAT_DRAW_OFFSCREEN_MASK;
!   
!     best_format = glitz_format_find_best (formats, n_formats, mask, format);
      if (!best_format)
        return GLITZ_GL_RGBA;
--- 243,264 ----
      sizeof (_texture_formats) / sizeof (glitz_format_t);
    
!   if (format->draw.offscreen || format->draw.onscreen) {
!     unsigned int i = 0;
!   
      templ.draw.offscreen = templ.draw.onscreen = 0;
      templ.read.offscreen = 1;
!     mask = GLITZ_FORMAT_READ_OFFSCREEN_MASK | GLITZ_FORMAT_DRAW_ONSCREEN_MASK |
        GLITZ_FORMAT_DRAW_OFFSCREEN_MASK;
!     
!     do {
!       best_format = glitz_format_find (formats, n_formats, mask, &templ, i++);
!       if (best_format &&
!           best_format->red_size >= format->red_size &&
!           best_format->green_size >= format->green_size &&
!           best_format->blue_size >= format->blue_size &&
!           best_format->alpha_size >= format->alpha_size)
!         break;
!     } while (best_format);
!     
      if (!best_format)
        return GLITZ_GL_RGBA;
***************
*** 388,394 ****
      GLITZ_FORMAT_BLUE_SIZE_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK;
    
!   texture_format = 
      glitz_format_find (_texture_formats, n_texture_formats,
! 		       mask, best_format, 0);
    if (!texture_format)
      return GLITZ_GL_RGBA;
--- 269,276 ----
      GLITZ_FORMAT_BLUE_SIZE_MASK | GLITZ_FORMAT_ALPHA_SIZE_MASK;
    
!   texture_format =
      glitz_format_find (_texture_formats, n_texture_formats,
!                        mask, best_format, 0);
!   
    if (!texture_format)
      return GLITZ_GL_RGBA;

Index: glitz_gl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_gl.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_gl.h	20 Jul 2004 07:51:14 -0000	1.5
--- glitz_gl.h	9 Aug 2004 22:57:35 -0000	1.6
***************
*** 51,54 ****
--- 51,55 ----
  
  #define GLITZ_GL_UNSIGNED_BYTE               0x1401
+ #define GLITZ_GL_FLOAT                       0x1406
  #define GLITZ_GL_UNSIGNED_BYTE_3_3_2         0x8032
  #define GLITZ_GL_UNSIGNED_BYTE_2_3_3_REV     0x8362
***************
*** 94,97 ****
--- 95,99 ----
  #define GLITZ_GL_REPEAT                 0x2901
  #define GLITZ_GL_CLAMP_TO_EDGE          0x812F
+ #define GLITZ_GL_CLAMP_TO_BORDER        0x812D
  #define GLITZ_GL_TEXTURE_RED_SIZE       0x805C
  #define GLITZ_GL_TEXTURE_GREEN_SIZE     0x805D
***************
*** 293,296 ****
--- 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);
***************
*** 315,318 ****
--- 321,326 ----
  typedef glitz_gl_void_t (* glitz_gl_flush_t)
       (glitz_gl_void_t);
+ typedef glitz_gl_void_t (* glitz_gl_finish_t)
+      (glitz_gl_void_t);
  typedef glitz_gl_void_t (* glitz_gl_pixel_store_i_t)
       (glitz_gl_enum_t pname, glitz_gl_int_t param);

Index: glitz_glx_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_context.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glitz_glx_context.c	20 Jul 2004 07:51:14 -0000	1.9
--- glitz_glx_context.c	9 Aug 2004 22:57:35 -0000	1.10
***************
*** 256,265 ****
      glitz_glx_get_proc_address (thread_info, "glUnmapBuffer");
  
!   if (screen_info->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) {
!     if (context->gl.get_program_iv) {
        context->gl.get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
                                    GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS,
                                    &context->texture_indirections);
-     }
    }
    
--- 256,264 ----
      glitz_glx_get_proc_address (thread_info, "glUnmapBuffer");
  
!   if (screen_info->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK) {
!     if (context->gl.get_program_iv)
        context->gl.get_program_iv (GLITZ_GL_FRAGMENT_PROGRAM,
                                    GLITZ_GL_MAX_PROGRAM_TEX_INDIRECTIONS,
                                    &context->texture_indirections);
    }
    
***************
*** 268,290 ****
  }
  
- static void
- glitz_glx_context_set_surface_anti_aliasing (glitz_glx_surface_t *surface)
- {
-   if (surface->base.format->multisample.supported) {
-     if (surface->base.polyedge == GLITZ_POLYEDGE_SMOOTH) {
-       glEnable (GLITZ_GL_MULTISAMPLE);
-       if (surface->screen_info->glx_feature_mask &
-           GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_MASK) {
-         if (surface->base.polyedge_smooth_hint ==
-             GLITZ_POLYEDGE_SMOOTH_HINT_FAST)
-           glHint (GLITZ_GL_MULTISAMPLE_FILTER_HINT, GLITZ_GL_FASTEST);
-         else
-           glHint (GLITZ_GL_MULTISAMPLE_FILTER_HINT, GLITZ_GL_NICEST);
-       }
-     } else
-       glDisable (GLITZ_GL_MULTISAMPLE);
-   }
- }
- 
  void
  glitz_glx_context_make_current (glitz_glx_surface_t *surface,
--- 267,270 ----
***************
*** 303,306 ****
--- 283,287 ----
      context = surface->context->context;
      drawable = surface->drawable;
+     surface->base.update_mask |= GLITZ_UPDATE_ALL_MASK;
    }
    
***************
*** 334,339 ****
          (glXGetCurrentDrawable () != surface->drawable))
        glitz_glx_context_make_current (surface, (context)? 1: 0);
-     
-     glitz_glx_context_set_surface_anti_aliasing (surface);
      break;
    }
--- 315,318 ----
***************
*** 352,360 ****
    index = screen_info->context_stack_size++;
  
-   screen_info->context_stack =
-     realloc (screen_info->context_stack,
-              sizeof (glitz_glx_context_info_t) *
-              screen_info->context_stack_size);
- 
    context_info = &screen_info->context_stack[index];
    context_info->surface = surface;
--- 331,334 ----
***************
*** 381,389 ****
    index = screen_info->context_stack_size - 1;
  
-   screen_info->context_stack =
-     realloc (screen_info->context_stack,
-              sizeof (glitz_glx_context_info_t) *
-              screen_info->context_stack_size);
-   
    context_info = &screen_info->context_stack[index];
  
--- 355,358 ----

Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_glx_extension.c	20 Jul 2004 07:51:14 -0000	1.7
--- glitz_glx_extension.c	9 Aug 2004 22:57:35 -0000	1.8
***************
*** 34,38 ****
  static glitz_extension_map client_glx_extensions[] = {
    /* NYI: Don't know of any driver that supports GLX_ARB_render_texture 
!     { "GLX_ARB_render_texture", GLITZ_GLX_FEATURE_ARB_RENDER_TEXTURE_MASK },
     */
    { "GLX_ARB_multisample", GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK },
--- 34,38 ----
  static glitz_extension_map client_glx_extensions[] = {
    /* NYI: Don't know of any driver that supports GLX_ARB_render_texture 
!     { "GLX_ARB_render_texture", GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK },
     */
    { "GLX_ARB_multisample", GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK },
***************
*** 41,56 ****
    { "GL_EXT_texture_rectangle", GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
    { "GL_NV_texture_rectangle", GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { "GL_ARB_texture_non_power_of_two", GLITZ_GLX_FEATURE_TEXTURE_NPOT_MASK },
    { "GL_ARB_texture_mirrored_repeat",
      GLITZ_GLX_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK },
!   { "GL_ARB_texture_env_combine",
!     GLITZ_GLX_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK },
!   { "GL_ARB_texture_env_dot3", GLITZ_GLX_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK },
    { "GL_ARB_multisample", GLITZ_GLX_FEATURE_MULTISAMPLE_MASK },
    { "GL_NV_multisample_filter_hint",
!     GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_MASK },
!   { "GL_ARB_multitexture", GLITZ_GLX_FEATURE_ARB_MULTITEXTURE_MASK },
!   { "GL_ARB_vertex_program", GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK },
!   { "GL_ARB_fragment_program", GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK },
    { "GL_EXT_pixel_buffer_object", GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK },
    { NULL, 0 }
--- 41,59 ----
    { "GL_EXT_texture_rectangle", GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
    { "GL_NV_texture_rectangle", GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK },
!   { "GL_ARB_texture_non_power_of_two",
!     GLITZ_GLX_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK },
    { "GL_ARB_texture_mirrored_repeat",
      GLITZ_GLX_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK },
!   { "GL_ARB_texture_border_clamp",
!     GLITZ_GLX_FEATURE_TEXTURE_BORDER_CLAMP_MASK },
!   { "GL_ARB_texture_env_combine", GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK },
!   { "GL_EXT_texture_env_combine", GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK },
!   { "GL_ARB_texture_env_dot3", GLITZ_GLX_FEATURE_TEXTURE_ENV_DOT3_MASK },
    { "GL_ARB_multisample", GLITZ_GLX_FEATURE_MULTISAMPLE_MASK },
    { "GL_NV_multisample_filter_hint",
!     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 }
***************
*** 101,108 ****
        screen_info->glx_feature_mask &
        GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK) {
!     char *renderer = (char *) glGetString (GL_RENDERER);
      
      screen_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_MASK;
      
      if (renderer) {
        /* All geforce and quadro cards seems to support multisample with
--- 104,115 ----
        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;
      
+     if (screen_info->glx_feature_mask &
+         GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_HINT_MASK)
+       screen_info->feature_mask |= GLITZ_FEATURE_MULTISAMPLE_FILTER_HINT_MASK;
+     
      if (renderer) {
        /* All geforce and quadro cards seems to support multisample with
***************
*** 115,121 ****
    }
  
!   if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_TEXTURE_NPOT_MASK) {
!     screen_info->texture_mask |= GLITZ_TEXTURE_TARGET_NPOT_MASK;
!     screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_NPOT_MASK;
    }
  
--- 122,129 ----
    }
  
!   if (screen_info->glx_feature_mask &
!       GLITZ_GLX_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) {
!     screen_info->texture_mask |= GLITZ_TEXTURE_TARGET_NON_POWER_OF_TWO_MASK;
!     screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK;
    }
  
***************
*** 131,153 ****
  
    if (screen_info->glx_feature_mask &
!       GLITZ_GLX_FEATURE_ARB_RENDER_TEXTURE_MASK)
!     screen_info->glx_feature_mask |= GLITZ_GLX_FEATURE_ARB_RENDER_TEXTURE_MASK;
  
!   if (screen_info->glx_feature_mask &
!       GLITZ_GLX_FEATURE_ARB_MULTITEXTURE_MASK) {
!     screen_info->feature_mask |= GLITZ_FEATURE_ARB_MULTITEXTURE_MASK;
  
      if (screen_info->glx_feature_mask &
!         GLITZ_GLX_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK)
!       screen_info->feature_mask |= GLITZ_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK;
      
      if (screen_info->glx_feature_mask &
!         GLITZ_GLX_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK)
!       screen_info->feature_mask |= GLITZ_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK;
        
!     if ((screen_info->feature_mask &
!          GLITZ_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK) &&
!         (screen_info->feature_mask &
!          GLITZ_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK)) {
        glitz_gl_int_t max_texture_units;
        
--- 139,161 ----
  
    if (screen_info->glx_feature_mask &
!       GLITZ_GLX_FEATURE_TEXTURE_BORDER_CLAMP_MASK)
!     screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK;
  
!   if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK)
!     screen_info->glx_feature_mask |= GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK;
! 
!   if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_MULTITEXTURE_MASK) {
!     screen_info->feature_mask |= GLITZ_FEATURE_MULTITEXTURE_MASK;
  
      if (screen_info->glx_feature_mask &
!         GLITZ_GLX_FEATURE_TEXTURE_ENV_COMBINE_MASK)
!       screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK;
      
      if (screen_info->glx_feature_mask &
!         GLITZ_GLX_FEATURE_TEXTURE_ENV_DOT3_MASK)
!       screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK;
        
!     if ((screen_info->feature_mask & GLITZ_FEATURE_TEXTURE_ENV_COMBINE_MASK) &&
!         (screen_info->feature_mask & GLITZ_FEATURE_TEXTURE_ENV_DOT3_MASK)) {
        glitz_gl_int_t max_texture_units;
        
***************
*** 157,170 ****
      }
          
!     if (screen_info->glx_feature_mask &
!         GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK)
!       screen_info->feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
  
      if (screen_info->glx_feature_mask &
!         GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
!       screen_info->feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
  
!     if ((screen_info->feature_mask & GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
!         (screen_info->feature_mask & GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK))
        screen_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
    }
--- 165,177 ----
      }
          
!     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)
!       screen_info->feature_mask |= GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK;
  
!     if ((screen_info->feature_mask & GLITZ_FEATURE_VERTEX_PROGRAM_MASK) &&
!         (screen_info->feature_mask & GLITZ_FEATURE_FRAGMENT_PROGRAM_MASK))
        screen_info->feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
    }

Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_format.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_glx_format.c	21 Jun 2004 21:26:56 -0000	1.7
--- glitz_glx_format.c	9 Aug 2004 22:57:35 -0000	1.8
***************
*** 314,318 ****
  glitz_glx_find_standard_format (Display *display,
                                  int screen,
-                                 unsigned long option_mask,
                                  glitz_format_name_t format_name)
  {
--- 314,317 ----
***************
*** 322,326 ****
    return
      glitz_format_find_standard (screen_info->formats, screen_info->n_formats,
!                                 option_mask, format_name);
  }
  slim_hidden_def(glitz_glx_find_standard_format);
--- 321,325 ----
    return
      glitz_format_find_standard (screen_info->formats, screen_info->n_formats,
!                                 format_name);
  }
  slim_hidden_def(glitz_glx_find_standard_format);

Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glitz_glx_info.c	24 Jul 2004 00:09:27 -0000	1.12
--- glitz_glx_info.c	9 Aug 2004 22:57:35 -0000	1.13
***************
*** 60,63 ****
--- 60,65 ----
    (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,
***************
*** 68,71 ****
--- 70,74 ----
    (glitz_gl_copy_pixels_t) glCopyPixels,
    (glitz_gl_flush_t) glFlush,
+   (glitz_gl_finish_t) glFinish,
    (glitz_gl_pixel_store_i_t) glPixelStorei,
    (glitz_gl_ortho_t) glOrtho,
***************
*** 186,192 ****
    thread_info->n_displays = 0;
  
-   memset (&thread_info->glx, 0, sizeof (glitz_glx_static_proc_address_list_t));
-   thread_info->glx.need_lookup = 1;
- 
    if (thread_info->gl_library) {
      free (thread_info->gl_library);
--- 189,192 ----
***************
*** 462,473 ****
                        screen_info->root_drawable,
                        screen_info->root_context.context)) {
      glitz_glx_context_proc_address_lookup (screen_info,
                                             &screen_info->root_context);
-     
-     glitz_glx_query_extensions (screen_info);
      glitz_glx_query_formats (screen_info);
    }
    
-   screen_info->context_stack = malloc (sizeof (glitz_glx_context_info_t));
    screen_info->context_stack_size = 1;
    screen_info->context_stack->surface = NULL;
--- 462,471 ----
                        screen_info->root_drawable,
                        screen_info->root_context.context)) {
+     glitz_glx_query_extensions (screen_info);
      glitz_glx_context_proc_address_lookup (screen_info,
                                             &screen_info->root_context);
      glitz_glx_query_formats (screen_info);
    }
    
    screen_info->context_stack_size = 1;
    screen_info->context_stack->surface = NULL;
***************
*** 489,499 ****
      glitz_program_map_fini (&screen_info->root_context.gl,
                              &screen_info->program_map);
    }
- 
-   glXMakeCurrent (display, None, NULL);
    
-   if (screen_info->context_stack)
-     free (screen_info->context_stack);
- 
    for (i = 0; i < screen_info->n_contexts; i++)
      glitz_glx_context_destroy (screen_info, screen_info->contexts[i]);
--- 487,493 ----
      glitz_program_map_fini (&screen_info->root_context.gl,
                              &screen_info->program_map);
+     glXMakeCurrent (display, None, NULL);
    }
    
    for (i = 0; i < screen_info->n_contexts; i++)
      glitz_glx_context_destroy (screen_info, screen_info->contexts[i]);

Index: glitz_glx_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_surface.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** glitz_glx_surface.c	24 Jul 2004 00:09:27 -0000	1.15
--- glitz_glx_surface.c	9 Aug 2004 22:57:35 -0000	1.16
***************
*** 42,46 ****
  
  static glitz_texture_t *
! _glitz_glx_surface_get_texture (void *abstract_surface);
  
  static void
--- 42,47 ----
  
  static glitz_texture_t *
! _glitz_glx_surface_get_texture (void *abstract_surface,
!                                 glitz_bool_t allocate);
  
  static void
***************
*** 59,64 ****
    if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT &&
        (!surface->drawable)) {
!     constraint = GLITZ_CN_ANY_CONTEXT_CURRENT;
!     success = 0;
    }
    
--- 60,72 ----
    if (constraint == GLITZ_CN_SURFACE_DRAWABLE_CURRENT &&
        (!surface->drawable)) {
!     if (surface->base.format->draw.offscreen) {
!       surface->drawable = surface->pbuffer =
!         glitz_glx_pbuffer_create (surface->screen_info->display_info,
!                                   surface->context->fbconfig,
!                                   &surface->base.texture);
!     } else {
!       constraint = GLITZ_CN_ANY_CONTEXT_CURRENT;
!       success = 0;
!     }
    }
    
***************
*** 66,70 ****
  
    if (surface) {
!     glitz_surface_setup_environment (&surface->base);
      return 1;
    }
--- 74,78 ----
  
    if (surface) {
!     glitz_surface_update_state (&surface->base);
      return 1;
    }
***************
*** 81,85 ****
    
    if (surface)
!     glitz_surface_setup_environment (&surface->base);
  }
  
--- 89,93 ----
    
    if (surface)
!     glitz_surface_update_state (&surface->base);
  }
  
***************
*** 139,143 ****
  
  static glitz_texture_t *
! _glitz_glx_surface_get_texture (void *abstract_surface)
  {
    glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
--- 147,152 ----
  
  static glitz_texture_t *
! _glitz_glx_surface_get_texture (void *abstract_surface,
!                                 glitz_bool_t allocate)
  {
    glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
***************
*** 151,154 ****
--- 160,167 ----
      glitz_intersect_bounding_box (&surface->base.dirty_box,
                                    &copy_box, &copy_box);
+ 
+     if (!surface->base.texture.allocated)
+       glitz_texture_allocate (surface->base.gl, &surface->base.texture);  
+       
      glitz_texture_copy_surface (&surface->base.texture, &surface->base,
                                  copy_box.x1,
***************
*** 160,163 ****
--- 173,181 ----
      surface->base.hint_mask &= ~GLITZ_INT_HINT_DIRTY_MASK;
    }
+ 
+   if (allocate) {
+     if (!surface->base.texture.allocated)
+       glitz_texture_allocate (surface->base.gl, &surface->base.texture);
+   }
    
    if (surface->base.texture.allocated)
***************
*** 172,189 ****
    surface->base.feature_mask = surface->screen_info->feature_mask;
  
!   surface->base.feature_mask &= ~GLITZ_FEATURE_ARB_MULTITEXTURE_MASK;
!   surface->base.feature_mask &= ~GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
!   surface->base.feature_mask &= ~GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
    surface->base.feature_mask &= ~GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
    surface->base.feature_mask &= ~GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
  
    if (surface->context->glx.need_lookup) {
!     glitz_surface_push_current (&surface->base,
!                                 GLITZ_CN_SURFACE_CONTEXT_CURRENT);
!     glitz_surface_pop_current (&surface->base);
    }
  
    if ((surface->screen_info->glx_feature_mask &
!        GLITZ_GLX_FEATURE_ARB_RENDER_TEXTURE_MASK) &&
        surface->context->glx.bind_tex_image &&
        surface->context->glx.release_tex_image)
--- 190,207 ----
    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_CONVOLUTION_FILTER_MASK;
    surface->base.feature_mask &= ~GLITZ_FEATURE_PIXEL_BUFFER_OBJECT_MASK;
  
    if (surface->context->glx.need_lookup) {
!     glitz_glx_context_push_current (surface, GLITZ_CN_SURFACE_CONTEXT_CURRENT);
!     glitz_glx_context_pop_current (surface);
    }
  
    if ((surface->screen_info->glx_feature_mask &
!        GLITZ_GLX_FEATURE_RENDER_TEXTURE_MASK) &&
        surface->context->glx.bind_tex_image &&
        surface->context->glx.release_tex_image)
***************
*** 192,196 ****
    if (surface->context->gl.active_texture &&
        surface->context->gl.multi_tex_coord_2d) {
!     surface->base.feature_mask |= GLITZ_FEATURE_ARB_MULTITEXTURE_MASK;
  
      if (surface->context->gl.gen_programs &&
--- 210,218 ----
    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 &&
***************
*** 199,219 ****
          surface->context->gl.bind_program &&
          surface->context->gl.program_local_param_4d) {
-       
        if (surface->screen_info->feature_mask &
!           GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK)
!         surface->base.feature_mask |= GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK;
        
!       if (surface->screen_info->feature_mask &
!           GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK)
!         surface->base.feature_mask |= GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK;
!     
!       if ((surface->base.feature_mask &
!            GLITZ_FEATURE_ARB_VERTEX_PROGRAM_MASK) &&
!           (surface->base.feature_mask &
!            GLITZ_FEATURE_ARB_FRAGMENT_PROGRAM_MASK) &&
!           surface->context->texture_indirections >= 9) {
!         /* Convolution filter programs require support for at least nine
!            texture indirections. */
!         surface->base.feature_mask |= GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
        }
      }
--- 221,239 ----
          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->texture_indirections >= 9) {
!             /* Convolution filter programs require support for at least nine
!                texture indirections. */
!             surface->base.feature_mask |=
!               GLITZ_FEATURE_CONVOLUTION_FILTER_MASK;
!           }
!         }
        }
      }
***************
*** 264,277 ****
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
!   if (surface->base.format->draw.offscreen) {
!     glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
!     
!     surface->drawable = surface->pbuffer =
!       glitz_glx_pbuffer_create (screen_info->display_info,
!                                 surface->context->fbconfig,
!                                 &surface->base.texture);
!     
!     glitz_surface_pop_current (&surface->base);
!   }
  
    _glitz_glx_set_features (surface);
--- 284,289 ----
    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);
***************
*** 334,337 ****
--- 346,351 ----
    surface->drawable = window;
  
+   surface->base.hint_mask |= GLITZ_INT_HINT_DRAWABLE_MASK;
+ 
    _glitz_glx_set_features (surface);
    

Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxint.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** glitz_glxint.h	24 Jul 2004 00:09:27 -0000	1.11
--- glitz_glxint.h	9 Aug 2004 22:57:35 -0000	1.12
***************
*** 38,55 ****
  #include "glitz_glxext.h"
  
! #define GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK       (1L <<  0)
! #define GLITZ_GLX_FEATURE_TEXTURE_NPOT_MASK            (1L <<  1)
! #define GLITZ_GLX_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK (1L <<  2)
! #define GLITZ_GLX_FEATURE_MULTISAMPLE_MASK             (1L <<  3)
! #define GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK      (1L <<  4)
! #define GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_MASK      (1L <<  5)
! #define GLITZ_GLX_FEATURE_ARB_MULTITEXTURE_MASK        (1L <<  6)
! #define GLITZ_GLX_FEATURE_ARB_TEXTURE_ENV_COMBINE_MASK (1L <<  7)
! #define GLITZ_GLX_FEATURE_ARB_TEXTURE_ENV_DOT3_MASK    (1L <<  8)
! #define GLITZ_GLX_FEATURE_ARB_VERTEX_PROGRAM_MASK      (1L <<  9)
! #define GLITZ_GLX_FEATURE_ARB_FRAGMENT_PROGRAM_MASK    (1L << 10)
! #define GLITZ_GLX_FEATURE_GLX13_MASK                   (1L << 11)
! #define GLITZ_GLX_FEATURE_ARB_RENDER_TEXTURE_MASK      (1L << 12)
! #define GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK     (1L << 13)
  
  typedef struct _glitz_glx_surface glitz_glx_surface_t;
--- 38,56 ----
  #include "glitz_glxext.h"
  
! #define GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK        (1L <<  0)
! #define GLITZ_GLX_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK (1L <<  1)
! #define GLITZ_GLX_FEATURE_TEXTURE_MIRRORED_REPEAT_MASK  (1L <<  2)
! #define GLITZ_GLX_FEATURE_TEXTURE_BORDER_CLAMP_MASK     (1L <<  3)
! #define GLITZ_GLX_FEATURE_MULTISAMPLE_MASK              (1L <<  4)
! #define GLITZ_GLX_FEATURE_CLIENT_MULTISAMPLE_MASK       (1L <<  5)
! #define GLITZ_GLX_FEATURE_MULTISAMPLE_FILTER_HINT_MASK  (1L <<  6)
! #define GLITZ_GLX_FEATURE_MULTITEXTURE_MASK             (1L <<  7)
! #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_RENDER_TEXTURE_MASK           (1L << 13)
! #define GLITZ_GLX_FEATURE_PIXEL_BUFFER_OBJECT_MASK      (1L << 14)
  
  typedef struct _glitz_glx_surface glitz_glx_surface_t;
***************
*** 114,118 ****
    int n_contexts;
    
!   glitz_glx_context_info_t *context_stack;
    int context_stack_size;
    
--- 115,119 ----
    int n_contexts;
    
!   glitz_glx_context_info_t context_stack[GLITZ_CONTEXT_STACK_SIZE];
    int context_stack_size;
    

Index: glitz_matrix.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_matrix.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_matrix.c	11 Jun 2004 14:35:41 -0000	1.6
--- glitz_matrix.c	9 Aug 2004 22:57:35 -0000	1.7
***************
*** 47,97 ****
  }
  
- void
- glitz_matrix_transform_bounding_box (glitz_matrix_t *matrix,
-                                      double *x1, double *y1,
-                                      double *x2, double *y2)
- {
-   int i;
-   double quad_x[4], quad_y[4];
-   double min_x, max_x;
-   double min_y, max_y;
- 
-   quad_x[0] = *x1;
-   quad_y[0] = *y1;
-   glitz_matrix_transform_point (matrix, &quad_x[0], &quad_y[0]);
- 
-   quad_x[1] = *x2;
-   quad_y[1] = *y1;
-   glitz_matrix_transform_point (matrix, &quad_x[1], &quad_y[1]);
- 
-   quad_x[2] = *x2;
-   quad_y[2] = *y2;
-   glitz_matrix_transform_point (matrix, &quad_x[2], &quad_y[2]);
- 
-   quad_x[3] = *x1;
-   quad_y[3] = *y2;
-   glitz_matrix_transform_point (matrix, &quad_x[3], &quad_y[3]);
- 
-   min_x = max_x = quad_x[0];
-   min_y = max_y = quad_y[0];
- 
-   for (i = 1; i < 4; i++) {
-     if (quad_x[i] < min_x)
-       min_x = quad_x[i];
-     if (quad_x[i] > max_x)
-       max_x = quad_x[i];
-     
-     if (quad_y[i] < min_y)
-       min_y = quad_y[i];
-     if (quad_y[i] > max_y)
-       max_y = quad_y[i];
-   }
-   
-   *x1 = min_x;
-   *y1 = min_y;
-   *x2 = max_x;
-   *y2 = max_y;
- }
- 
  static void
  _glitz_matrix_set_affine (glitz_matrix_t *matrix,
--- 47,50 ----

Index: glitz_operator.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_operator.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** glitz_operator.c	21 Jun 2004 21:26:56 -0000	1.3
--- glitz_operator.c	9 Aug 2004 22:57:35 -0000	1.4
***************
*** 108,111 ****
--- 108,112 ----
    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);

Index: glitz_pixel.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_pixel.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** glitz_pixel.c	20 Jul 2004 07:51:14 -0000	1.2
--- glitz_pixel.c	9 Aug 2004 22:57:35 -0000	1.3
***************
*** 654,665 ****
  {
    glitz_gl_proc_address_list_t *gl;
!   glitz_bool_t drawable;
    char *pixels, *data = NULL;
    glitz_gl_pixel_format_t *format = NULL;
    unsigned long transform = 0;
    int xoffset, bytes_per_line;
-   
-   if (SURFACE_PROGRAMMATIC (dst))
-     return;
  
    if (x_dst < 0 || x_dst > (dst->width - width) ||
--- 654,663 ----
  {
    glitz_gl_proc_address_list_t *gl;
!   glitz_bool_t to_drawable;
!   glitz_texture_t *texture;
    char *pixels, *data = NULL;
    glitz_gl_pixel_format_t *format = NULL;
    unsigned long transform = 0;
    int xoffset, bytes_per_line;
  
    if (x_dst < 0 || x_dst > (dst->width - width) ||
***************
*** 681,688 ****
    }
  
!   if (glitz_surface_try_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT))
!     drawable = 1;
    else
!     drawable = 0;
    
    if (transform) {
--- 679,694 ----
    }
  
!   if (SURFACE_RENDER_TEXTURE (dst))
!     to_drawable = 0;
!   else if (SURFACE_DRAWABLE (dst))
!     to_drawable = 1;
    else
!     to_drawable = 0;
! 
!   if (to_drawable) {
!     if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT))
!       to_drawable = 0;
!   } else
!     glitz_surface_push_current (dst, GLITZ_CN_ANY_CONTEXT_CURRENT);
    
    if (transform) {
***************
*** 694,697 ****
--- 700,704 ----
      data = malloc (stride * height);
      if (!data) {
+       glitz_surface_pop_current (dst);
        glitz_surface_status_add (dst, GLITZ_STATUS_NO_MEMORY_MASK);
        return;
***************
*** 731,735 ****
    }
  
!   glitz_texture_bind (gl, &dst->texture);
  
    gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
--- 738,748 ----
    }
  
!   texture = glitz_surface_get_texture (dst, 1);
!   if (!texture) {
!     glitz_surface_pop_current (dst);
!     return;
!   }
!   
!   glitz_texture_bind (gl, texture);
  
    gl->pixel_store_i (GLITZ_GL_UNPACK_ROW_LENGTH, 0);
***************
*** 749,753 ****
      gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 1);    
  
!   gl->tex_sub_image_2d (dst->texture.target, 0,
                          x_dst, dst->height - y_dst - height,
                          width, height,
--- 762,766 ----
      gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 1);    
  
!   gl->tex_sub_image_2d (texture->target, 0,
                          x_dst, dst->height - y_dst - height,
                          width, height,
***************
*** 755,781 ****
                          pixels);
  
!   if (drawable) {
      glitz_point_t tl, br;
      
      gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
                     GLITZ_GL_REPLACE);
!     dst->gl->color_4us (0x0, 0x0, 0x0, 0xffff);
      
      glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
      
!     glitz_texture_ensure_repeat (gl, &dst->texture, 0);
!     glitz_texture_ensure_filter (gl, &dst->texture, GLITZ_FILTER_NEAREST);
!     
!     tl.x = (x_dst / (double) dst->width) * dst->texture.texcoord_width;
!     tl.y = (y_dst / (double) dst->height) * dst->texture.texcoord_height;
!     
!     br.x = ((x_dst + width) / (double) dst->width) *
!       dst->texture.texcoord_width;
!     br.y = ((y_dst + height) / (double) dst->height) *
!       dst->texture.texcoord_height;
!     
!     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);
--- 768,793 ----
                          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);
***************
*** 794,798 ****
    }
    
!   glitz_texture_unbind (dst->gl, &dst->texture);
  
    if (transform == 0)
--- 806,812 ----
    }
    
!   glitz_texture_unbind (gl, texture);
! 
!   dst->hint_mask |= GLITZ_INT_HINT_SOLID_DIRTY_MASK;
  
    if (transform == 0)
***************
*** 814,818 ****
  {
    glitz_gl_proc_address_list_t *gl;
!   glitz_bool_t drawable;
    glitz_texture_t *texture = NULL;
    char *pixels, *data = NULL;
--- 828,832 ----
  {
    glitz_gl_proc_address_list_t *gl;
!   glitz_bool_t from_drawable;
    glitz_texture_t *texture = NULL;
    char *pixels, *data = NULL;
***************
*** 822,828 ****
    int xoffset, bytes_per_line;
    
-   if (SURFACE_PROGRAMMATIC (src))
-     return;
-   
    if (x_src < 0 || x_src > (src->width - width) ||
        y_src < 0 || y_src > (src->height - height)) {
--- 836,839 ----
***************
*** 833,846 ****
    gl = src->gl;
  
!   if (glitz_surface_try_push_current (src, GLITZ_CN_SURFACE_DRAWABLE_CURRENT))
!     drawable = 1;
!   else {
!     drawable = 0;
!     texture = glitz_surface_get_texture (src);
!   
!     /* Texture has not been allocated, hence source and the result of this
!        operation is undefined. So lets do nothing. */
!     if (!texture)
        return;
  
      transform |= GLITZ_TRANSFORM_COPY_REGION_MASK;
--- 844,857 ----
    gl = src->gl;
  
!   if (glitz_surface_push_current (src, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!     from_drawable = 1;
!   } else {
!     from_drawable = 0;
!     
!     texture = glitz_surface_get_texture (src, 0);
!     if (!texture) {
!       glitz_surface_pop_current (src);
        return;
+     }
  
      transform |= GLITZ_TRANSFORM_COPY_REGION_MASK;
***************
*** 900,904 ****
      gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 1);
  
!   if (drawable) {
      gl->read_pixels (x_src, src->height - y_src - height,
                       width, height,
--- 911,915 ----
      gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 1);
  
!   if (from_drawable) {
      gl->read_pixels (x_src, src->height - y_src - height,
                       width, height,

Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glitz_program.c	20 Jul 2004 07:51:14 -0000	1.9
--- glitz_program.c	9 Aug 2004 22:57:35 -0000	1.10
***************
*** 39,59 ****
    "MUL result.color, color, fragment.color.a;"
  
! #define EXPAND_SRC_TEMP "TEMP src;"
  #define EXPAND_SRC_2D_IN_OP \
!   "TEX 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 \
    "TEX src, fragment.texcoord[1], texture[1], RECT;" \
    "DP4 color.a, color, fragment.color;" \
    "MUL result.color, src, color.a;"
  
! #define EXPAND_MASK_TEMP "TEMP mask;"
  #define EXPAND_MASK_2D_IN_OP \
!   "TEX 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 \
!   "TEX mask, fragment.texcoord[0], texture[0], RECT;" \
    "DP4 mask.a, mask, fragment.color;" \
    "MUL result.color, color, mask.a;"
--- 39,72 ----
    "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;" \
    "MUL result.color, color, mask.a;"
***************
*** 71,78 ****
      
      /* [GLITZ_TEXTURE_NONE][GLITZ_TEXTURE_2D] */
!     { EXPAND_NONE, EXPAND_MASK_TEMP, EXPAND_MASK_2D_IN_OP },
      
      /* [GLITZ_TEXTURE_NONE][GLITZ_TEXTURE_RECT] */
!     { EXPAND_NONE, EXPAND_MASK_TEMP, EXPAND_MASK_RECT_IN_OP }
    }, {
      
--- 84,91 ----
      
      /* [GLITZ_TEXTURE_NONE][GLITZ_TEXTURE_2D] */
!     { EXPAND_NONE, EXPAND_MASK_DECL, EXPAND_MASK_2D_IN_OP },
      
      /* [GLITZ_TEXTURE_NONE][GLITZ_TEXTURE_RECT] */
!     { EXPAND_NONE, EXPAND_MASK_DECL, EXPAND_MASK_RECT_IN_OP }
    }, {
      
***************
*** 81,88 ****
      
      /* [GLITZ_TEXTURE_2D][GLITZ_TEXTURE_2D] */
!     { EXPAND_2D, EXPAND_MASK_TEMP, EXPAND_MASK_2D_IN_OP },
      
      /* [GLITZ_TEXTURE_2D][GLITZ_TEXTURE_RECT] */
!     { EXPAND_2D, EXPAND_MASK_TEMP, EXPAND_MASK_RECT_IN_OP }
    }, {
      
--- 94,101 ----
      
      /* [GLITZ_TEXTURE_2D][GLITZ_TEXTURE_2D] */
!     { EXPAND_2D, EXPAND_MASK_DECL, EXPAND_MASK_2D_IN_OP },
      
      /* [GLITZ_TEXTURE_2D][GLITZ_TEXTURE_RECT] */
!     { EXPAND_2D, EXPAND_MASK_DECL, EXPAND_MASK_RECT_IN_OP }
    }, {
      
***************
*** 91,132 ****
      
      /* [GLITZ_TEXTURE_RECT][GLITZ_TEXTURE_2D] */
!     { EXPAND_RECT, EXPAND_MASK_TEMP, EXPAND_MASK_2D_IN_OP },
      
      /* [GLITZ_TEXTURE_RECT][GLITZ_TEXTURE_RECT] */
!     { EXPAND_RECT, EXPAND_MASK_TEMP, EXPAND_MASK_RECT_IN_OP }
    }
  };
  
  /*
!  * Passes texture coordinates to convolution filter
!  * fragment programs.
!  *
!  * program.local[0]: Vertical pixel offset in texture coordinates
!  * program.local[1]: Horizontal pixel offset in texture coordinates
   *
   * Author: David Reveman <c99drn at cs.umu.se>
   */   
! static const char *_glitz_vertex_program_convolution[] = {
    "!!ARBvp1.0",
    "OPTION ARB_position_invariant;",
-   "ATTRIB coord = vertex.texcoord[%s];",
-   "PARAM vertical_offset   = program.local[0];",
-   "PARAM horizontal_offset = program.local[1];",
-   "MOV result.texcoord[%s], coord;",
-   "ADD result.texcoord[2], coord, vertical_offset;",
-   "SUB result.texcoord[3], coord, vertical_offset;",
-   "ADD result.texcoord[4], coord, horizontal_offset;",
-   "SUB result.texcoord[5], coord, horizontal_offset;",
    "MOV result.texcoord[%s], vertex.texcoord[%s];",
    "END", NULL
  };
  
  /*
!  * General 3x3 convolution filter.
!  * Convolution kernel must be normalized.
   *
!  * program.local[0]: Top convolution kernel row
!  * program.local[1]: Middle convolution kernel row
!  * program.local[2]: Bottom convolution kernel row
   *
   * Author: David Reveman <c99drn at cs.umu.se>
--- 104,138 ----
      
      /* [GLITZ_TEXTURE_RECT][GLITZ_TEXTURE_2D] */
!     { EXPAND_RECT, EXPAND_MASK_DECL, EXPAND_MASK_2D_IN_OP },
      
      /* [GLITZ_TEXTURE_RECT][GLITZ_TEXTURE_RECT] */
!     { EXPAND_RECT, EXPAND_MASK_DECL, EXPAND_MASK_RECT_IN_OP }
    }
  };
  
  /*
!  * Default vertex program
   *
   * Author: David Reveman <c99drn at cs.umu.se>
   */   
! static const char *_glitz_vertex_program[] = {
    "!!ARBvp1.0",
    "OPTION ARB_position_invariant;",
    "MOV result.texcoord[%s], vertex.texcoord[%s];",
+   "MOV result.texcoord[%s], vertex.texcoord[%s];",
+   "MOV result.color, vertex.color;",
    "END", NULL
  };
  
  /*
!   TODO: the following convolution filter program could easily be
!   dynamically created for any convolution kernel size.
! */
! 
! /*
!  * 9 samples convolution filter. projective transformations might not
!  * produce correct results.
   *
!  * program.local[0..n]: Each parameter holds an offset and a weight.
   *
   * Author: David Reveman <c99drn at cs.umu.se>
***************
*** 134,189 ****
  static const char *_glitz_fragment_program_convolution[] = {
    "!!ARBfp1.0",
!   "ATTRIB east = fragment.texcoord[2];",
!   "ATTRIB west = fragment.texcoord[3];",
!   "ATTRIB south = fragment.texcoord[4];",
!   "ATTRIB north = fragment.texcoord[5];",
!   "PARAM k0 = program.local[0];",
!   "PARAM k1 = program.local[1];",
!   "PARAM k2 = program.local[2];",
!   "TEMP color, in, coord;",
  
    /* extra declerations */
    "%s",
  
!   /* center */
!   "TEX in, fragment.texcoord[%s], texture[%s], %s;",
!   "MUL color, in, k1.y;",
!   
!   /* north west */
!   "MOV coord.x, west.x;",
!   "MOV coord.y, north.y;",
!   "TEX in, coord, texture[%s], %s;",
!   "MAD color, in, k0.x, color;",
  
!   /* north */
!   "TEX in, north, texture[%s], %s;",
!   "MAD color, in, k0.y, color;",
  
!   /* north east */
!   "MOV coord.x, east.x;",
!   "TEX in, coord, texture[%s], %s;",
!   "MAD color, in, k0.z, color;",
  
!   /* east */
!   "TEX in, east, texture[%s], %s;",
!   "MAD color, in, k1.x, color;",
  
!   /* south east */
!   "MOV coord.y, south.y;",
!   "TEX in, coord, texture[%s], %s;",
!   "MAD color, in, k2.z, color;",
  
!   /* south */
!   "TEX in, south, texture[%s], %s;",
!   "MAD color, in, k2.y, color;",
  
!   /* south west */
!   "MOV coord.x, west.x;",
!   "TEX in, coord, texture[%s], %s;",
!   "MAD color, in, k2.x, color;",
  
!   /* west */
!   "TEX in, west, texture[%s], %s;",
!   "MAD color, in, k1.x, color;",
  
    /* IN operation */
--- 140,220 ----
  static const char *_glitz_fragment_program_convolution[] = {
    "!!ARBfp1.0",
!   "ATTRIB center = fragment.texcoord[%s];",
!   "PARAM p0 = program.local[0];",
!   "PARAM p1 = program.local[1];",
!   "PARAM p2 = program.local[2];",
!   "PARAM p3 = program.local[3];",
!   "PARAM p4 = program.local[4];",
!   "PARAM p5 = program.local[5];",
!   "PARAM p6 = program.local[6];",
!   "PARAM p7 = program.local[7];",
!   "PARAM p8 = program.local[8];",
!   "PARAM m0 = state.matrix.texture[%s].row[0];",
!   "PARAM m1 = state.matrix.texture[%s].row[1];",
!   "PARAM m3 = state.matrix.texture[%s].row[3];",
!   "TEMP color, in, coord, position;",
  
    /* extra declerations */
    "%s",
  
!   /* projective transform */
!   "DP4 position.x, m0, center;",
!   "DP4 position.y, m1, center;",
!   "DP4 position.w, m3, center;",
!   "MOV coord, position;",
  
!   /* 1 */
!   "ADD coord.x, position.x, p0.x;",
!   "ADD coord.y, position.y, p0.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MUL color, in, p0.z;",
  
!   /* 2 */
!   "ADD coord.x, position.x, p1.x;",
!   "ADD coord.y, position.y, p1.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p1.z, color;",
  
!   /* 3 */
!   "ADD coord.x, position.x, p2.x;",
!   "ADD coord.y, position.y, p2.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p2.z, color;",
  
!   /* 4 */
!   "ADD coord.x, position.x, p3.x;",
!   "ADD coord.y, position.y, p3.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p3.z, color;",
  
!   /* 5 */
!   "ADD coord.x, position.x, p4.x;",
!   "ADD coord.y, position.y, p4.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p4.z, color;",
  
!   /* 6 */
!   "ADD coord.x, position.x, p5.x;",
!   "ADD coord.y, position.y, p5.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p5.z, color;",
  
!   /* 7 */
!   "ADD coord.x, position.x, p6.x;",
!   "ADD coord.y, position.y, p6.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p6.z, color;",
! 
!   /* 8 */
!   "ADD coord.x, position.x, p7.x;",
!   "ADD coord.y, position.y, p7.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p7.z, color;",
! 
!   /* 9 */
!   "ADD coord.x, position.x, p8.x;",
!   "ADD coord.y, position.y, p8.y;",
!   "TXP in, coord, texture[%s], %s;",
!   "MAD color, in, p8.z, color;",
  
    /* IN operation */
***************
*** 194,199 ****
  
  /*
!  * Linear gradient using 1D texture as color range.
!  * Color range in texture unit 2.
   *
   * program.local[0].x = start offset
--- 225,229 ----
  
  /*
!  * Linear gradient filter.
   *
   * program.local[0].x = start offset
***************
*** 202,217 ****
   * program.local[0].w = cos (angle)
   *
!  * transform:
!  * [ a | c | tx ]
!  * [ b | d | ty ]
!  * [ 0 | 0 |  1 ]
!  *
!  * program.local[1].x = a
!  * program.local[1].y = b
!  * program.local[1].z = c
!  * program.local[1].w = d
!  * program.local[2].x = tx
!  * program.local[2].y = ty
!  * program.local[2].z = height
   *
   * Author: David Reveman <c99drn at cs.umu.se>
--- 232,237 ----
   * program.local[0].w = cos (angle)
   *
!  * Incoming texture coordinate is transformed using the affine
!  * transform stored in the texture matrix.
   *
   * Author: David Reveman <c99drn at cs.umu.se>
***************
*** 220,225 ****
    "!!ARBfp1.0",
    "PARAM gradient = program.local[0];",
!   "PARAM transform = program.local[1];",
!   "PARAM translate = program.local[2];",
    "ATTRIB pos = fragment.texcoord[%s];",
    "TEMP color, distance, position;",
--- 240,246 ----
    "!!ARBfp1.0",
    "PARAM gradient = program.local[0];",
!   "PARAM adjust = program.local[1];",
!   "PARAM affine0 = state.matrix.texture[%s].row[0];",
!   "PARAM affine1 = state.matrix.texture[%s].row[1];",
    "ATTRIB pos = fragment.texcoord[%s];",
    "TEMP color, distance, position;",
***************
*** 228,243 ****
    "%s",
  
!   /* flip Y position (this should be done in advance) */
!   "SUB position.y, translate.z, pos.y;",
! 
!   /* transform X position */
!   "MUL position.x, transform.x, pos.x;",
!   "MAD position.x, transform.z, position.y, position.x;",
!   "ADD position.x, position.x, translate.x;",
! 
!   /* transform Y position */
!   "MUL position.y, transform.w, position.y;",
!   "MAD position.y, transform.y, pos.x, position.y;",
!   "ADD position.y, position.y, translate.y;",
  
    /* calculate gradient offset */
--- 249,255 ----
    "%s",
  
!   /* affine transform */
!   "DP4 position.x, affine0, pos;",
!   "DP4 position.y, affine1, pos;",
  
    /* calculate gradient offset */
***************
*** 247,252 ****
    "SUB distance.x, position.x, gradient.x;",
    "MUL distance.x, distance.x, gradient.y;",
    
!   "TEX color, distance, texture[2], 1D;",
    
    /* IN operation */
--- 259,268 ----
    "SUB distance.x, position.x, gradient.x;",
    "MUL distance.x, distance.x, gradient.y;",
+ 
+   /* temporary fix (until the new gradient shaders are implemented) */
+   "MOV distance.y, 0.5;",
+   "MUL distance.x, distance.x, adjust.x;",
    
!   "TEX color, distance, texture[%s], %s;",
    
    /* IN operation */
***************
*** 257,262 ****
  
  /*
!  * Radial gradient using 1D texture as color range.
!  * Color range in texture unit 2.
   *
   * param.local[0].x = center point X coordinate
--- 273,277 ----
  
  /*
!  * Radial gradient filter.
   *
   * param.local[0].x = center point X coordinate
***************
*** 265,280 ****
   * param.local[0].w = radius0
   *
!  * transform:
!  * [ a | c | tx ]
!  * [ b | d | ty ]
!  * [ 0 | 0 |  1 ]
!  *
!  * program.local[1].x = a
!  * program.local[1].y = b
!  * program.local[1].z = c
!  * program.local[1].w = d
!  * program.local[2].x = tx
!  * program.local[2].y = ty
!  * program.local[2].z = height
   *
   * Author: David Reveman <c99drn at cs.umu.se>
--- 280,285 ----
   * param.local[0].w = radius0
   *
!  * Incoming texture coordinate is transformed using the affine
!  * transform stored in the texture matrix.
   *
   * Author: David Reveman <c99drn at cs.umu.se>
***************
*** 283,288 ****
    "!!ARBfp1.0",
    "PARAM gradient = program.local[0];",
!   "PARAM transform = program.local[1];",
!   "PARAM translate = program.local[2];",
    "ATTRIB pos = fragment.texcoord[%s];",
    "TEMP color, distance, position;",
--- 288,294 ----
    "!!ARBfp1.0",
    "PARAM gradient = program.local[0];",
!   "PARAM adjust = program.local[1];",
!   "PARAM affine0 = state.matrix.texture[%s].row[0];",
!   "PARAM affine1 = state.matrix.texture[%s].row[1];",
    "ATTRIB pos = fragment.texcoord[%s];",
    "TEMP color, distance, position;",
***************
*** 291,306 ****
    "%s",
  
!   /* flip Y position (this should be done in advance) */
!   "SUB position.y, translate.z, pos.y;",
!   
!   /* transform X position */
!   "MUL position.x, transform.x, pos.x;",
!   "MAD position.x, transform.z, position.y, position.x;",
!   "ADD position.x, position.x, translate.x;",
! 
!   /* transform Y position */
!   "MUL position.y, transform.w, position.y;",
!   "MAD position.y, transform.y, pos.x, position.y;",
!   "ADD position.y, position.y, translate.y;",
    
    /* calculate gradient offset */
--- 297,303 ----
    "%s",
  
!   /* affine transform */
!   "DP4 position.x, affine0, pos;",
!   "DP4 position.y, affine1, pos;",
    
    /* calculate gradient offset */
***************
*** 316,321 ****
    "SUB distance.x, distance.x, gradient.w;",
    "MUL distance.x, distance.x, gradient.z;",
    
!   "TEX color, distance, texture[2], 1D;",
    
    /* IN operation */
--- 313,322 ----
    "SUB distance.x, distance.x, gradient.w;",
    "MUL distance.x, distance.x, gradient.z;",
+ 
+   /* temporary fix (until the new gradient shaders are implemented) */
+   "MOV distance.y, 0.5;",
+   "MUL distance.x, distance.x, adjust.x;",
    
!   "TEX color, distance, texture[%s], %s;",
    
    /* IN operation */
***************
*** 381,402 ****
      dst += n;
    }
  }
  
  static glitz_gl_uint_t
! _glitz_create_vertex_program (glitz_render_op_t *op,
                                const glitz_program_expand_t *expand)
  {
    char program[512], program_buffer[512];
!   
    switch (op->type) {
!   case GLITZ_RENDER_TYPE_ARGBF:
!   case GLITZ_RENDER_TYPE_ARGBF_SOLID:
!     _string_array_to_char_array (program, _glitz_vertex_program_convolution);
      sprintf (program_buffer, program,
               "0", "0", "1", "1");
      break;
!   case GLITZ_RENDER_TYPE_ARGBF_ARGB:
!   case GLITZ_RENDER_TYPE_ARGBF_ARGBC:
!     _string_array_to_char_array (program, _glitz_vertex_program_convolution);
      sprintf (program_buffer, program,
               "1", "1", "0", "0");
--- 382,406 ----
      dst += n;
    }
+   *dst = '\0';
  }
  
  static glitz_gl_uint_t
! _glitz_create_vertex_program (glitz_composite_op_t *op,
!                               glitz_filter_t filter,
                                const glitz_program_expand_t *expand)
  {
    char program[512], program_buffer[512];
! 
!   _string_array_to_char_array (program, _glitz_vertex_program);
!     
    switch (op->type) {
!   case GLITZ_COMBINE_TYPE_ARGBF:
!   case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
!   case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
      sprintf (program_buffer, program,
               "0", "0", "1", "1");
      break;
!   case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
!   case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
      sprintf (program_buffer, program,
               "1", "1", "0", "0");
***************
*** 410,482 ****
  
  static glitz_gl_uint_t
! _glitz_create_fragment_program (glitz_render_op_t *op,
                                  const glitz_program_expand_t *expand)
  {
!   char program[2048], program_buffer[2048];
!   
!   switch (op->type) {
!   case GLITZ_RENDER_TYPE_ARGBF:
!   case GLITZ_RENDER_TYPE_ARGBF_SOLID:
!     _string_array_to_char_array (program, _glitz_fragment_program_convolution);
!     sprintf (program_buffer, program,
!              expand->declarations,
!              "0", "0", expand->texture,
!              "0", expand->texture,
!              "0", expand->texture,
!              "0", expand->texture,
!              "0", expand->texture,
!              "0", expand->texture,
!              "0", expand->texture,
!              "0", expand->texture,
!              "0", expand->texture,
!              expand->in);
!     break;
!   case GLITZ_RENDER_TYPE_ARGBF_ARGB:
!   case GLITZ_RENDER_TYPE_ARGBF_ARGBC:
!     _string_array_to_char_array (program, _glitz_fragment_program_convolution);
!     sprintf (program_buffer, program,
!              expand->declarations,
!              "1", "1", expand->texture,
!              "1", expand->texture,
!              "1", expand->texture,
!              "1", expand->texture,
!              "1", expand->texture,
!              "1", expand->texture,
!              "1", expand->texture,
!              "1", expand->texture,
!              "1", expand->texture,
!              expand->in);
!     break;
!   case GLITZ_RENDER_TYPE_LGRAD:
!   case GLITZ_RENDER_TYPE_LGRAD_SOLID:
!     _string_array_to_char_array (program, _glitz_fragment_program_linear);
!     sprintf (program_buffer, program,
!              "0",
!              expand->declarations,
!              expand->in);
!     break;
!   case GLITZ_RENDER_TYPE_LGRAD_ARGB:
!   case GLITZ_RENDER_TYPE_LGRAD_ARGBC:
      _string_array_to_char_array (program, _glitz_fragment_program_linear);
!     sprintf (program_buffer, program,
!              "1",
!              expand->declarations,
!              expand->in);
!     break;
!   case GLITZ_RENDER_TYPE_RGRAD:
!   case GLITZ_RENDER_TYPE_RGRAD_SOLID:
!     _string_array_to_char_array (program, _glitz_fragment_program_radial);
!     sprintf (program_buffer, program,
!              "0",
!              expand->declarations,
!              expand->in);
      break;
!   case GLITZ_RENDER_TYPE_RGRAD_ARGB:
!   case GLITZ_RENDER_TYPE_RGRAD_ARGBC:
      _string_array_to_char_array (program, _glitz_fragment_program_radial);
!     sprintf (program_buffer, program,
!              "1",
!              expand->declarations,
!              expand->in);
      break;
    default:
--- 414,515 ----
  
  static glitz_gl_uint_t
! _glitz_create_fragment_program (glitz_composite_op_t *op,
!                                 glitz_filter_t filter,
                                  const glitz_program_expand_t *expand)
  {
!   char program[4096], program_buffer[4096];
! 
!   switch (filter) {
!   case GLITZ_FILTER_CONVOLUTION:
!       _string_array_to_char_array (program,
!                                    _glitz_fragment_program_convolution);
!       
!       switch (op->type) {
!       case GLITZ_COMBINE_TYPE_ARGBF:
!       case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
!       case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
!         sprintf (program_buffer, program,
!                  "0", "0", "0", "0",
!                  expand->declarations,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  "0", expand->texture,
!                  expand->in);
!         break;
!       case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
!       case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
!         sprintf (program_buffer, program,
!                  "1", "1", "1", "1",
!                  expand->declarations,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  "1", expand->texture,
!                  expand->in);
!         break;
!       default:
!         return 0;
!       }
!       break;
!   case GLITZ_FILTER_LINEAR_GRADIENT:
      _string_array_to_char_array (program, _glitz_fragment_program_linear);
!     
!     switch (op->type) {
!     case GLITZ_COMBINE_TYPE_ARGBF:
!     case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
!     case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
!       sprintf (program_buffer, program,
!                "0", "0", "0",
!                expand->declarations,
!                "0", expand->texture,
!                expand->in);
!       break;
!     case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
!     case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
!       sprintf (program_buffer, program,
!                "1", "1", "1",
!                expand->declarations,
!                "1", expand->texture,
!                expand->in);
!       break;
!     default:
!       return 0;
!     }
      break;
!   case GLITZ_FILTER_RADIAL_GRADIENT:
      _string_array_to_char_array (program, _glitz_fragment_program_radial);
!     
!     switch (op->type) {
!     case GLITZ_COMBINE_TYPE_ARGBF:
!     case GLITZ_COMBINE_TYPE_ARGBF_SOLID:
!     case GLITZ_COMBINE_TYPE_ARGBF_SOLIDC:
!       sprintf (program_buffer, program,
!                "0", "0", "0",
!                expand->declarations,
!                "0", expand->texture,
!                expand->in);
!       break;
!     case GLITZ_COMBINE_TYPE_ARGBF_ARGB:
!     case GLITZ_COMBINE_TYPE_ARGBF_ARGBC:
!       sprintf (program_buffer, program,
!                "1", "1", "1",
!                expand->declarations,
!                "1", expand->texture,
!                expand->in);
!       break;
!     default:
!       return 0;
!     }
      break;
    default:
***************
*** 488,495 ****
  
  static int
! _texture_index (glitz_texture_t *texture)
  {
!   if (texture) {
!     if (texture->target == GLITZ_GL_TEXTURE_2D)
        return GLITZ_TEXTURE_2D;
      else
--- 521,528 ----
  
  static int
! _texture_index (glitz_surface_t *surface)
  {
!   if (surface) {
!     if (surface->texture.target == GLITZ_GL_TEXTURE_2D)
        return GLITZ_TEXTURE_2D;
      else
***************
*** 509,537 ****
                          glitz_program_map_t *map)
  {
!   int i, x, y;
      
!   for (i = 0; i < GLITZ_RENDER_TYPES; i++) {
!     for (x = 0; x < GLITZ_TEXTURE_LAST; x++)
!       for (y = 0; y < GLITZ_TEXTURE_LAST; y++) {
!         if (map->info[i].vertex[x][y])
!           gl->delete_programs (1, &map->info[i].vertex[x][y]);
!         if (map->info[i].fragment[x][y])
!           gl->delete_programs (1, &map->info[i].vertex[x][y]);
!       }
!   }
  }
  
  glitz_gl_uint_t
! glitz_get_vertex_program (glitz_render_op_t *op)
  {
    glitz_gl_uint_t *program;
!   int index1 = _texture_index (op->src_texture);
!   int index2 = _texture_index (op->mask_texture);
!     
!   program = &op->dst->program_map->info[op->type].vertex[index1][index2];
    
!   if (*program == 0)
!     *program =
!       _glitz_create_vertex_program (op, &_program_expand_map[index1][index2]);
  
    return *program;
--- 542,578 ----
                          glitz_program_map_t *map)
  {
!   int i, j, x, y;
      
!   for (i = 0; i < GLITZ_COMBINE_TYPES; i++)
!     for (j = 0; j < GLITZ_FRAGMENT_FILTER_TYPES; j++)
!       for (x = 0; x < GLITZ_TEXTURE_LAST; x++)
!         for (y = 0; y < GLITZ_TEXTURE_LAST; y++) {
!           if (map->info[i][j].vertex[x][y])
!             gl->delete_programs (1, &map->info[i][j].vertex[x][y]);
!           if (map->info[i][j].fragment[x][y])
!             gl->delete_programs (1, &map->info[i][j].vertex[x][y]);
!         }
  }
  
  glitz_gl_uint_t
! glitz_get_vertex_program (glitz_composite_op_t *op,
!                           glitz_filter_t filter)
  {
    glitz_gl_uint_t *program;
!   int index1 = _texture_index (op->src);
!   int index2 = _texture_index (op->mask);
! 
!   /* smae vertex program for all filters */
!   program = &op->dst->program_map->info[op->type][0].vertex[index1][index2];
    
!   if (*program == 0) {
!     if (glitz_surface_push_current (op->dst,
!                                     GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!       *program =
!         _glitz_create_vertex_program (op, filter,
!                                       &_program_expand_map[index1][index2]);
!     }
!     glitz_surface_pop_current (op->dst);
!   }
  
    return *program;
***************
*** 539,554 ****
  
  glitz_gl_uint_t
! glitz_get_fragment_program (glitz_render_op_t *op)
  {
    glitz_gl_uint_t *program;
!   int index1 = _texture_index (op->src_texture);
!   int index2 = _texture_index (op->mask_texture);
!     
!   program = &op->dst->program_map->info[op->type].fragment[index1][index2];
    
!   if (*program == 0)
!     *program =
!       _glitz_create_fragment_program (op,
!                                       &_program_expand_map[index1][index2]);
  
    return *program;
--- 580,619 ----
  
  glitz_gl_uint_t
! glitz_get_fragment_program (glitz_composite_op_t *op,
!                             glitz_filter_t filter)
  {
    glitz_gl_uint_t *program;
!   int index1 = _texture_index (op->src);
!   int index2 = _texture_index (op->mask);
!   int ftype;
! 
!   switch (filter) {
!   case GLITZ_FILTER_CONVOLUTION:
!     ftype = GLITZ_FRAGMENT_FILTER_CONVOLUTION;
!     break;
!   case GLITZ_FILTER_LINEAR_GRADIENT:
!     ftype = GLITZ_FRAGMENT_FILTER_LINEAR_GRADIENT;
!     break;
!   case GLITZ_FILTER_RADIAL_GRADIENT:
!     ftype = GLITZ_FRAGMENT_FILTER_RADIAL_GRADIENT;
!     break;
!   case GLITZ_FILTER_BILINEAR:
!   case GLITZ_FILTER_NEAREST:
!   default:
!     return 0;
!   }
    
!   program =
!     &op->dst->program_map->info[op->type][ftype].fragment[index1][index2];
!   
!   if (*program == 0) {
!     if (glitz_surface_push_current (op->dst,
!                                     GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
!       *program =
!         _glitz_create_fragment_program (op, filter,
!                                         &_program_expand_map[index1][index2]);
!     }
!     glitz_surface_pop_current (op->dst);
!   }
  
    return *program;

--- glitz_programmatic.c DELETED ---

Index: glitz_rect.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_rect.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_rect.c	11 Jun 2004 14:35:41 -0000	1.5
--- glitz_rect.c	9 Aug 2004 22:57:35 -0000	1.6
***************
*** 32,35 ****
--- 32,41 ----
  #include "glitzint.h"
  
+ #define STORE_16(dst, size, src) \
+   dst = ((size) ? \
+          ((((((1L << (size)) - 1L) * (src)) / 0xffff) * 0xffff) / \
+           ((1L << (size)) - 1L)) : \
+          dst)
+ 
  static void
  glitz_rectangle_bounds (int n_rects,
***************
*** 64,85 ****
                             int n_rects)
  {
!   glitz_bounding_box_t bounds;
!   glitz_gl_vertex_2i_t vertex_2i;
    glitz_gl_bitfield_t clear_mask;
    
-   glitz_rectangle_bounds (n_rects, rects, &bounds);
-   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
-       bounds.x2 < 0 || bounds.y2 < 0)
-     return;
- 
    if (op == GLITZ_OPERATOR_SRC && (!*dst->stencil_mask)) {
      clear_mask = GLITZ_GL_COLOR_BUFFER_BIT;
!     dst->gl->clear_color (color->red / (glitz_gl_clampf_t) 0xffff,
!                           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;
!     dst->gl->clear_stencil (*dst->stencil_mask);
    } else {
      if (op == (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SRC)
--- 70,85 ----
                             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)
***************
*** 91,108 ****
    if (clear_mask) {
      for (; n_rects; n_rects--, rects++) {
!       dst->gl->scissor (rects->x,
!                         dst->height - (rects->y + rects->height),
!                         rects->width,
!                         rects->height);
!       dst->gl->clear (clear_mask);
      }
    } else {
!     dst->gl->color_4us (color->red, color->green, color->blue, color->alpha);
        
!     glitz_set_operator (dst->gl, op);
        
!     dst->gl->begin (GLITZ_GL_QUADS);
        
-     vertex_2i = dst->gl->vertex_2i;
      for (; n_rects; n_rects--, rects++) {
        vertex_2i (rects->x, rects->y);
--- 91,111 ----
    if (clear_mask) {
      for (; n_rects; n_rects--, rects++) {
!       gl->enable (GLITZ_GL_SCISSOR_TEST);
!       gl->scissor (rects->x,
!                    dst->height - (rects->y + rects->height),
!                    rects->width,
!                    rects->height);
!       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 (rects->x, rects->y);
***************
*** 112,119 ****
      }
    
!     dst->gl->end ();
    }
  }
  
  void
  glitz_fill_rectangle (glitz_operator_t op,
--- 115,138 ----
      }
    
!     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,
***************
*** 136,139 ****
--- 155,164 ----
      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;
***************
*** 142,145 ****
--- 167,171 ----
  
    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;
***************
*** 167,171 ****
--- 193,205 ----
      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_render.c DELETED ---

Index: glitz_status.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_status.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** glitz_status.c	30 Mar 2004 17:07:19 -0000	1.1.1.1
--- glitz_status.c	9 Aug 2004 22:57:35 -0000	1.2
***************
*** 32,35 ****
--- 32,56 ----
  #include "glitzint.h"
  
+ unsigned long
+ glitz_status_to_status_mask (glitz_status_t status)
+ {
+   switch (status) {
+   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;
+   }
+   
+   return 0;
+ }
+ 
  glitz_status_t
  glitz_status_pop_from_mask (unsigned long *mask)

Index: glitz_stencil.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_stencil.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** glitz_stencil.c	11 Jun 2004 14:35:41 -0000	1.1
--- glitz_stencil.c	9 Aug 2004 22:57:35 -0000	1.2
***************
*** 43,81 ****
      return;
  
-   if ((op == GLITZ_STENCIL_OPERATOR_SET ||
-        op == GLITZ_STENCIL_OPERATOR_UNION) &&
-       (n_rects == 1 &&
-        rects->x <= 0 && rects->y <= 0 &&
-        rects->width >= dst->width &&
-        rects->height >= dst->height)) {
-     *dst->stencil_mask = 0x0;
-     return;
-   }
- 
    if (dst->format->stencil_size < 1)
      return;
  
-   if (op == GLITZ_STENCIL_OPERATOR_INTERSECT && *dst->stencil_mask == 0x0)
-     op = GLITZ_STENCIL_OPERATOR_SET;
- 
-   if (op == GLITZ_STENCIL_OPERATOR_DECR_LESS) {
-     *dst->stencil_mask &= (1 << (dst->format->stencil_size - 1));
-     if (*dst->stencil_mask == 0x0)
-       return;
-   }
- 
    if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
      glitz_surface_pop_current (dst);
      return;
    }
  
-   if (*dst->stencil_mask == 0x0 || op == GLITZ_STENCIL_OPERATOR_SET) {
-     dst->gl->clear_stencil (0x0);    
-     dst->gl->clear (GLITZ_GL_STENCIL_BUFFER_BIT);
-   }
- 
    rect_op = (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SRC;
  
    switch (op) {
    case GLITZ_STENCIL_OPERATOR_INTERSECT:
      glitz_set_stencil_operator (dst->gl, GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
--- 43,65 ----
      return;
  
    if (dst->format->stencil_size < 1)
      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;
    }
  
    rect_op = (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SRC;
  
    switch (op) {
+   case GLITZ_STENCIL_OPERATOR_CLEAR:
+     rect_op = (glitz_operator_t) GLITZ_INT_OPERATOR_STENCIL_RECT_SET;
+     break;
+   case GLITZ_STENCIL_OPERATOR_DECR_LESS:
+     *dst->stencil_mask &= (1 << (dst->format->stencil_size - 1));
+     glitz_set_stencil_operator (dst->gl, op, *dst->stencil_mask);
+     break;
    case GLITZ_STENCIL_OPERATOR_INTERSECT:
      glitz_set_stencil_operator (dst->gl, GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
***************
*** 91,97 ****
      break;
    }
!   
!   dst->gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE,
!                        GLITZ_GL_FALSE, GLITZ_GL_FALSE);
  
    glitz_int_fill_rectangles (rect_op,
--- 75,80 ----
      break;
    }
! 
!   dst->gl->color_mask (0, 0, 0, 0);
  
    glitz_int_fill_rectangles (rect_op,
***************
*** 115,118 ****
--- 98,105 ----
      *dst->stencil_mask |= 0x1;
  
+   dst->gl->color_mask (1, 1, 1, 1);
+   
+   dst->update_mask |= GLITZ_UPDATE_STENCIL_OP_MASK;
+ 
    glitz_surface_pop_current (dst);
  }
***************
*** 132,149 ****
      return;
  
-   if (op == GLITZ_STENCIL_OPERATOR_INTERSECT && *dst->stencil_mask == 0x0)
-     op = GLITZ_STENCIL_OPERATOR_SET;
- 
    if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
      glitz_surface_pop_current (dst);
      return;
    }
  
-   if (*dst->stencil_mask == 0x0 || op == GLITZ_STENCIL_OPERATOR_SET) {
-     dst->gl->clear_stencil (0x0);
-     dst->gl->clear (GLITZ_GL_STENCIL_BUFFER_BIT);
-   }
-   
    switch (op) {
    case GLITZ_STENCIL_OPERATOR_INTERSECT:
      glitz_set_stencil_operator (dst->gl, GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
--- 119,133 ----
      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;
    }
  
    switch (op) {
+   case GLITZ_STENCIL_OPERATOR_DECR_LESS:
+     *dst->stencil_mask &= (1 << (dst->format->stencil_size - 1));
+     glitz_set_stencil_operator (dst->gl, op, *dst->stencil_mask);
+     break;
    case GLITZ_STENCIL_OPERATOR_INTERSECT:
      glitz_set_stencil_operator (dst->gl, GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
***************
*** 159,164 ****
    }
    
!   dst->gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE,
!                        GLITZ_GL_FALSE, GLITZ_GL_FALSE);
  
    glitz_int_fill_trapezoids (GLITZ_OPERATOR_SRC,
--- 143,147 ----
    }
    
!   dst->gl->color_mask (0, 0, 0, 0);
  
    glitz_int_fill_trapezoids (GLITZ_OPERATOR_SRC,
***************
*** 183,186 ****
--- 166,173 ----
      *dst->stencil_mask |= 0x1;
  
+   dst->gl->color_mask (1, 1, 1, 1);
+   
+   dst->update_mask |= GLITZ_UPDATE_STENCIL_OP_MASK;
+ 
    glitz_surface_pop_current (dst);
  }
***************
*** 201,218 ****
      return;
    
-   if (op == GLITZ_STENCIL_OPERATOR_INTERSECT && *dst->stencil_mask == 0x0)
-     op = GLITZ_STENCIL_OPERATOR_SET;
- 
    if (!glitz_surface_push_current (dst, GLITZ_CN_SURFACE_DRAWABLE_CURRENT)) {
      glitz_surface_pop_current (dst);
      return;
    }
    
-   if (*dst->stencil_mask == 0x0 || op == GLITZ_STENCIL_OPERATOR_SET) {
-     dst->gl->clear_stencil (0x0);
-     dst->gl->clear (GLITZ_GL_STENCIL_BUFFER_BIT);
-   }
- 
    switch (op) {
    case GLITZ_STENCIL_OPERATOR_INTERSECT:
      glitz_set_stencil_operator (dst->gl, GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
--- 188,202 ----
      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;
    }
    
    switch (op) {
+   case GLITZ_STENCIL_OPERATOR_DECR_LESS:
+     *dst->stencil_mask &= (1 << (dst->format->stencil_size - 1));
+     glitz_set_stencil_operator (dst->gl, op, *dst->stencil_mask);
+     break;
    case GLITZ_STENCIL_OPERATOR_INTERSECT:
      glitz_set_stencil_operator (dst->gl, GLITZ_STENCIL_OPERATOR_INCR_EQUAL,
***************
*** 227,233 ****
      break;
    }
!   
!   dst->gl->color_mask (GLITZ_GL_FALSE, GLITZ_GL_FALSE,
!                        GLITZ_GL_FALSE, GLITZ_GL_FALSE);
  
    glitz_int_fill_triangles (GLITZ_OPERATOR_SRC,
--- 211,216 ----
      break;
    }
! 
!   dst->gl->color_mask (0, 0, 0, 0);
  
    glitz_int_fill_triangles (GLITZ_OPERATOR_SRC,
***************
*** 253,256 ****
--- 236,243 ----
      *dst->stencil_mask |= 0x1;
  
+   dst->gl->color_mask (1, 1, 1, 1);
+ 
+   dst->update_mask |= GLITZ_UPDATE_STENCIL_OP_MASK;
+ 
    glitz_surface_pop_current (dst);
  }

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** glitz_surface.c	24 Jul 2004 00:09:27 -0000	1.16
--- glitz_surface.c	9 Aug 2004 22:57:35 -0000	1.17
***************
*** 63,78 ****
    surface->height = height;
    surface->gl = gl;
-   surface->draw_buffer = surface->read_buffer = GLITZ_GL_FRONT;
    surface->stencil_mask = surface->stencil_masks;
  
!   if (surface->gl) {
!     if (format->doublebuffer)
!       surface->draw_buffer = surface->read_buffer = GLITZ_GL_BACK;
!                      
!     glitz_texture_init (&surface->texture,
[...1025 lines suppressed...]
!     (GLITZ_HINT_OFFSCREEN_MASK | GLITZ_HINT_PROGRAMMATIC_MASK);
  
    if (*surface->stencil_mask)
      hint_mask |= GLITZ_HINT_CLIPPING_MASK;
    
!   if ((!SURFACE_PROGRAMMATIC (surface)) &&
!       surface->polyedge == GLITZ_POLYEDGE_SMOOTH &&
        surface->format->multisample.samples < 2 &&
        surface->format->stencil_size >= 4)
--- 931,940 ----
    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)

Index: glitz_texture.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_texture.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glitz_texture.c	20 Jul 2004 07:51:14 -0000	1.9
--- glitz_texture.c	9 Aug 2004 22:57:35 -0000	1.10
***************
*** 32,51 ****
  #include "glitzint.h"
  
- static void
- _glitz_texture_find_best_target (unsigned int width,
-                                  unsigned int height,
-                                  long int target_mask,
-                                  unsigned int *target)
- {
-   *target = GLITZ_GL_TEXTURE_2D;
- 
-   if ((!(target_mask & GLITZ_TEXTURE_TARGET_2D_MASK)) ||
-       (!glitz_uint_is_power_of_two (width)) ||
-       (!glitz_uint_is_power_of_two (height))) {
-     if (target_mask & GLITZ_TEXTURE_TARGET_RECTANGLE_MASK)
-       *target = GLITZ_GL_TEXTURE_RECTANGLE;
-   }
- }
- 
  void
  glitz_texture_init (glitz_texture_t *texture,
--- 32,35 ----
***************
*** 55,97 ****
                      unsigned long target_mask)
  {
!   texture->filter = -1;
!   texture->repeat = -1;
    texture->width = width;
    texture->height = height;
    texture->format = texture_format;
-   texture->allocated = 0;
    texture->name = 0;
! 
!   if (!(target_mask & GLITZ_TEXTURE_TARGET_NPOT_MASK)) {
!     _glitz_texture_find_best_target (width, height,
!                                      target_mask, &texture->target);
      
!     if (texture->target == GLITZ_GL_TEXTURE_2D) {
!       glitz_uint_to_power_of_two (&texture->width);
!       glitz_uint_to_power_of_two (&texture->height);
!     }
!   } else
      texture->target = GLITZ_GL_TEXTURE_2D;
-   
-   if (texture->target == GLITZ_GL_TEXTURE_2D &&
-       texture->width == width && texture->height == height) {
      texture->repeatable = 1;
      texture->texcoord_width = texture->texcoord_height = 1.0;
    } else {
!     texture->repeatable = 0;
!     if (texture->target == GLITZ_GL_TEXTURE_2D) {
!       texture->texcoord_width = (double) width / (double) texture->width;
!       texture->texcoord_height = (double) height / (double) texture->height;
      } else {
!       texture->texcoord_width = texture->width;
!       texture->texcoord_height = texture->height;
      }
    }
  }
  
! static void
! _glitz_texture_allocate (glitz_gl_proc_address_list_t *gl,
!                          glitz_texture_t *texture)
  {
    if (!texture->name)
      gl->gen_textures (1, &texture->name);
--- 39,88 ----
                      unsigned long target_mask)
  {
!   texture->filter = 0;
!   texture->wrap = 0;
    texture->width = width;
    texture->height = height;
    texture->format = texture_format;
    texture->name = 0;
!   texture->allocated = 0;
      
!   if (target_mask & GLITZ_TEXTURE_TARGET_NON_POWER_OF_TWO_MASK) {
      texture->target = GLITZ_GL_TEXTURE_2D;
      texture->repeatable = 1;
      texture->texcoord_width = texture->texcoord_height = 1.0;
    } else {
!     
!     if (POWER_OF_TWO (width) && POWER_OF_TWO (height)) {
!       texture->target = GLITZ_GL_TEXTURE_2D;
!       texture->repeatable = 1;
!       texture->texcoord_width = texture->texcoord_height = 1.0;
      } else {
!       texture->repeatable = 0;
!       if (target_mask & GLITZ_TEXTURE_TARGET_RECTANGLE_MASK) {
!         texture->target = GLITZ_GL_TEXTURE_RECTANGLE;
!         texture->texcoord_width = texture->width;
!         texture->texcoord_height = texture->height;
!       } else {
!         texture->target = GLITZ_GL_TEXTURE_2D;
!         
!         if (!POWER_OF_TWO (texture->width))
!           texture->width = glitz_uint_to_power_of_two (texture->width);
!         
!         if (!POWER_OF_TWO (texture->height))
!           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;
!       }
      }
    }
  }
  
! void
! glitz_texture_allocate (glitz_gl_proc_address_list_t *gl,
!                         glitz_texture_t *texture)
  {
+   char *data = NULL;
+   
    if (!texture->name)
      gl->gen_textures (1, &texture->name);
***************
*** 101,107 ****
    glitz_texture_bind (gl, texture);
  
    gl->tex_image_2d (texture->target, 0, texture->format,
                      texture->width, texture->height,
!                     0, GLITZ_GL_RGB, GLITZ_GL_UNSIGNED_BYTE, NULL);
  
    glitz_texture_unbind (gl, texture);
--- 92,107 ----
    glitz_texture_bind (gl, texture);
  
+   /* unused texels must be cleared */
+   if ((!texture->repeatable) && texture->target == GLITZ_GL_TEXTURE_2D) {
+     data = malloc (texture->width * texture->height * 4);
+     memset (data, 0, texture->width * texture->height * 4);
+   }
+       
    gl->tex_image_2d (texture->target, 0, texture->format,
                      texture->width, texture->height,
!                     0, GLITZ_GL_RGBA, GLITZ_GL_UNSIGNED_BYTE, data);
! 
!   if (data)
!     free (data);
  
    glitz_texture_unbind (gl, texture);
***************
*** 119,148 ****
  glitz_texture_ensure_filter (glitz_gl_proc_address_list_t *gl,
                               glitz_texture_t *texture,
!                              glitz_filter_t filter)
  {
!   if (!texture->target)
      return;
- 
-   if (!texture->allocated)
-     _glitz_texture_allocate (gl, texture);
      
    if (texture->filter != filter) {
!     switch (filter) {
!     case GLITZ_FILTER_FAST:
!     case GLITZ_FILTER_NEAREST:
!       gl->tex_parameter_i (texture->target,
!                            GLITZ_GL_TEXTURE_MAG_FILTER, GLITZ_GL_NEAREST);
!       gl->tex_parameter_i (texture->target,
!                            GLITZ_GL_TEXTURE_MIN_FILTER, GLITZ_GL_NEAREST);
!       break;
!     case GLITZ_FILTER_GOOD:
!     case GLITZ_FILTER_BEST:
!     case GLITZ_FILTER_BILINEAR:
!       gl->tex_parameter_i (texture->target,
!                            GLITZ_GL_TEXTURE_MAG_FILTER, GLITZ_GL_LINEAR);
!       gl->tex_parameter_i (texture->target,
!                            GLITZ_GL_TEXTURE_MIN_FILTER, GLITZ_GL_LINEAR);
!       break;
!     }
      texture->filter = filter;
    }
--- 119,130 ----
  glitz_texture_ensure_filter (glitz_gl_proc_address_list_t *gl,
                               glitz_texture_t *texture,
!                              glitz_gl_enum_t filter)
  {
!   if (!texture->name)
      return;
      
    if (texture->filter != filter) {
!     gl->tex_parameter_i (texture->target, GLITZ_GL_TEXTURE_MAG_FILTER, filter);
!     gl->tex_parameter_i (texture->target, GLITZ_GL_TEXTURE_MIN_FILTER, filter);
      texture->filter = filter;
    }
***************
*** 150,176 ****
  
  void
! glitz_texture_ensure_repeat (glitz_gl_proc_address_list_t *gl,
!                              glitz_texture_t *texture,
!                              glitz_bool_t repeat)
  {
!   if (!texture->target)
      return;
- 
-   if (!texture->allocated)
-     _glitz_texture_allocate (gl, texture);
    
!   if (texture->repeat != repeat) {
!     if (repeat) {
!       gl->tex_parameter_i(texture->target,
!                           GLITZ_GL_TEXTURE_WRAP_S, GLITZ_GL_REPEAT);
!       gl->tex_parameter_i (texture->target,
!                            GLITZ_GL_TEXTURE_WRAP_T, GLITZ_GL_REPEAT);
!     } else {
!       gl->tex_parameter_i (texture->target,
!                            GLITZ_GL_TEXTURE_WRAP_S, GLITZ_GL_CLAMP_TO_EDGE);
!       gl->tex_parameter_i (texture->target,
!                            GLITZ_GL_TEXTURE_WRAP_T, GLITZ_GL_CLAMP_TO_EDGE);
!     }
!     texture->repeat = repeat;
    }
  }
--- 132,146 ----
  
  void
! glitz_texture_ensure_wrap (glitz_gl_proc_address_list_t *gl,
!                            glitz_texture_t *texture,
!                            glitz_gl_enum_t wrap)
  {
!   if (!texture->name)
      return;
    
!   if (texture->wrap != wrap) {
!     gl->tex_parameter_i (texture->target, GLITZ_GL_TEXTURE_WRAP_S, wrap);
!     gl->tex_parameter_i (texture->target, GLITZ_GL_TEXTURE_WRAP_T, wrap);
!     texture->wrap = wrap;
    }
  }
***************
*** 183,192 ****
    gl->disable (GLITZ_GL_TEXTURE_2D);
  
!   if (!texture->target)
      return;
  
-   if (!texture->allocated)
-     _glitz_texture_allocate (gl, texture);
-   
    gl->enable (texture->target);
    gl->bind_texture (texture->target, texture->name);
--- 153,159 ----
    gl->disable (GLITZ_GL_TEXTURE_2D);
  
!   if (!texture->name)
      return;
  
    gl->enable (texture->target);
    gl->bind_texture (texture->target, texture->name);
***************
*** 217,223 ****
    glitz_texture_bind (surface->gl, texture);
  
-   if (!texture->allocated)
-     _glitz_texture_allocate (surface->gl, texture);
- 
    if (surface->format->doublebuffer)
      surface->gl->read_buffer (surface->read_buffer);
--- 184,187 ----
***************
*** 238,239 ****
--- 202,225 ----
    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;
+   }
+ }

Index: glitz_trap.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_trap.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_trap.c	11 Jun 2004 14:35:41 -0000	1.6
--- glitz_trap.c	9 Aug 2004 22:57:35 -0000	1.7
***************
*** 149,152 ****
--- 149,154 ----
      
      dst->gl->end_list ();
+     
+     dst->gl->matrix_mode (GLITZ_GL_MODELVIEW);
  
      for (i = 0; i < dst->multi_sample->n_samples; i++) {
***************
*** 177,180 ****
--- 179,183 ----
  
    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;
***************
*** 197,201 ****
                              int n_traps)
  {
-   glitz_surface_t *mask;
    glitz_bounding_box_t trap_bounds;
    int x_dst, y_dst;
--- 200,203 ----
***************
*** 218,222 ****
--- 220,234 ----
      return;
  
+   rect.x = trap_bounds.x1;
+   rect.y = trap_bounds.y1;
+   rect.width = trap_bounds.x2 - trap_bounds.x1;
+   rect.height = trap_bounds.y2 - trap_bounds.y1;
+ 
    glitz_surface_enable_anti_aliasing (dst);
+ 
+   if (*dst->stencil_mask == 0x0)
+     glitz_stencil_rectangles (dst,
+                               GLITZ_STENCIL_OPERATOR_CLEAR,
+                               &rect, 1);
    
    glitz_stencil_trapezoids (dst,
***************
*** 224,243 ****
                              traps, n_traps);
    
!   rect.x = trap_bounds.x1;
!   rect.y = trap_bounds.y1;
!   rect.width = trap_bounds.x2 - trap_bounds.x1;
!   rect.height = trap_bounds.y2 - trap_bounds.y1;
!   
!   if (dst->polyopacity != 0xffff) {
!     glitz_color_t color;
!     
!     color.red = color.green = color.blue = color.alpha = dst->polyopacity;
!     mask = glitz_surface_create_solid (&color);
!   } else
!     mask = NULL;
  
    glitz_composite (op,
                     src,
!                    mask,
                     dst,
                     x_src + trap_bounds.x1 - x_dst,
--- 236,244 ----
                              traps, n_traps);
    
!   dst->hint_mask |= GLITZ_INT_HINT_POLYGON_OP_MASK;
  
    glitz_composite (op,
                     src,
!                    NULL,
                     dst,
                     x_src + trap_bounds.x1 - x_dst,
***************
*** 247,258 ****
                     rect.width, rect.height);
  
!   if (mask)
!     glitz_surface_destroy (mask);
  
    glitz_surface_disable_anti_aliasing (dst);
  
!   glitz_stencil_rectangles (dst,
!                             GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                             &rect, 1);
  }
  slim_hidden_def(glitz_composite_trapezoids);
--- 248,263 ----
                     rect.width, rect.height);
  
!   dst->hint_mask &= ~GLITZ_INT_HINT_POLYGON_OP_MASK;
  
    glitz_surface_disable_anti_aliasing (dst);
+   
+   if (*dst->stencil_mask != 0x1)
+     glitz_stencil_rectangles (dst,
+                               GLITZ_STENCIL_OPERATOR_DECR_LESS,
+                               &rect, 1);
+   else
+     *dst->stencil_mask = 0x0;
  
!   dst->update_mask |= GLITZ_UPDATE_STENCIL_OP_MASK;
  }
  slim_hidden_def(glitz_composite_trapezoids);
***************
*** 313,316 ****
--- 318,322 ----
    
    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;

Index: glitz_tri.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_tri.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_tri.c	11 Jun 2004 14:35:41 -0000	1.6
--- glitz_tri.c	9 Aug 2004 22:57:35 -0000	1.7
***************
*** 109,112 ****
--- 109,114 ----
      dst->gl->end_list ();
  
+     dst->gl->matrix_mode (GLITZ_GL_MODELVIEW);
+ 
      for (i = 0; i < dst->multi_sample->n_samples; i++) {
        dst->gl->translate_d (dst->multi_sample->offsets[i].x,
***************
*** 163,167 ****
                                 int n_points)
  {
-   glitz_surface_t *mask;
    glitz_bounding_box_t tri_bounds;
    int x_dst, y_dst;
--- 165,168 ----
***************
*** 182,186 ****
--- 183,197 ----
      return;
  
+   rect.x = tri_bounds.x1;
+   rect.y = tri_bounds.y1;
+   rect.width = tri_bounds.x2 - tri_bounds.x1;
+   rect.height = tri_bounds.y2 - tri_bounds.y1;
+   
    glitz_surface_enable_anti_aliasing (dst);
+ 
+   if (*dst->stencil_mask == 0x0)
+     glitz_stencil_rectangles (dst,
+                               GLITZ_STENCIL_OPERATOR_CLEAR,
+                               &rect, 1);
    
    glitz_stencil_triangles (dst,
***************
*** 190,209 ****
                             n_points);
      
!   rect.x = tri_bounds.x1;
!   rect.y = tri_bounds.y1;
!   rect.width = tri_bounds.x2 - tri_bounds.x1;
!   rect.height = tri_bounds.y2 - tri_bounds.y1;
!   
!   if (dst->polyopacity != 0xffff) {
!     glitz_color_t color;
!     
!     color.red = color.green = color.blue = color.alpha = dst->polyopacity;
!     mask = glitz_surface_create_solid (&color);
!   } else
!     mask = NULL;
  
    glitz_composite (op,
                     src,
!                    mask,
                     dst,
                     x_src + tri_bounds.x1 - x_dst,
--- 201,209 ----
                             n_points);
      
!   dst->hint_mask |= GLITZ_INT_HINT_POLYGON_OP_MASK;
  
    glitz_composite (op,
                     src,
!                    NULL,
                     dst,
                     x_src + tri_bounds.x1 - x_dst,
***************
*** 213,224 ****
                     rect.width, rect.height);
  
!   if (mask)
!     glitz_surface_destroy (mask);
  
    glitz_surface_disable_anti_aliasing (dst);
      
!   glitz_stencil_rectangles (dst,
!                             GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                             &rect, 1);
  }
  
--- 213,228 ----
                     rect.width, rect.height);
  
!   dst->hint_mask &= ~GLITZ_INT_HINT_POLYGON_OP_MASK;
  
    glitz_surface_disable_anti_aliasing (dst);
      
!   if (*dst->stencil_mask != 0x1)
!     glitz_stencil_rectangles (dst,
!                               GLITZ_STENCIL_OPERATOR_DECR_LESS,
!                               &rect, 1);
!   else
!     *dst->stencil_mask = 0x0;
! 
!   dst->update_mask |= GLITZ_UPDATE_STENCIL_OP_MASK;
  }
  

Index: glitz_util.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_util.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** glitz_util.c	21 Jun 2004 21:26:56 -0000	1.6
--- glitz_util.c	9 Aug 2004 22:57:35 -0000	1.7
***************
*** 63,83 ****
  }
  
- void
- glitz_intersect_bounding_box_double (glitz_bounding_box_double_t *box1,
-                                      glitz_bounding_box_double_t *box2,
-                                      glitz_bounding_box_double_t *return_box)
- {
-   return_box->x1 = (box1->x1 >= box2->x1)? box1->x1: box2->x1;
-   return_box->x2 = (box1->x2 <= box2->x2)? box1->x2: box2->x2;
-   return_box->y1 = (box1->y1 >= box2->y1)? box1->y1: box2->y1;
-   return_box->y2 = (box1->y2 <= box2->y2)? box1->y2: box2->y2;
- 
-   if (return_box->x1 >= return_box->x2)
-     return_box->x1 = return_box->x2 = 0.0;
-   
-   if (return_box->y1 >= return_box->y2)
-     return_box->y1 = return_box->y2 = 0.0;
- }
- 
  static glitz_bool_t
  _glitz_extension_check (const char *extensions,
--- 63,66 ----
***************
*** 118,141 ****
  }
  
! glitz_bool_t
! glitz_uint_is_power_of_two (unsigned int value)
! {
!   unsigned int x = 1;
!   
!   while (x < value)
!     x <<= 1;
! 
!   return (x == value);
! }
! 
! void
! glitz_uint_to_power_of_two (unsigned int *value)
  {
!   unsigned int x = 1;
    
!   while (x < *value)
!     x <<= 1;
! 
!   *value = x;
  }
  
--- 101,114 ----
  }
  
! unsigned int
! glitz_uint_to_power_of_two (unsigned int x)
  {
!   x |= (x >> 1);
!   x |= (x >> 2);
!   x |= (x >> 4);
!   x |= (x >> 8);
!   x |= (x >> 16);
    
!   return (x + 1);
  }
  

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** glitzint.h	20 Jul 2004 07:51:14 -0000	1.20
--- glitzint.h	9 Aug 2004 22:57:35 -0000	1.21
***************
*** 67,79 ****
  #define GLITZ_STATUS_NO_MEMORY_MASK          (1L << 0)
  #define GLITZ_STATUS_NULL_POINTER_MASK       (1L << 1)
! #define GLITZ_STATUS_BAD_DRAWABLE_MASK       (1L << 2)
! #define GLITZ_STATUS_UNRELATED_SURFACES_MASK (1L << 3)
! #define GLITZ_STATUS_BAD_COORDINATE_MASK     (1L << 4)
! #define GLITZ_STATUS_NOT_SUPPORTED_MASK      (1L << 5)
! #define GLITZ_STATUS_INVALID_MATRIX_MASK     (1L << 6)
  
! #define GLITZ_TEXTURE_TARGET_2D_MASK        (1L << 0)
! #define GLITZ_TEXTURE_TARGET_RECTANGLE_MASK (1L << 1)
! #define GLITZ_TEXTURE_TARGET_NPOT_MASK      (1L << 2)
  
  #define GLITZ_FORMAT_ALL_EXCEPT_ID_MASK ((1L << 19) - 2)
--- 67,77 ----
  #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)
! #define GLITZ_TEXTURE_TARGET_RECTANGLE_MASK        (1L << 1)
! #define GLITZ_TEXTURE_TARGET_NON_POWER_OF_TWO_MASK (1L << 2)
  
  #define GLITZ_FORMAT_ALL_EXCEPT_ID_MASK ((1L << 19) - 2)
***************
*** 81,84 ****
--- 79,84 ----
  #include "glitz_gl.h"
  
+ #define GLITZ_CONTEXT_STACK_SIZE 16
+ 
  typedef struct _glitz_gl_proc_address_list_t {
    glitz_gl_enable_t enable;
***************
*** 106,109 ****
--- 106,111 ----
    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;
***************
*** 114,117 ****
--- 116,120 ----
    glitz_gl_copy_pixels_t copy_pixels;
    glitz_gl_flush_t flush;
+   glitz_gl_finish_t finish;
    glitz_gl_pixel_store_i_t pixel_store_i;
    glitz_gl_ortho_t ortho;
***************
*** 160,198 ****
  typedef int glitz_surface_type_t;
  
! #define GLITZ_SURFACE_TYPE_NA   -1
! #define GLITZ_SURFACE_TYPE_NULL  0
! #define GLITZ_SURFACE_TYPE_ARGB  1
! #define GLITZ_SURFACE_TYPE_ARGBC 2
! #define GLITZ_SURFACE_TYPE_ARGBF 3
! #define GLITZ_SURFACE_TYPE_SOLID 4
! #define GLITZ_SURFACE_TYPE_LGRAD 5
! #define GLITZ_SURFACE_TYPE_RGRAD 6
! #define GLITZ_SURFACE_TYPES      7
  
! typedef int glitz_render_type_t;
  
! #define GLITZ_RENDER_TYPE_NA            -1
! #define GLITZ_RENDER_TYPE_INTERMEDIATE   0
! #define GLITZ_RENDER_TYPE_ARGB           1
! #define GLITZ_RENDER_TYPE_ARGB_SOLID     2
! #define GLITZ_RENDER_TYPE_ARGB_ARGB      4
! #define GLITZ_RENDER_TYPE_ARGB_ARGBC     5
! #define GLITZ_RENDER_TYPE_ARGBF          6
! #define GLITZ_RENDER_TYPE_ARGBF_SOLID    7
! #define GLITZ_RENDER_TYPE_ARGBF_ARGB     9
! #define GLITZ_RENDER_TYPE_ARGBF_ARGBC   10
! #define GLITZ_RENDER_TYPE_SOLID         11
! #define GLITZ_RENDER_TYPE_SOLID_SOLID   12
! #define GLITZ_RENDER_TYPE_SOLID_ARGB    14
! #define GLITZ_RENDER_TYPE_SOLID_ARGBC   15
! #define GLITZ_RENDER_TYPE_LGRAD         16
! #define GLITZ_RENDER_TYPE_LGRAD_SOLID   17
! #define GLITZ_RENDER_TYPE_LGRAD_ARGB    19
! #define GLITZ_RENDER_TYPE_LGRAD_ARGBC   20
! #define GLITZ_RENDER_TYPE_RGRAD         21
! #define GLITZ_RENDER_TYPE_RGRAD_SOLID   22
! #define GLITZ_RENDER_TYPE_RGRAD_ARGB    24
! #define GLITZ_RENDER_TYPE_RGRAD_ARGBC   25
! #define GLITZ_RENDER_TYPES              26
  
  #define GLITZ_TEXTURE_NONE 0
--- 163,195 ----
  typedef int glitz_surface_type_t;
  
! #define GLITZ_SURFACE_TYPE_NA    -1
! #define GLITZ_SURFACE_TYPE_NULL   0
! #define GLITZ_SURFACE_TYPE_ARGB   1
! #define GLITZ_SURFACE_TYPE_ARGBC  2
! #define GLITZ_SURFACE_TYPE_ARGBF  3
! #define GLITZ_SURFACE_TYPE_SOLID  4
! #define GLITZ_SURFACE_TYPE_SOLIDC 5
! #define GLITZ_SURFACE_TYPES       6
  
! typedef int glitz_combine_type_t;
  
! #define GLITZ_COMBINE_TYPE_NA            -1
! #define GLITZ_COMBINE_TYPE_INTERMEDIATE   0
! #define GLITZ_COMBINE_TYPE_ARGB           1
! #define GLITZ_COMBINE_TYPE_ARGB_ARGB      2
! #define GLITZ_COMBINE_TYPE_ARGB_ARGBC     3
! #define GLITZ_COMBINE_TYPE_ARGB_SOLID     4
! #define GLITZ_COMBINE_TYPE_ARGB_SOLIDC    5
! #define GLITZ_COMBINE_TYPE_ARGBF          6
! #define GLITZ_COMBINE_TYPE_ARGBF_ARGB     7
! #define GLITZ_COMBINE_TYPE_ARGBF_ARGBC    8
! #define GLITZ_COMBINE_TYPE_ARGBF_SOLID    9
! #define GLITZ_COMBINE_TYPE_ARGBF_SOLIDC  10
! #define GLITZ_COMBINE_TYPE_SOLID         11
! #define GLITZ_COMBINE_TYPE_SOLID_ARGB    12
! #define GLITZ_COMBINE_TYPE_SOLID_ARGBC   13
! #define GLITZ_COMBINE_TYPE_SOLID_SOLID   14
! #define GLITZ_COMBINE_TYPE_SOLID_SOLIDC  15
! #define GLITZ_COMBINE_TYPES              16
  
  #define GLITZ_TEXTURE_NONE 0
***************
*** 201,204 ****
--- 198,206 ----
  #define GLITZ_TEXTURE_LAST 3
  
+ #define GLITZ_FRAGMENT_FILTER_CONVOLUTION     0
+ #define GLITZ_FRAGMENT_FILTER_LINEAR_GRADIENT 1
+ #define GLITZ_FRAGMENT_FILTER_RADIAL_GRADIENT 2
+ #define GLITZ_FRAGMENT_FILTER_TYPES 3
+ 
  typedef struct _glitz_program_info_t {
    glitz_gl_uint_t vertex[GLITZ_TEXTURE_LAST][GLITZ_TEXTURE_LAST];
***************
*** 207,211 ****
  
  typedef struct _glitz_program_map_t {
!   glitz_program_info_t info[GLITZ_RENDER_TYPES];
  } glitz_program_map_t;
  
--- 209,213 ----
  
  typedef struct _glitz_program_map_t {
!   glitz_program_info_t info[GLITZ_COMBINE_TYPES][GLITZ_FRAGMENT_FILTER_TYPES];
  } glitz_program_map_t;
  
***************
*** 227,234 ****
  } glitz_bounding_box_t;
  
- typedef struct _glitz_bounding_box_double_t {
-   double x1, x2, y1, y2;
- } glitz_bounding_box_double_t;
- 
  typedef struct _glitz_point_t {
    double x, y;
--- 229,232 ----
***************
*** 245,250 ****
    glitz_bool_t allocated;
    
!   glitz_filter_t filter;
!   glitz_bool_t repeat;
    
    unsigned int width;
--- 243,248 ----
    glitz_bool_t allocated;
    
!   glitz_gl_enum_t filter;
!   glitz_gl_enum_t wrap;
    
    unsigned int width;
***************
*** 275,279 ****
  
    glitz_texture_t *
!   (*get_texture) (void *surface);
    
    void
--- 273,278 ----
  
    glitz_texture_t *
!   (*get_texture) (void *surface,
!                   glitz_bool_t allocate);
    
    void
***************
*** 287,322 ****
  } glitz_surface_backend_t;
  
! #define GLITZ_INT_HINT_REPEAT_MASK          (1L << 5)
! #define GLITZ_INT_HINT_DIRTY_MASK           (1L << 6)
! #define GLITZ_INT_HINT_CLEAR_EXTERIOR_MASK  (1L << 7)
! #define GLITZ_INT_HINT_COMPONENT_ALPHA_MASK (1L << 8)
  
! #define SURFACE_PROGRAMMATIC(surface) \
!   ((surface)->hint_mask & GLITZ_HINT_PROGRAMMATIC_MASK)
  
  #define SURFACE_SOLID(surface) \
!   (((glitz_programmatic_surface_t *) (surface))->type == \
!    GLITZ_PROGRAMMATIC_SURFACE_TYPE_SOLID)
! 
! #define SURFACE_LINEAR_GRADIENT(surface) \
!   (((glitz_programmatic_surface_t *) (surface))->type == \
!    GLITZ_PROGRAMMATIC_SURFACE_TYPE_LINEAR)
! 
! #define SURFACE_RADIAL_GRADIENT(surface) \
!   (((glitz_programmatic_surface_t *) (surface))->type == \
!    GLITZ_PROGRAMMATIC_SURFACE_TYPE_RADIAL)
  
  #define SURFACE_REPEAT(surface) \
    ((surface)->hint_mask & GLITZ_INT_HINT_REPEAT_MASK)
  
  #define SURFACE_DIRTY(surface) \
    ((surface)->hint_mask & GLITZ_INT_HINT_DIRTY_MASK)
  
- #define SURFACE_CLEAR_EXTERIOR(surface) \
-   ((surface)->hint_mask & GLITZ_INT_HINT_CLEAR_EXTERIOR_MASK)
- 
  #define SURFACE_COMPONENT_ALPHA(surface) \
    ((surface)->hint_mask & GLITZ_INT_HINT_COMPONENT_ALPHA_MASK)
  
  typedef struct _glitz_sample_offset {
    double x;
--- 286,361 ----
  } glitz_surface_backend_t;
  
! #define GLITZ_INT_HINT_SOLID_MASK                  (1L <<  3)
! #define GLITZ_INT_HINT_REPEAT_MASK                 (1L <<  4)
! #define GLITZ_INT_HINT_MIRRORED_MASK               (1L <<  5)
! #define GLITZ_INT_HINT_PAD_MASK                    (1L <<  6)
! #define GLITZ_INT_HINT_DIRTY_MASK                  (1L <<  7)
! #define GLITZ_INT_HINT_COMPONENT_ALPHA_MASK        (1L <<  8)
! #define GLITZ_INT_HINT_QUALITY_CORRECTNESS_MASK    (1L <<  9)
! #define GLITZ_INT_HINT_MULTISAMPLE_MASK            (1L << 10)
! #define GLITZ_INT_HINT_SOLID_DIRTY_MASK            (1L << 11)
! #define GLITZ_INT_HINT_DRAWABLE_DIRTY_MASK         (1L << 12)
! #define GLITZ_INT_HINT_POLYGON_OP_MASK             (1L << 13)
! #define GLITZ_INT_HINT_FRAGMENT_FILTER_MASK        (1L << 14)
! #define GLITZ_INT_HINT_LINEAR_TRANSFORM_MASK       (1L << 15)
! #define GLITZ_INT_HINT_LINEAR_NON_TRANSFORM_MASK   (1L << 16)
! #define GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK (1L << 17)
! #define GLITZ_INT_HINT_RENDER_TEXTURE_MASK         (1L << 18)
! #define GLITZ_INT_HINT_DRAWABLE_MASK               (1L << 19)
  
! #define SURFACE_OFFSCREEN(surface) \
!   ((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)
  
+ #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_QUALITY_CORRECTNESS(surface) \
+   ((surface)->hint_mask & GLITZ_INT_HINT_QUALITY_CORRECTNESS_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(surface) \
+   ((surface)->hint_mask & GLITZ_INT_HINT_LINEAR_TRANSFORM_MASK)
+ 
+ #define SURFACE_LINEAR_NON_TRANSFORM(surface) \
+   ((surface)->hint_mask & GLITZ_INT_HINT_LINEAR_NON_TRANSFORM_MASK)
+ 
+ #define SURFACE_WINDOW_SPACE_TEXCOORDS(surface) \
+   ((surface)->hint_mask & GLITZ_INT_HINT_WINDOW_SPACE_TEXCOORDS_MASK)
+ 
+ #define SURFACE_RENDER_TEXTURE(surface) \
+   ((surface)->hint_mask & GLITZ_INT_HINT_RENDER_TEXTURE_MASK)
+ 
+ #define SURFACE_DRAWABLE(surface) \
+   ((surface)->hint_mask & GLITZ_INT_HINT_DRAWABLE_MASK)
+ 
  typedef struct _glitz_sample_offset {
    double x;
***************
*** 333,336 ****
--- 372,391 ----
  #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_matrix_t affine;
+   glitz_bool_t inverted;
+ } 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;
***************
*** 343,356 ****
    unsigned long status_mask;
    unsigned long feature_mask;
    glitz_filter_t filter;
    glitz_polyedge_t polyedge;
    glitz_polyedge_smooth_hint_t polyedge_smooth_hint;
!   glitz_matrix_t *transform;
!   glitz_matrix_t *inverse_transform;
    int width, height;
    glitz_bounding_box_t dirty_box;
    glitz_gl_proc_address_list_t *gl;
    glitz_program_map_t *program_map;
-   glitz_matrix_t *convolution;
    unsigned int stencil_masks[GLITZ_N_STENCIL_MASKS];
    unsigned int *stencil_mask;
--- 398,411 ----
    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;
***************
*** 360,406 ****
    glitz_gl_enum_t read_buffer;
    glitz_multi_sample_info_t *multi_sample;
  };
  
! typedef enum {
!   GLITZ_PROGRAMMATIC_SURFACE_TYPE_SOLID = 0,
!   GLITZ_PROGRAMMATIC_SURFACE_TYPE_LINEAR,
!   GLITZ_PROGRAMMATIC_SURFACE_TYPE_RADIAL
! } glitz_programmatic_surface_type_t;
! 
! typedef struct _glitz_programmatic_surface_t {
!   glitz_surface_t base;
!   
!   glitz_matrix_t matrix;
!   
!   glitz_programmatic_surface_type_t type;
!   union {
!     struct {
!       glitz_color_t color;
!     } solid;
!     struct {
!       glitz_point_fixed_t start;
!       glitz_point_fixed_t stop;
!       glitz_color_range_t *color_range;
!     } linear;
!     struct {
!       glitz_point_fixed_t center;
!       glitz_fixed16_16_t radius0;
!       glitz_fixed16_16_t radius1;
!       glitz_color_range_t *color_range;
!     } radial;
!   } u;
! } glitz_programmatic_surface_t;
! 
! 
! typedef struct _glitz_render_op_t glitz_render_op_t;
  
! typedef void (*glitz_render_function_t) (glitz_render_op_t *);
  
  typedef struct _glitz_render_t {
!   glitz_render_type_t type;
!   glitz_render_function_t enable;
!   glitz_render_function_t disable;
    int texture_units;
! } glitz_render_t;
  
  typedef enum {
--- 415,431 ----
    glitz_gl_enum_t read_buffer;
    glitz_multi_sample_info_t *multi_sample;
+   glitz_color_t solid;
  };
  
! typedef struct _glitz_composite_op_t glitz_composite_op_t;
  
! typedef void (*glitz_combine_function_t) (glitz_composite_op_t *);
  
  typedef struct _glitz_render_t {
!   glitz_combine_type_t type;
!   glitz_combine_function_t enable;
    int texture_units;
!   int fragment_processing;
! } glitz_combine_t;
  
  typedef enum {
***************
*** 410,425 ****
  } glitz_component_alpha_type_t;
  
! struct _glitz_render_op_t {
!   glitz_render_type_t type;
!   glitz_render_t *render;
    glitz_gl_proc_address_list_t *gl;
    glitz_surface_t *src;
    glitz_surface_t *mask;
    glitz_surface_t *dst;
-   glitz_texture_t *src_texture;
-   glitz_texture_t *mask_texture;
    glitz_color_t *solid;
    glitz_color_t alpha_mask;
    glitz_component_alpha_type_t component_alpha;
    int count;
  };
--- 435,451 ----
  } glitz_component_alpha_type_t;
  
! struct _glitz_composite_op_t {
!   glitz_combine_type_t type;
!   glitz_combine_t *combine;
    glitz_gl_proc_address_list_t *gl;
    glitz_surface_t *src;
    glitz_surface_t *mask;
    glitz_surface_t *dst;
    glitz_color_t *solid;
    glitz_color_t alpha_mask;
    glitz_component_alpha_type_t component_alpha;
+   glitz_bool_t hw_wrap;
+   glitz_gl_uint_t fp;
+   glitz_gl_uint_t vp;
    int count;
  };
***************
*** 434,446 ****
                                double *x, double *y);
  
- extern void __internal_linkage
- glitz_matrix_transform_bounding_box (glitz_matrix_t *matrix,
-                                      double *x1, double *y1,
-                                      double *x2, double *y2);
-      
- extern void __internal_linkage
- glitz_matrix_transform_bounding_box_double (glitz_matrix_t *matrix,
-                                             glitz_bounding_box_double_t *box);
- 
  extern glitz_status_t __internal_linkage
  glitz_matrix_invert (glitz_matrix_t *matrix);
--- 460,463 ----
***************
*** 461,464 ****
--- 478,482 ----
    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,
***************
*** 482,504 ****
                            glitz_bounding_box_t *return_box);
  
- extern void __internal_linkage
- glitz_intersect_bounding_box_double (glitz_bounding_box_double_t *box1,
-                                      glitz_bounding_box_double_t *box2,
-                                      glitz_bounding_box_double_t *return_box);
- 
- extern void __internal_linkage
- glitz_union_box_double (glitz_bounding_box_double_t *box1,
-                         glitz_bounding_box_double_t *box2,
-                         glitz_bounding_box_double_t *return_box);
- 
  long int
  glitz_extensions_query (const char *extensions_string,
                          glitz_extension_map *extensions_map);
  
! extern glitz_bool_t __internal_linkage
! glitz_uint_is_power_of_two (unsigned int value);
! 
! extern void __internal_linkage
! glitz_uint_to_power_of_two (unsigned int *value);
  
  extern void __internal_linkage
--- 500,509 ----
                            glitz_bounding_box_t *return_box);
  
  long int
  glitz_extensions_query (const char *extensions_string,
                          glitz_extension_map *extensions_map);
  
! extern unsigned int __internal_linkage
! glitz_uint_to_power_of_two (unsigned int x);
  
  extern void __internal_linkage
***************
*** 518,521 ****
--- 523,530 ----
                      glitz_texture_t *texture);
  
+ void
+ glitz_texture_allocate (glitz_gl_proc_address_list_t *gl,
+                         glitz_texture_t *texture);
+ 
  extern void __internal_linkage
  glitz_texture_ensure_filter (glitz_gl_proc_address_list_t *gl,
***************
*** 524,530 ****
  
  extern void __internal_linkage
! glitz_texture_ensure_repeat (glitz_gl_proc_address_list_t *gl,
!                              glitz_texture_t *texture,
!                              glitz_bool_t repeat);
  
  void
--- 533,539 ----
  
  extern void __internal_linkage
! glitz_texture_ensure_wrap (glitz_gl_proc_address_list_t *gl,
!                            glitz_texture_t *texture,
!                            glitz_gl_enum_t wrap);
  
  void
***************
*** 547,550 ****
--- 556,566 ----
  
  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,
***************
*** 561,569 ****
  glitz_surface_fini (glitz_surface_t *surface);
  
- glitz_gl_int_t
- glitz_surface_texture_format (glitz_surface_t *surface);
- 
  extern glitz_texture_t *__internal_linkage
! glitz_surface_get_texture (glitz_surface_t *surface);
  
  extern void __internal_linkage
--- 577,583 ----
  glitz_surface_fini (glitz_surface_t *surface);
  
  extern glitz_texture_t *__internal_linkage
! glitz_surface_get_texture (glitz_surface_t *surface,
!                            glitz_bool_t allocate);
  
  extern void __internal_linkage
***************
*** 573,584 ****
  glitz_surface_destory (glitz_surface_t *surface);
  
  glitz_bool_t
  glitz_surface_push_current (glitz_surface_t *surface,
                              glitz_constraint_t constraint);
  
- extern glitz_bool_t __internal_linkage
- glitz_surface_try_push_current (glitz_surface_t *surface,
-                                 glitz_constraint_t constraint);
- 
  void
  glitz_surface_pop_current (glitz_surface_t *surface);
--- 587,597 ----
  glitz_surface_destory (glitz_surface_t *surface);
  
+ extern void __internal_linkage
+ glitz_surface_ensure_solid (glitz_surface_t *surface);
+ 
  glitz_bool_t
  glitz_surface_push_current (glitz_surface_t *surface,
                              glitz_constraint_t constraint);
  
  void
  glitz_surface_pop_current (glitz_surface_t *surface);
***************
*** 595,599 ****
  
  void
! glitz_surface_setup_environment (glitz_surface_t *surface);
  
  extern void __internal_linkage
--- 608,612 ----
  
  void
! glitz_surface_update_state (glitz_surface_t *surface);
  
  extern void __internal_linkage
***************
*** 603,621 ****
  glitz_surface_disable_anti_aliasing (glitz_surface_t *surface);
  
  extern glitz_status_t __internal_linkage
  glitz_status_pop_from_mask (unsigned long *mask);
  
- typedef enum {
-   GLITZ_INTERMEDIATE_ALPHA,
-   GLITZ_INTERMEDIATE_RGBA,
-   GLITZ_INTERMEDIATE_RGBA_STENCIL
- } glitz_intermediate_t;
- 
- extern glitz_surface_t *__internal_linkage
- glitz_surface_create_intermediate (glitz_surface_t *templ,
-                                    glitz_intermediate_t type,
-                                    int width,
-                                    int height);
- 
  typedef void (*glitz_format_call_back_t) (glitz_format_t *, void *ptr);
  
--- 616,628 ----
  glitz_surface_disable_anti_aliasing (glitz_surface_t *surface);
  
+ extern glitz_matrix_t *__internal_linkage
+ glitz_surface_get_affine_transform (glitz_surface_t *surface);
+ 
+ extern unsigned long __internal_linkage
+ glitz_status_to_status_mask (glitz_status_t status);
+      
  extern glitz_status_t __internal_linkage
  glitz_status_pop_from_mask (unsigned long *mask);
  
  typedef void (*glitz_format_call_back_t) (glitz_format_t *, void *ptr);
  
***************
*** 635,645 ****
  glitz_format_find_standard (glitz_format_t *formats,
                              int n_formats,
-                             unsigned long options,
                              glitz_format_name_t format_name);
  
  extern glitz_gl_int_t __internal_linkage
  glitz_format_get_best_texture_format (glitz_format_t *formats,
! 				      int n_formats,
! 				      glitz_format_t *format);
  
  void
--- 642,651 ----
  glitz_format_find_standard (glitz_format_t *formats,
                              int n_formats,
                              glitz_format_name_t format_name);
  
  extern glitz_gl_int_t __internal_linkage
  glitz_format_get_best_texture_format (glitz_format_t *formats,
!                                       int n_formats,
!                                       glitz_format_t *format);
  
  void
***************
*** 651,684 ****
  
  extern glitz_gl_uint_t __internal_linkage
! glitz_get_vertex_program (glitz_render_op_t *op);
  
  extern glitz_gl_uint_t __internal_linkage
! glitz_get_fragment_program (glitz_render_op_t *op);
! 
! extern glitz_surface_t *__internal_linkage
! glitz_programmatic_surface_create_solid (glitz_color_t *color);
! 
! extern glitz_surface_t *__internal_linkage
! glitz_programmatic_surface_create_linear (glitz_point_fixed_t *start,
!                                           glitz_point_fixed_t *stop,
!                                           glitz_color_range_t *color_range);
! 
! extern glitz_surface_t *__internal_linkage
! glitz_programmatic_surface_create_radial (glitz_point_fixed_t *start,
!                                           glitz_fixed16_16_t radius0,
!                                           glitz_fixed16_16_t radius1,
!                                           glitz_color_range_t *color_range);
! 
! extern void __internal_linkage
! glitz_programmatic_surface_set_transform (glitz_surface_t *surface,
!                                           glitz_transform_t *transform);
! 
! extern void __internal_linkage
! glitz_color_range_bind (glitz_gl_proc_address_list_t *gl,
!                         glitz_color_range_t *color_range,
!                         unsigned long feature_mask);
! 
! extern void __internal_linkage
! glitz_color_range_reference (glitz_color_range_t *color_range);
  
  extern void __internal_linkage
--- 657,666 ----
  
  extern glitz_gl_uint_t __internal_linkage
! glitz_get_vertex_program (glitz_composite_op_t *op,
!                           glitz_filter_t filter);
  
  extern glitz_gl_uint_t __internal_linkage
! glitz_get_fragment_program (glitz_composite_op_t *op,
!                             glitz_filter_t filter);
  
  extern void __internal_linkage
***************
*** 709,718 ****
  
  extern void __internal_linkage
- glitz_program_enable_convolution (glitz_render_op_t *op);
- 
- extern void __internal_linkage
- glitz_program_enable_programmatic (glitz_render_op_t *op);
- 
- extern void __internal_linkage
  glitz_stencil_rectangles (glitz_surface_t *dst,
                            glitz_stencil_operator_t op,
--- 691,694 ----
***************
*** 734,770 ****
  
  extern void __internal_linkage
! glitz_render_op_init (glitz_render_op_t *op,
!                       glitz_surface_t **src,
!                       glitz_surface_t **mask,
!                       glitz_surface_t *dst,
!                       int *x_src,
!                       int *y_src,
!                       int *x_mask,
!                       int *y_mask);
! 
! extern void __internal_linkage
! glitz_render_op_set_textures (glitz_render_op_t *op,
!                               glitz_texture_t *src,
!                               glitz_texture_t *mask);
  
  extern void __internal_linkage
! glitz_render_op_set_alpha_mask (glitz_render_op_t *op,
!                                 unsigned short red,
!                                 unsigned short green,
!                                 unsigned short blue,
!                                 unsigned short alpha);
  
  extern void __internal_linkage
! glitz_render_op_get_alpha_mask (glitz_render_op_t *op,
!                                 unsigned short *red,
!                                 unsigned short *green,
!                                 unsigned short *blue,
!                                 unsigned short *alpha);
  
  extern void __internal_linkage
! glitz_render_enable (glitz_render_op_t *op);
  
  extern void __internal_linkage
! glitz_render_disable (glitz_render_op_t *op);
  
  extern char *__internal_linkage
--- 710,737 ----
  
  extern void __internal_linkage
! glitz_composite_op_init (glitz_composite_op_t *op,
!                          glitz_surface_t *src,
!                          glitz_surface_t *mask,
!                          glitz_surface_t *dst);
  
  extern void __internal_linkage
! glitz_composite_op_set_alpha_mask (glitz_composite_op_t *op,
!                                    unsigned short red,
!                                    unsigned short green,
!                                    unsigned short blue,
!                                    unsigned short alpha);
  
  extern void __internal_linkage
! glitz_composite_op_get_alpha_mask (glitz_composite_op_t *op,
!                                    unsigned short *red,
!                                    unsigned short *green,
!                                    unsigned short *blue,
!                                    unsigned short *alpha);
  
  extern void __internal_linkage
! glitz_composite_enable (glitz_composite_op_t *op);
  
  extern void __internal_linkage
! glitz_composite_disable (glitz_composite_op_t *op);
  
  extern char *__internal_linkage
***************
*** 775,778 ****
--- 742,754 ----
  glitz_pixel_buffer_unbind (glitz_pixel_buffer_t *buffer);
  
+ extern glitz_status_t __internal_linkage
+ glitz_filter_set_params (glitz_filter_params_t **filter_params,
+                          glitz_filter_t filter,
+                          glitz_fixed16_16_t *params,
+                          int n_params);
+ 
+ extern void __internal_linkage
+ glitz_filter_enable (glitz_surface_t *surface,
+                      glitz_composite_op_t *op);
  
  #define MAXSHORT SHRT_MAX
***************
*** 845,848 ****
--- 821,826 ----
    ((unsigned short) (((unsigned int) s1 * s2) / 0xffff))))
  
+ #define POWER_OF_TWO(v) ((v & (v - 1)) == 0)
+ 
  typedef void (*glitz_function_pointer_t) (void);
  
***************
*** 851,861 ****
  
  slim_hidden_proto(glitz_surface_find_similar_standard_format)
- slim_hidden_proto(glitz_surface_create_solid)
- slim_hidden_proto(glitz_surface_create_linear)
- slim_hidden_proto(glitz_surface_create_radial)
  slim_hidden_proto(glitz_surface_set_transform)
! slim_hidden_proto(glitz_surface_set_convolution)
! slim_hidden_proto(glitz_surface_set_repeat)
  slim_hidden_proto(glitz_surface_set_component_alpha)
  slim_hidden_proto(glitz_surface_set_filter)
  slim_hidden_proto(glitz_surface_set_polyedge)
--- 829,836 ----
  
  slim_hidden_proto(glitz_surface_find_similar_standard_format)
  slim_hidden_proto(glitz_surface_set_transform)
! slim_hidden_proto(glitz_surface_set_fill)
  slim_hidden_proto(glitz_surface_set_component_alpha)
+ slim_hidden_proto(glitz_surface_set_correctness_hint)
  slim_hidden_proto(glitz_surface_set_filter)
  slim_hidden_proto(glitz_surface_set_polyedge)
***************
*** 868,871 ****
--- 843,847 ----
  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)
***************
*** 888,896 ****
  slim_hidden_proto(glitz_composite_tri_fan)
  slim_hidden_proto(glitz_color_triangles)
- slim_hidden_proto(glitz_color_range_create)
- slim_hidden_proto(glitz_color_range_get_data)
- slim_hidden_proto(glitz_color_range_put_back_data)
- slim_hidden_proto(glitz_color_range_set_filter)
- slim_hidden_proto(glitz_color_range_set_extend)
  
  #endif /* GLITZINT_H_INCLUDED */
--- 864,867 ----




More information about the cairo-commit mailing list