[cairo-commit] libglc/src glc.c, 1.25, 1.26 glc.h, 1.18, 1.19 glc_agl_context.c, 1.5, 1.6 glc_agl_format.c, 1.7, 1.8 glc_agl_info.c, 1.9, 1.10 glc_agl_surface.c, 1.8, 1.9 glc_color_range.c, 1.1, 1.2 glc_format.c, 1.4, 1.5 glc_glx_context.c, 1.13, 1.14 glc_glx_format.c, 1.19, 1.20 glc_glx_info.c, 1.14, 1.15 glc_glx_surface.c, 1.20, 1.21 glc_glxext.h, 1.1, 1.2 glc_operator.c, 1.3, 1.4 glc_program.c, 1.9, 1.10 glc_programmatic.c, 1.5, 1.6 glc_rect.c, 1.9, 1.10 glc_surface.c, 1.24, 1.25 glc_texture.c, 1.13, 1.14 glc_trap.c, 1.15, 1.16 glc_tri.c, 1.13, 1.14 glc_util.c, 1.10, 1.11 glcint.h, 1.27, 1.28

David Reveman commit at pdx.freedesktop.org
Fri Mar 26 16:02:10 PST 2004


Committed by: davidr

Update of /cvs/cairo/libglc/src
In directory pdx:/tmp/cvs-serv11714/src

Modified Files:
	glc.c glc.h glc_agl_context.c glc_agl_format.c glc_agl_info.c 
	glc_agl_surface.c glc_color_range.c glc_format.c 
	glc_glx_context.c glc_glx_format.c glc_glx_info.c 
	glc_glx_surface.c glc_glxext.h glc_operator.c glc_program.c 
	glc_programmatic.c glc_rect.c glc_surface.c glc_texture.c 
	glc_trap.c glc_tri.c glc_util.c glcint.h 
Log Message:
Added clipping and new polygon drawing code

Index: glc.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc.c,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** a/glc.c	21 Mar 2004 13:41:02 -0000	1.25
--- b/glc.c	27 Mar 2004 00:02:07 -0000	1.26
***************
*** 34,53 ****
  #include <math.h>
  
! #define TRANSFORM(surface) \
!   (surface->transform)
! 
! #define REPEAT(surface) \
!   (surface->repeat)
! 
! #define PROG_OR_REPEAT(surface) \
!   (surface->repeat || surface->programmatic)
  
! #define GLREPEAT(surface, texture) \
!   (surface->repeat && texture->repeatable)
  
! #define MANUALREPEAT(surface, texture) \
!   (surface->repeat && (!texture->repeatable))
  
! #define ROTATE(surface) \
    (surface->transform && \
     ((surface->transform->m[0][1] != 0.0) || \
--- 34,47 ----
  #include <math.h>
  
! #define SURFACE_INFINITE_DATA(surface) \
!   (SURFACE_REPEAT (surface) || SURFACE_PROGRAMMATIC (surface))
  
! #define SURFACE_GLREPEAT(surface, texture) \
!   (SURFACE_REPEAT (surface) && texture->repeatable)
  
! #define SURFACE_MANUALREPEAT(surface, texture) \
!   ((surface->hint_mask & GLC_INT_HINT_REPEAT_MASK) && (!texture->repeatable))
  
! #define SURFACE_ROTATE(surface) \
    (surface->transform && \
     ((surface->transform->m[0][1] != 0.0) || \
***************
*** 59,64 ****
     surface must be repeating. Function will fall back to regular composite
     function if this isn't the case.
- 
-    TODO: Add manual repeat support.
  */
  static glc_bool_t
--- 53,56 ----
***************
*** 93,102 ****
       if both surfaces have transformations or the surface not being
       transformed isn't repeating. */
!   if (TRANSFORM (src) || TRANSFORM (mask)) {
!     if (ROTATE (src) || ROTATE (mask))
        return 0;
      
!     if ((TRANSFORM (src) && (TRANSFORM (mask) || (!PROG_OR_REPEAT (mask)))) ||
!         (TRANSFORM (mask) && (TRANSFORM (src) || (!PROG_OR_REPEAT (src)))))
        return 0;
    }
--- 85,96 ----
       if both surfaces have transformations or the surface not being
       transformed isn't repeating. */
!   if (src->transform || mask->transform) {
!     if (SURFACE_ROTATE (src) || SURFACE_ROTATE (mask))
        return 0;
      
!     if ((src->transform &&
!          (mask->transform || (!SURFACE_INFINITE_DATA (mask)))) ||
!         (mask->transform &&
!          (src->transform || (!SURFACE_INFINITE_DATA (src)))))
        return 0;
    }
***************
*** 105,109 ****
    mask_texture = glc_surface_get_texture (mask);
  
!   if (MANUALREPEAT (src, src_texture) || MANUALREPEAT (mask, mask_texture))
      return 0;
  
--- 99,104 ----
    mask_texture = glc_surface_get_texture (mask);
  
!   if (SURFACE_MANUALREPEAT (src, src_texture) ||
!       SURFACE_MANUALREPEAT (mask, mask_texture))
      return 0;
  
***************
*** 124,133 ****
    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  
!   if (TRANSFORM (src))
      glc_texture_ensure_filter (src_texture, src->filter);
    else
      glc_texture_ensure_filter (src_texture, GLC_FILTER_NEAREST);
      
!   glc_texture_ensure_repeat (src_texture, src->repeat);
  
    dst->proc_address->gl_active_texture_arb (GL_TEXTURE1_ARB);
--- 119,129 ----
    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
  
!   if (src->transform)
      glc_texture_ensure_filter (src_texture, src->filter);
    else
      glc_texture_ensure_filter (src_texture, GLC_FILTER_NEAREST);
      
!   glc_texture_ensure_repeat (src_texture,
!                              src->hint_mask & GLC_INT_HINT_REPEAT_MASK);
  
    dst->proc_address->gl_active_texture_arb (GL_TEXTURE1_ARB);
***************
*** 136,140 ****
    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    
!   if (TRANSFORM (mask))
      glc_texture_ensure_filter (mask_texture, mask->filter);
    else
--- 132,136 ----
    glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
    
!   if (mask->transform)
      glc_texture_ensure_filter (mask_texture, mask->filter);
    else
***************
*** 147,151 ****
    src_region.y2 = src->height;
    
!   if (TRANSFORM (src))
      glc_matrix_transform_sub_pixel_region (src->transform, &src_region);
  
--- 143,147 ----
    src_region.y2 = src->height;
    
!   if (src->transform)
      glc_matrix_transform_sub_pixel_region (src->transform, &src_region);
  
***************
*** 167,171 ****
    mask_region.y2 = mask->height;
  
!   if (TRANSFORM (mask))
      glc_matrix_transform_sub_pixel_region (mask->transform, &mask_region);
  
--- 163,167 ----
    mask_region.y2 = mask->height;
  
!   if (mask->transform)
      glc_matrix_transform_sub_pixel_region (mask->transform, &mask_region);
  
***************
*** 187,199 ****
    dst_region.y2 = dst_region.y1 + height;
    
!   if (!REPEAT (src))
      glc_intersect_sub_pixel_region (&dst_region, &src_region, &dst_region);
  
!   if (!REPEAT (mask))
      glc_intersect_sub_pixel_region (&dst_region, &mask_region, &dst_region);
    
  
    /* re-calculate source area */
!   if (REPEAT (src)) {
      src_region.y2 = src->height -
        (((y_src % src->height) + (int) (dst_region.y2 - dst_region.y1)) %
--- 183,195 ----
    dst_region.y2 = dst_region.y1 + height;
    
!   if (!SURFACE_REPEAT (src))
      glc_intersect_sub_pixel_region (&dst_region, &src_region, &dst_region);
  
!   if (!SURFACE_REPEAT (mask))
      glc_intersect_sub_pixel_region (&dst_region, &mask_region, &dst_region);
    
  
    /* re-calculate source area */
!   if (SURFACE_REPEAT (src)) {
      src_region.y2 = src->height -
        (((y_src % src->height) + (int) (dst_region.y2 - dst_region.y1)) %
***************
*** 212,216 ****
  
    /* re-calculate mask area */
!   if (REPEAT (mask)) {
      mask_region.y2 = mask->height -
        (((y_mask % mask->height) + (int) (dst_region.y2 - dst_region.y1)) %
--- 208,212 ----
  
    /* re-calculate mask area */
!   if (SURFACE_REPEAT (mask)) {
      mask_region.y2 = mask->height -
        (((y_mask % mask->height) + (int) (dst_region.y2 - dst_region.y1)) %
***************
*** 243,252 ****
    mask_br.y = (mask_region.y2 / mask_height) * mask_texture->texcoord_height;
  
!   if (!REPEAT(src)) {
      src_tl.y = src_texture->texcoord_height - src_tl.y;
      src_br.y = src_texture->texcoord_height - src_br.y;
    }
      
!   if (!REPEAT(mask)) {
      mask_tl.y = mask_texture->texcoord_height - mask_tl.y;
      mask_br.y = mask_texture->texcoord_height - mask_br.y;
--- 239,248 ----
    mask_br.y = (mask_region.y2 / mask_height) * mask_texture->texcoord_height;
  
!   if (!SURFACE_REPEAT(src)) {
      src_tl.y = src_texture->texcoord_height - src_tl.y;
      src_br.y = src_texture->texcoord_height - src_br.y;
    }
      
!   if (!SURFACE_REPEAT(mask)) {
      mask_tl.y = mask_texture->texcoord_height - mask_tl.y;
      mask_br.y = mask_texture->texcoord_height - mask_br.y;
***************
*** 335,339 ****
      mbounds->y2 = bounds->y2;
  
!   if (!REPEAT (src)) {
      region.x1 = x_dst;
      region.y1 = y_dst;
--- 331,335 ----
      mbounds->y2 = bounds->y2;
  
!   if (!SURFACE_REPEAT (src)) {
      region.x1 = x_dst;
      region.y1 = y_dst;
***************
*** 345,349 ****
      if (y_src > 0) region.y2 -= y_src;
  
!     if (TRANSFORM (src))
        glc_matrix_transform_region (src->transform, &region);
      
--- 341,345 ----
      if (y_src > 0) region.y2 -= y_src;
  
!     if (src->transform)
        glc_matrix_transform_region (src->transform, &region);
      
***************
*** 361,365 ****
    }
  
!   if (!REPEAT (mask)) {
      region.x1 = x_dst;
      region.y1 = y_dst;
--- 357,361 ----
    }
  
!   if (!SURFACE_REPEAT (mask)) {
      region.x1 = x_dst;
      region.y1 = y_dst;
***************
*** 371,375 ****
      if (y_mask > 0) region.y2 -= y_mask;
      
!     if (TRANSFORM (mask))
        glc_matrix_transform_region (mask->transform, &region);
      
--- 367,371 ----
      if (y_mask > 0) region.y2 -= y_mask;
      
!     if (mask->transform)
        glc_matrix_transform_region (mask->transform, &region);
      
***************
*** 408,417 ****
    glc_program_type_t type = 0;
  
!   if (src->programmatic)
      glc_programmatic_surface_setup (src,
                                      width + abs (x_src),
                                      height + abs (y_src));
  
!   if (mask && mask->programmatic)
      glc_programmatic_surface_setup (mask,
                                      width + abs (x_mask),
--- 404,413 ----
    glc_program_type_t type = 0;
  
!   if (SURFACE_PROGRAMMATIC (src))
      glc_programmatic_surface_setup (src,
                                      width + abs (x_src),
                                      height + abs (y_src));
  
!   if (mask && SURFACE_PROGRAMMATIC (mask))
      glc_programmatic_surface_setup (mask,
                                      width + abs (x_mask),
***************
*** 436,440 ****
      intermediate_translate = 0;
      
!     if (!mask->implicit_mask) {
        glc_region_box_t bounds;
        
--- 432,436 ----
      intermediate_translate = 0;
      
!     if (!SURFACE_IMPLICIT_MASK (mask)) {
        glc_region_box_t bounds;
        
***************
*** 456,463 ****
        
        mask_surface = intermediate =
!         glc_surface_create_similar (dst,
!                                     GLC_STANDARD_ARGB32,
!                                     mask_bounds.x2 - mask_bounds.x1,
!                                     mask_bounds.y2 - mask_bounds.y1);
        
        if (!mask_surface) {
--- 452,460 ----
        
        mask_surface = intermediate =
!         glc_int_surface_create_similar (dst,
!                                         GLC_STANDARD_ARGB32,
!                                         1,
!                                         mask_bounds.x2 - mask_bounds.x1,
!                                         mask_bounds.y2 - mask_bounds.y1);
        
        if (!mask_surface) {
***************
*** 466,470 ****
        }
  
!       if (TRANSFORM (mask))
          glc_fill_rectangle (GLC_OPERATOR_SRC,
                              mask_surface,
--- 463,467 ----
        }
  
!       if (mask->transform)
          glc_fill_rectangle (GLC_OPERATOR_SRC,
                              mask_surface,
***************
*** 474,478 ****
                              mask_surface->height);
  
!       if ((!REPEAT (mask)) && intermediate_translate) {
          glc_surface_push_transform (mask);
          glc_matrix_translate (mask->transform,
--- 471,475 ----
                              mask_surface->height);
  
!       if ((!SURFACE_REPEAT (mask)) && intermediate_translate) {
          glc_surface_push_transform (mask);
          glc_matrix_translate (mask->transform,
***************
*** 495,499 ****
        mask_surface = mask;
  
!     if ((!REPEAT (src)) && intermediate_translate) {
        glc_surface_push_transform (src);
        glc_matrix_translate (src->transform,
--- 492,496 ----
        mask_surface = mask;
  
!     if ((!SURFACE_REPEAT (src)) && intermediate_translate) {
        glc_surface_push_transform (src);
        glc_matrix_translate (src->transform,
***************
*** 502,507 ****
      }
  
!     if (TRANSFORM (src))
!       mask_surface->clear_exterior = 1;
      
      glc_composite (GLC_OPERATOR_IN,
--- 499,504 ----
      }
  
!     if (src->transform)
!       mask_surface->hint_mask |= GLC_INT_HINT_CLEAR_EXTERIOR_MASK;
      
      glc_composite (GLC_OPERATOR_IN,
***************
*** 545,554 ****
    glc_set_operator (op);
  
!   if (src->convolution || src->programmatic) {
      type = glc_program_type (dst, src, NULL);
      glc_surface_enable_program (type, dst, src, NULL, texture, NULL);
    }
    
!   if ((!TRANSFORM (src)) && GLREPEAT (src, texture)) {
      /* CASE 1: Repeat, no transformation and power of two sized texture,
         GL can do repeat for us. */
--- 542,551 ----
    glc_set_operator (op);
  
!   if (src->convolution || SURFACE_PROGRAMMATIC (src)) {
      type = glc_program_type (dst, src, NULL);
      glc_surface_enable_program (type, dst, src, NULL, texture, NULL);
    }
    
!   if ((!src->transform) && SURFACE_GLREPEAT (src, texture)) {
      /* CASE 1: Repeat, no transformation and power of two sized texture,
         GL can do repeat for us. */
***************
*** 605,609 ****
      bl.y = br.y = src->height;
  
!     if (TRANSFORM (src)) {
        glc_texture_ensure_filter (texture, src->filter);
        glc_matrix_transform_point (src->transform, &tl);
--- 602,606 ----
      bl.y = br.y = src->height;
  
!     if (src->transform) {
        glc_texture_ensure_filter (texture, src->filter);
        glc_matrix_transform_point (src->transform, &tl);
***************
*** 631,635 ****
      if (x_src) {
        x_src = abs (x_src);
!       if (REPEAT (src))
          x_src = (x_src % src->width);
        tl.x -= x_src;
--- 628,632 ----
      if (x_src) {
        x_src = abs (x_src);
!       if (SURFACE_REPEAT (src))
          x_src = (x_src % src->width);
        tl.x -= x_src;
***************
*** 640,644 ****
      if (y_src) {
        y_src = abs (y_src);
!       if (REPEAT (src))
          y_src = (y_src % src->height);
        tl.y -= y_src;
--- 637,641 ----
      if (y_src) {
        y_src = abs (y_src);
!       if (SURFACE_REPEAT (src))
          y_src = (y_src % src->height);
        tl.y -= y_src;
***************
*** 657,661 ****
          /* Clip to original source area if repeat and transform are both
             used. */
!         if (TRANSFORM (src) && REPEAT (src)) {
            glc_region_box_t src_clip, intersect_clip;
            
--- 654,658 ----
          /* Clip to original source area if repeat and transform are both
             used. */
!         if (src->transform && SURFACE_REPEAT (src)) {
            glc_region_box_t src_clip, intersect_clip;
            
***************
*** 685,689 ****
          glEnd ();
  
!         if (REPEAT (src)) {
            bl.x += src->width;
            tl.x += src->width;
--- 682,686 ----
          glEnd ();
  
!         if (SURFACE_REPEAT (src)) {
            bl.x += src->width;
            tl.x += src->width;
***************
*** 692,698 ****
          }
          
!       } while (REPEAT (src) && (tl.x < (x_dst + width)));
  
!       if (REPEAT (src)) {
          bl.y += src->height;
          tl.y += src->height;
--- 689,695 ----
          }
          
!       } while (SURFACE_REPEAT (src) && (tl.x < (x_dst + width)));
  
!       if (SURFACE_REPEAT (src)) {
          bl.y += src->height;
          tl.y += src->height;
***************
*** 706,713 ****
        }
        
!     } while (REPEAT (src) && (tl.y < (y_dst + height)));  
    }
  
!   if (src->convolution || src->programmatic)
      glc_surface_disable_program (type, dst);
    
--- 703,710 ----
        }
        
!     } while (SURFACE_REPEAT (src) && (tl.y < (y_dst + height)));  
    }
  
!   if (src->convolution || SURFACE_PROGRAMMATIC (src))
      glc_surface_disable_program (type, dst);
    
***************
*** 717,721 ****
       destination surfaces is an intermediate mask surface
       and source surface is transformed and not repeating. */
!   if (dst->clear_exterior && (!REPEAT (src))) {
      glc_set_operator (GLC_OPERATOR_SRC);
      glColor4f (0.0, 0.0, 0.0, 0.0);
--- 714,718 ----
       destination surfaces is an intermediate mask surface
       and source surface is transformed and not repeating. */
!   if (SURFACE_CLEAR_EXTERIOR (dst) && (!SURFACE_REPEAT (src))) {
      glc_set_operator (GLC_OPERATOR_SRC);
      glColor4f (0.0, 0.0, 0.0, 0.0);

Index: glc.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glc.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** a/glc.h	21 Mar 2004 13:41:02 -0000	1.18
--- b/glc.h	27 Mar 2004 00:02:07 -0000	1.19
***************
*** 167,175 ****
  #define GLC_FORMAT_ALPHA_SIZE_MASK          (1L <<  9)
  #define GLC_FORMAT_DEPTH_SIZE_MASK          (1L << 10)
! #define GLC_FORMAT_DOUBLEBUFFER_MASK        (1L << 11)
! #define GLC_FORMAT_ONSCREEN_MASK            (1L << 12)
! #define GLC_FORMAT_OFFSCREEN_MASK           (1L << 13)
! #define GLC_FORMAT_MULTISAMPLE_MASK         (1L << 14)
! #define GLC_FORMAT_MULTISAMPLE_SAMPLES_MASK (1L << 15)
  
  typedef unsigned long int glc_format_id_t;
--- 167,176 ----
  #define GLC_FORMAT_ALPHA_SIZE_MASK          (1L <<  9)
  #define GLC_FORMAT_DEPTH_SIZE_MASK          (1L << 10)
! #define GLC_FORMAT_STENCIL_SIZE_MASK        (1L << 11)
! #define GLC_FORMAT_DOUBLEBUFFER_MASK        (1L << 12)
! #define GLC_FORMAT_ONSCREEN_MASK            (1L << 13)
! #define GLC_FORMAT_OFFSCREEN_MASK           (1L << 14)
! #define GLC_FORMAT_MULTISAMPLE_MASK         (1L << 15)
! #define GLC_FORMAT_MULTISAMPLE_SAMPLES_MASK (1L << 16)
  
  typedef unsigned long int glc_format_id_t;
***************
*** 200,203 ****
--- 201,205 ----
    unsigned short alpha_size;
    unsigned short depth_size;
+   unsigned short stencil_size;
    
    glc_bool_t doublebuffer;
***************
*** 303,306 ****
--- 305,332 ----
                            glc_polyedge_t polyedge);
  
+ typedef enum {
+   GLC_CLIP_OPERATOR_SET,
+   GLC_CLIP_OPERATOR_UNION,
+   GLC_CLIP_OPERATOR_INTERSECT
+ } glc_clip_operator_t;
+   
+ void
+ glc_surface_clip_rectangles (glc_surface_t *surface,
+                              glc_clip_operator_t op,
+                              const glc_rectangle_t *rects,
+                              int n_rects);
+   
+ void
+ glc_surface_clip_trapezoids (glc_surface_t *surface,
+                              glc_clip_operator_t op,
+                              const glc_trapezoid_t *traps,
+                              int n_traps);
+ 
+ void
+ glc_surface_clip_triangles (glc_surface_t *surface,
+                             glc_clip_operator_t op,
+                             const glc_triangle_t *tris,
+                             int n_tris);
+   
  int
  glc_surface_get_width (glc_surface_t *surface);
***************
*** 310,321 ****
  
  void
! glc_surface_realize (glc_surface_t *surface);
  
  void
! glc_surface_show (glc_surface_t *surface,
!                   int x,
!                   int y,
!                   unsigned int width,
!                   unsigned int height);
  
  void
--- 336,347 ----
  
  void
! glc_surface_update_size (glc_surface_t *surface);
  
  void
! glc_surface_flush (glc_surface_t *surface,
!                    int x,
!                    int y,
!                    unsigned int width,
!                    unsigned int height);
  
  void
***************
*** 353,357 ****
  
  unsigned long
! glc_surface_features (glc_surface_t *surface);
    
    
--- 379,399 ----
  
  unsigned long
! glc_surface_get_features (glc_surface_t *surface);
! 
! glc_format_t *
! glc_surface_get_format (glc_surface_t *surface);
! 
! glc_surface_t *
! glc_surface_create_similar (glc_surface_t *templ,
!                             glc_format_name_t format,
!                             int width,
!                             int height);
! 
! #define GLC_HINT_CLIPPING_MASK     (1L << 0)
! #define GLC_HINT_OFFSCREEN_MASK    (1L << 1)
! #define GLC_HINT_PROGRAMMATIC_MASK (1L << 2)
! 
! unsigned long
! glc_surface_get_hints (glc_surface_t *surface);
    
    
***************
*** 378,381 ****
--- 420,430 ----
  
  void
+ glc_fill_trapezoids (glc_operator_t op,
+                      glc_surface_t *dst,
+                      const glc_color_t *color,
+                      const glc_trapezoid_t *traps,
+                      int n_traps);
+ 
+ void
  glc_composite_trapezoids (glc_operator_t op,
                            glc_surface_t *src,
***************
*** 396,399 ****
--- 445,455 ----
  
  void
+ glc_fill_triangles (glc_operator_t op,
+                     glc_surface_t *dst,
+                     const glc_color_t *color,
+                     const glc_triangle_t *tris,
+                     int n_tris);
+   
+ void
  glc_composite_triangles (glc_operator_t op,
                           glc_surface_t *src,
***************
*** 412,416 ****
                           const glc_point_fixed_t *points,
                           int n_points);
-   
  
  void
--- 468,471 ----
***************
*** 447,466 ****
  
  
! #ifdef LIBGLC_HAS_GLX_BACKEND
  
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
    
- /* glc_glx_info.c */
- 
- void
- glc_glx_initialize (Display *display,
-                     int screen);  
- 
- unsigned long
- glc_glx_features (Display *display,
-                   int screen);
-   
- 
  /* glc_glx_format.c */
  
--- 502,510 ----
  
  
! #if defined (LIBGLC_HAS_GLX_BACKEND) && defined(LIBGLC_USE_GLX_BACKEND)
  
  #include <X11/Xlib.h>
  #include <X11/Xutil.h>
    
  /* glc_glx_format.c */
  
***************
*** 499,518 ****
                                     Window window);
  
! #endif /* LIBGLC_HAS_GLX_BACKEND */
  
    
! #ifdef LIBGLC_HAS_AGL_BACKEND
    
  #include <Carbon/Carbon.h>
    
- /* glc_agl_info.c */
- 
- void
- glc_agl_initialize (void);
- 
- unsigned long
- glc_agl_features (void);
-   
- 
  /* glc_agl_format.c */
  
--- 543,553 ----
                                     Window window);
  
! #endif /* LIBGLC_HAS_GLX_BACKEND && LIBGLC_USE_GLX_BACKEND */
  
    
! #if defined (LIBGLC_HAS_AGL_BACKEND) && defined(LIBGLC_USE_AGL_BACKEND)
    
  #include <Carbon/Carbon.h>
    
  /* glc_agl_format.c */
  
***************
*** 538,542 ****
                                     WindowRef window);
  
! #endif /* LIBGLC_HAS_AGL_BACKEND */
    
  #if defined(__cplusplus) || defined(c_plusplus)
--- 573,577 ----
                                     WindowRef window);
  
! #endif /* LIBGLC_HAS_AGL_BACKEND && LIBGLC_USE_AGL_BACKEND */
    
  #if defined(__cplusplus) || defined(c_plusplus)

Index: glc_agl_context.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_context.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glc_agl_context.c	6 Mar 2004 13:58:17 -0000	1.5
--- b/glc_agl_context.c	27 Mar 2004 00:02:07 -0000	1.6
***************
*** 79,88 ****
  glc_agl_context_set_surface_anti_aliasing (glc_agl_surface_t *surface)
  {
-   surface->base.anti_aliasing = 0;
- 
    if (surface->base.format->multisample.supported) {
      if (surface->base.polyedge == GLC_POLYEDGE_SMOOTH) {
        glEnable (GL_MULTISAMPLE_ARB);
-       surface->base.anti_aliasing = 1;
        if (surface->thread_info->agl_feature_mask &
            GLC_AGL_FEATURE_MULTISAMPLE_FILTER_MASK)
--- 79,85 ----

Index: glc_agl_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_format.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** a/glc_agl_format.c	5 Mar 2004 07:48:22 -0000	1.7
--- b/glc_agl_format.c	27 Mar 2004 00:02:07 -0000	1.8
***************
*** 36,40 ****
  
  static const struct _glx_pixel_format_attrib {
!   GLint attrib[18];
  } pixel_format_attrib_map[] = {
    {
--- 36,40 ----
  
  static const struct _glx_pixel_format_attrib {
!   GLint attrib[20];
  } pixel_format_attrib_map[] = {
    {
***************
*** 47,50 ****
--- 47,97 ----
        AGL_ALPHA_SIZE, 0,
        AGL_NO_RECOVERY,
+       AGL_NONE, 0, 0, 0, 0, 0, 0, 0, 0
+     }
+   }, {
+     {
+       AGL_RGBA,
+       AGL_DOUBLEBUFFER,
+       AGL_RED_SIZE, 8,
+       AGL_GREEN_SIZE, 8,
+       AGL_BLUE_SIZE, 8,
+       AGL_ALPHA_SIZE, 8,
+       AGL_NO_RECOVERY,
+       AGL_NONE, 0, 0, 0, 0, 0, 0, 0, 0
+     }
+   }, {
+     {
+       AGL_RGBA,
+       AGL_DOUBLEBUFFER,
+       AGL_RED_SIZE, 8,
+       AGL_GREEN_SIZE, 8,
+       AGL_BLUE_SIZE, 8,
+       AGL_NO_RECOVERY,
+       AGL_SAMPLE_BUFFERS_ARB, 1,
+       AGL_SAMPLES_ARB, 2,
+       AGL_NONE, 0, 0, 0, 0
+     }
+   }, {
+     {
+       AGL_RGBA,
+       AGL_DOUBLEBUFFER,
+       AGL_RED_SIZE, 8,
+       AGL_GREEN_SIZE, 8,
+       AGL_BLUE_SIZE, 8,
+       AGL_NO_RECOVERY,
+       AGL_SAMPLE_BUFFERS_ARB, 1,
+       AGL_SAMPLES_ARB, 4,
+       AGL_NONE, 0, 0, 0, 0
+     }
+   }, {
+     {
+       AGL_RGBA,
+       AGL_DOUBLEBUFFER,
+       AGL_RED_SIZE, 8,
+       AGL_GREEN_SIZE, 8,
+       AGL_BLUE_SIZE, 8,
+       AGL_ALPHA_SIZE, 0,
+       AGL_DEPTH_SIZE, 1,
+       AGL_NO_RECOVERY,
        AGL_NONE, 0, 0, 0, 0, 0, 0
      }
***************
*** 57,60 ****
--- 104,108 ----
        AGL_BLUE_SIZE, 8,
        AGL_ALPHA_SIZE, 8,
+       AGL_DEPTH_SIZE, 1,
        AGL_NO_RECOVERY,
        AGL_NONE, 0, 0, 0, 0, 0, 0
***************
*** 67,70 ****
--- 115,119 ----
        AGL_GREEN_SIZE, 8,
        AGL_BLUE_SIZE, 8,
+       AGL_DEPTH_SIZE, 1,
        AGL_NO_RECOVERY,
        AGL_SAMPLE_BUFFERS_ARB, 1,
***************
*** 79,82 ****
--- 128,132 ----
        AGL_GREEN_SIZE, 8,
        AGL_BLUE_SIZE, 8,
+       AGL_DEPTH_SIZE, 1,
        AGL_NO_RECOVERY,
        AGL_SAMPLE_BUFFERS_ARB, 1,
***************
*** 93,96 ****
--- 143,147 ----
        AGL_ALPHA_SIZE, 0,
        AGL_DEPTH_SIZE, 1,
+       AGL_STENCIL_SIZE, 2,
        AGL_NO_RECOVERY,
        AGL_NONE, 0, 0, 0, 0
***************
*** 105,108 ****
--- 156,160 ----
        AGL_ALPHA_SIZE, 8,
        AGL_DEPTH_SIZE, 1,
+       AGL_STENCIL_SIZE, 2,
        AGL_NO_RECOVERY,
        AGL_NONE, 0, 0, 0, 0
***************
*** 116,119 ****
--- 168,172 ----
        AGL_BLUE_SIZE, 8,
        AGL_DEPTH_SIZE, 1,
+       AGL_STENCIL_SIZE, 2,
        AGL_NO_RECOVERY,
        AGL_SAMPLE_BUFFERS_ARB, 1,
***************
*** 129,132 ****
--- 182,186 ----
        AGL_BLUE_SIZE, 8,
        AGL_DEPTH_SIZE, 1,
+       AGL_STENCIL_SIZE, 2,
        AGL_NO_RECOVERY,
        AGL_SAMPLE_BUFFERS_ARB, 1,
***************
*** 153,161 ****
  
    for (; i < 2; i++) {
-     if (format[i]->alpha_size)
-       score[i] += 10;
      if (format[i]->red_size)
        score[i] += 10;
      if (format[i]->depth_size)
        score[i] += 10;
      if (format[i]->multisample.supported) 
--- 207,217 ----
  
    for (; i < 2; i++) {
      if (format[i]->red_size)
        score[i] += 10;
+     if (format[i]->alpha_size)
+       score[i] += 10;
      if (format[i]->depth_size)
+       score[i] += 5;
+     if (format[i]->stencil_size)
        score[i] += 10;
      if (format[i]->multisample.supported) 
***************
*** 247,250 ****
--- 303,308 ----
      aglDescribePixelFormat (pixel_format, AGL_DEPTH_SIZE, &value);
      format.depth_size = (unsigned short) value;
+     aglDescribePixelFormat (pixel_format, AGL_STENCIL_SIZE, &value);
+     format.stencil_size = (unsigned short) value;
      
      if (thread_info->feature_mask & GLC_FEATURE_MULTISAMPLE_MASK) {

Index: glc_agl_info.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_info.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** a/glc_agl_info.c	6 Mar 2004 13:58:17 -0000	1.9
--- b/glc_agl_info.c	27 Mar 2004 00:02:07 -0000	1.10
***************
*** 138,156 ****
    thread_info->context_stack->constraint = GLC_CN_NONE;
  }
- 
- void
- glc_agl_initialize (void)
- {
-   glc_agl_thread_info_get ();
- }
- slim_hidden_def(glc_agl_initialize);
- 
- unsigned long
- glc_agl_features (void)
- {
-   glc_agl_thread_info_t *thread_info =
-     glc_agl_thread_info_get ();
- 
-   return thread_info->feature_mask;
- }
- slim_hidden_def(glc_agl_features);
--- 138,139 ----

Index: glc_agl_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_surface.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** a/glc_agl_surface.c	20 Feb 2004 17:40:57 -0000	1.8
--- b/glc_agl_surface.c	27 Mar 2004 00:02:07 -0000	1.9
***************
*** 37,40 ****
--- 37,41 ----
  _glc_agl_surface_create_similar (void *abstract_templ,
                                   glc_format_name_t format_name,
+                                  glc_bool_t drawable,
                                   int width,
                                   int height);
***************
*** 47,54 ****
  
  static void
! _glc_agl_surface_realize (void *abstract_surface);
  
  static void
! _glc_agl_surface_show (void *abstract_surface);
  
  static glc_bool_t
--- 48,55 ----
  
  static void
! _glc_agl_surface_update_size (void *abstract_surface);
  
  static void
! _glc_agl_surface_flush (void *abstract_surface);
  
  static glc_bool_t
***************
*** 89,94 ****
    _glc_agl_surface_pop_current,
    _glc_agl_surface_get_texture,
!   _glc_agl_surface_realize,
!   _glc_agl_surface_show
  };
  
--- 90,95 ----
    _glc_agl_surface_pop_current,
    _glc_agl_surface_get_texture,
!   _glc_agl_surface_update_size,
!   _glc_agl_surface_flush
  };
  
***************
*** 96,100 ****
  _glc_agl_surface_ensure_texture (glc_agl_surface_t *surface)
  {
!   if (!surface->base.dirty)
      return;
      
--- 97,101 ----
  _glc_agl_surface_ensure_texture (glc_agl_surface_t *surface)
  {
!    if (!(surface->base.hint_mask & GLC_INT_HINT_DIRTY_MASK))
      return;
      
***************
*** 103,107 ****
                                &surface->base.dirty_region);
    
!   surface->base.dirty = 0;
  }
  
--- 104,108 ----
                                &surface->base.dirty_region);
    
!   surface->base.hint_mask &= ~GLC_INT_HINT_DIRTY_MASK;
  }
  
***************
*** 119,125 ****
  
  static void
! _glc_agl_surface_realize_window (WindowRef window,
!                                  int *width,
!                                  int *height)
  {
    Rect window_bounds;
--- 120,126 ----
  
  static void
! _glc_agl_surface_update_size_for_window (WindowRef window,
!                                          int *width,
!                                          int *height)
  {
    Rect window_bounds;
***************
*** 140,144 ****
    surface->base.feature_mask &= ~GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
  
- #if defined(GL_ARB_multitexture) && defined(GL_ARB_fragment_program)
    if (surface->thread_info->feature_mask &
        GLC_FEATURE_CONVOLUTION_FILTER_MASK) {
--- 141,144 ----
***************
*** 155,163 ****
        surface->base.feature_mask |= GLC_FEATURE_CONVOLUTION_FILTER_MASK;
    }
- #endif
  
    if (surface->base.format->multisample.supported) {
      surface->base.feature_mask |= GLC_FEATURE_MULTISAMPLE_MASK;
!     if (surface->pbuffer)
        surface->base.feature_mask |= GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
    }
--- 155,163 ----
        surface->base.feature_mask |= GLC_FEATURE_CONVOLUTION_FILTER_MASK;
    }
  
    if (surface->base.format->multisample.supported) {
      surface->base.feature_mask |= GLC_FEATURE_MULTISAMPLE_MASK;
!     if (surface->thread_info->feature_mask &
!         GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK)
        surface->base.feature_mask |= GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
    }
***************
*** 194,197 ****
--- 194,198 ----
    surface->base.width = width;
    surface->base.height = height;
+   surface->base.hint_mask |= GLC_HINT_OFFSCREEN_MASK;
  
    texture_format = glc_get_gl_format_from_bpp (format->bpp);
***************
*** 262,266 ****
      return NULL;
  
!   _glc_agl_surface_realize_window (window, &width, &height);
  
    surface = (glc_agl_surface_t *) calloc (1, sizeof (glc_agl_surface_t));
--- 263,267 ----
      return NULL;
  
!   _glc_agl_surface_update_size_for_window (window, &width, &height);
  
    surface = (glc_agl_surface_t *) calloc (1, sizeof (glc_agl_surface_t));
***************
*** 291,294 ****
--- 292,296 ----
  _glc_agl_surface_create_similar (void *abstract_templ,
                                   glc_format_name_t format_name,
+                                  glc_bool_t drawable,
                                   int width,
                                   int height)
***************
*** 296,300 ****
    glc_agl_surface_t *templ = (glc_agl_surface_t *) abstract_templ;
    
!   if (templ->thread_info->agl_feature_mask & GLC_AGL_FEATURE_PBUFFER_MASK) {
      glc_format_t *format;
  
--- 298,303 ----
    glc_agl_surface_t *templ = (glc_agl_surface_t *) abstract_templ;
    
!   if ((!drawable) ||
!       (templ->thread_info->agl_feature_mask & GLC_AGL_FEATURE_PBUFFER_MASK)) {
      glc_format_t *format;
  
***************
*** 312,316 ****
                                        width, height);
    }
! 
    return NULL;
  }
--- 315,319 ----
                                        width, height);
    }
!       
    return NULL;
  }
***************
*** 349,360 ****
  
  static void
! _glc_agl_surface_realize (void *abstract_surface)
  {
    glc_agl_surface_t *surface = (glc_agl_surface_t *) abstract_surface;
    
    if (surface->window) {
!     _glc_agl_surface_realize_window (surface->window,
!                                      &surface->base.width,
!                                      &surface->base.height);
      
      glc_agl_context_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT);
--- 352,363 ----
  
  static void
! _glc_agl_surface_update_size (void *abstract_surface)
  {
    glc_agl_surface_t *surface = (glc_agl_surface_t *) abstract_surface;
    
    if (surface->window) {
!     _glc_agl_surface_update_size_for_window (surface->window,
!                                              &surface->base.width,
!                                              &surface->base.height);
      
      glc_agl_context_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT);
***************
*** 367,371 ****
  
  static void
! _glc_agl_surface_show (void *abstract_surface)
  {
    glc_agl_surface_t *surface = (glc_agl_surface_t *) abstract_surface;
--- 370,374 ----
  
  static void
! _glc_agl_surface_flush (void *abstract_surface)
  {
    glc_agl_surface_t *surface = (glc_agl_surface_t *) abstract_surface;

Index: glc_color_range.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_color_range.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/glc_color_range.c	21 Mar 2004 13:41:02 -0000	1.1
--- b/glc_color_range.c	27 Mar 2004 00:02:07 -0000	1.2
***************
*** 112,117 ****
         a POT sized memory block for glTexImage1D */
      if ((!(feature_mask & GLC_FEATURE_TEXTURE_NPOT_MASK)) &&
!         (!glc_int_is_power_of_two (color_range->size))) {
!       glc_int_to_power_of_two (&color_range->size);
        
        color_range->data = realloc (color_range->data, color_range->size * 4);
--- 112,117 ----
         a POT sized memory block for glTexImage1D */
      if ((!(feature_mask & GLC_FEATURE_TEXTURE_NPOT_MASK)) &&
!         (!glc_uint_is_power_of_two (color_range->size))) {
!       glc_uint_to_power_of_two (&color_range->size);
        
        color_range->data = realloc (color_range->data, color_range->size * 4);

Index: glc_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_format.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glc_format.c	12 Feb 2004 12:49:39 -0000	1.4
--- b/glc_format.c	27 Mar 2004 00:02:07 -0000	1.5
***************
*** 86,89 ****
--- 86,93 ----
          continue;
  
+     if (mask & GLC_FORMAT_STENCIL_SIZE_MASK)
+       if (templ->stencil_size != formats->stencil_size)
+         continue;
+ 
      if (mask & GLC_FORMAT_DOUBLEBUFFER_MASK)
        if (templ->doublebuffer != formats->doublebuffer)

Index: glc_glx_context.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_context.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** a/glc_glx_context.c	6 Mar 2004 13:58:17 -0000	1.13
--- b/glc_glx_context.c	27 Mar 2004 00:02:07 -0000	1.14
***************
*** 191,200 ****
  glc_glx_context_set_surface_anti_aliasing (glc_glx_surface_t *surface)
  {
-   surface->base.anti_aliasing = 0;
- 
    if (surface->base.format->multisample.supported) {
      if (surface->base.polyedge == GLC_POLYEDGE_SMOOTH) {
        glEnable (GL_MULTISAMPLE_ARB);
-       surface->base.anti_aliasing = 1;
        if (surface->screen_info->glx_feature_mask &
            GLC_GLX_FEATURE_MULTISAMPLE_FILTER_MASK)
--- 191,197 ----

Index: glc_glx_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_format.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** a/glc_glx_format.c	13 Mar 2004 11:26:12 -0000	1.19
--- b/glc_glx_format.c	27 Mar 2004 00:02:07 -0000	1.20
***************
*** 49,58 ****
  
    for (; i < 2; i++) {
!     if (format[i]->depth_size)
        score[i] += 10;
      if (format[i]->alpha_size)
        score[i] += 10;
!     if (format[i]->red_size)
!       score[i] += 10;
      if (format[i]->doublebuffer)
        score[i] += 10;
--- 49,60 ----
  
    for (; i < 2; i++) {
!     if (format[i]->red_size)
        score[i] += 10;
      if (format[i]->alpha_size)
        score[i] += 10;
!     if (format[i]->depth_size)
!       score[i] += 5;
!     if (format[i]->stencil_size)
!       score[i] += (10 + format[i]->stencil_size);
      if (format[i]->doublebuffer)
        score[i] += 10;
***************
*** 152,155 ****
--- 154,159 ----
      glXGetConfig (display, &visuals[i], GLX_DEPTH_SIZE, &value);
      format.depth_size = (unsigned short) value;
+     glXGetConfig (display, &visuals[i], GLX_STENCIL_SIZE, &value);
+     format.stencil_size = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_DOUBLEBUFFER, &value);
      format.doublebuffer = (value) ? 1: 0;
***************
*** 266,269 ****
--- 270,276 ----
      format.depth_size = (unsigned short) value;
      _glc_glx_proc_address.glx_get_fbconfig_attrib (display, fbconfigs[i],
+                                                    GLX_STENCIL_SIZE, &value);
+     format.stencil_size = (unsigned short) value;
+     _glc_glx_proc_address.glx_get_fbconfig_attrib (display, fbconfigs[i],
                                                     GLX_DOUBLEBUFFER, &value);
      format.doublebuffer = (value) ? 1: 0;

Index: glc_glx_info.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_info.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** a/glc_glx_info.c	6 Mar 2004 13:58:17 -0000	1.14
--- b/glc_glx_info.c	27 Mar 2004 00:02:07 -0000	1.15
***************
*** 265,285 ****
    return screen_info;
  }
- 
- void
- glc_glx_initialize (Display *display,
-                     int screen)
- {
-   glc_glx_screen_info_get (display, screen);
- }
- slim_hidden_def(glc_glx_initialize);
- 
- unsigned long
- glc_glx_features (Display *display,
-                   int screen)
- {
-   glc_glx_screen_info_t *screen_info =
-     glc_glx_screen_info_get (display, screen);
- 
-   return screen_info->feature_mask;
- }
- slim_hidden_def(glc_glx_features);
--- 265,266 ----

Index: glc_glx_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_surface.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** a/glc_glx_surface.c	21 Mar 2004 13:41:02 -0000	1.20
--- b/glc_glx_surface.c	27 Mar 2004 00:02:07 -0000	1.21
***************
*** 35,38 ****
--- 35,39 ----
  _glc_glx_surface_create_similar (void *abstract_templ,
                                   glc_format_name_t format_name,
+                                  glc_bool_t drawable,
                                   int width,
                                   int height);
***************
*** 45,52 ****
  
  static void
! _glc_glx_surface_realize (void *abstract_surface);
  
  static void
! _glc_glx_surface_show (void *abstract_surface);
  
  static glc_bool_t
--- 46,53 ----
  
  static void
! _glc_glx_surface_update_size (void *abstract_surface);
  
  static void
! _glc_glx_surface_flush (void *abstract_surface);
  
  static glc_bool_t
***************
*** 94,106 ****
    _glc_glx_surface_pop_current,
    _glc_glx_surface_get_texture,
!   _glc_glx_surface_realize,
!   _glc_glx_surface_show
  };
  
  static glc_bool_t
! _glc_glx_surface_realize_window (Display *display,
!                                  Window drawable,
!                                  int *width,
!                                  int *height)
  {
    unsigned int uwidth, uheight, bwidth_ignore, depth_ignore;
--- 95,107 ----
    _glc_glx_surface_pop_current,
    _glc_glx_surface_get_texture,
!   _glc_glx_surface_update_size,
!   _glc_glx_surface_flush
  };
  
  static glc_bool_t
! _glc_glx_surface_update_size_for_window (Display *display,
!                                          Window drawable,
!                                          int *width,
!                                          int *height)
  {
    unsigned int uwidth, uheight, bwidth_ignore, depth_ignore;
***************
*** 121,125 ****
  _glc_glx_surface_ensure_texture (glc_glx_surface_t *surface)
  {
!   if (!surface->base.dirty)
      return;
  
--- 122,126 ----
  _glc_glx_surface_ensure_texture (glc_glx_surface_t *surface)
  {
!   if (!(surface->base.hint_mask & GLC_INT_HINT_DIRTY_MASK))
      return;
  
***************
*** 136,141 ****
      glc_texture_copy_surface (surface->base.texture, &surface->base,
                                &surface->base.dirty_region);
!   
!   surface->base.dirty = 0;
  }
  
--- 137,142 ----
      glc_texture_copy_surface (surface->base.texture, &surface->base,
                                &surface->base.dirty_region);
! 
!   surface->base.hint_mask &= ~GLC_INT_HINT_DIRTY_MASK;
  }
  
***************
*** 210,214 ****
    if (surface->base.format->multisample.supported) {
      surface->base.feature_mask |= GLC_FEATURE_MULTISAMPLE_MASK;
!     if (surface->pbuffer)
        surface->base.feature_mask |= GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
    }
--- 211,216 ----
    if (surface->base.format->multisample.supported) {
      surface->base.feature_mask |= GLC_FEATURE_MULTISAMPLE_MASK;
!     if (surface->screen_info->feature_mask &
!         GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK)
        surface->base.feature_mask |= GLC_FEATURE_OFFSCREEN_MULTISAMPLE_MASK;
    }
***************
*** 242,245 ****
--- 244,248 ----
    surface->base.width = width;
    surface->base.height = height;
+   surface->base.hint_mask |= GLC_HINT_OFFSCREEN_MASK;
  
    texture_format = glc_get_gl_format_from_bpp (format->bpp);
***************
*** 273,277 ****
    if (surface->base.feature_mask & GLC_FEATURE_ATI_RENDER_TEXTURE_MASK) {
      if (format->red_size || format->green_size || format->blue_size)
!       surface->base.requires_flipping = 0;
    } else
      surface->render_texture = 0;
--- 276,280 ----
    if (surface->base.feature_mask & GLC_FEATURE_ATI_RENDER_TEXTURE_MASK) {
      if (format->red_size || format->green_size || format->blue_size)
!       surface->base.hint_mask |= GLC_INT_HINT_REQUIRES_NO_FLIPPING_MASK;
    } else
      surface->render_texture = 0;
***************
*** 316,320 ****
      return NULL;
  
!   if (!_glc_glx_surface_realize_window (display, window, &width, &height))
      return NULL;
  
--- 319,324 ----
      return NULL;
  
!   if (!_glc_glx_surface_update_size_for_window (display, window,
!                                                 &width, &height))
      return NULL;
  
***************
*** 346,349 ****
--- 350,354 ----
  _glc_glx_surface_create_similar (void *abstract_templ,
                                   glc_format_name_t format_name,
+                                  glc_bool_t drawable,
                                   int width,
                                   int height)
***************
*** 351,355 ****
    glc_glx_surface_t *templ = (glc_glx_surface_t *) abstract_templ;
    
!   if (templ->screen_info->feature_mask & GLC_FEATURE_OFFSCREEN_DRAWING_MASK) {
      glc_format_t *format;
      
--- 356,361 ----
    glc_glx_surface_t *templ = (glc_glx_surface_t *) abstract_templ;
    
!   if ((!drawable) || (templ->screen_info->feature_mask &
!                       GLC_FEATURE_OFFSCREEN_DRAWING_MASK)) {
      glc_format_t *format;
      
***************
*** 405,414 ****
  
  static void
! _glc_glx_surface_realize (void *abstract_surface)
  {
    glc_glx_surface_t *surface = (glc_glx_surface_t *) abstract_surface;
    
    if ((! surface->pbuffer) && surface->drawable) {
!     _glc_glx_surface_realize_window
        (surface->screen_info->display_info->display, surface->drawable,
         &surface->base.width, &surface->base.height);
--- 411,420 ----
  
  static void
! _glc_glx_surface_update_size (void *abstract_surface)
  {
    glc_glx_surface_t *surface = (glc_glx_surface_t *) abstract_surface;
    
    if ((! surface->pbuffer) && surface->drawable) {
!     _glc_glx_surface_update_size_for_window
        (surface->screen_info->display_info->display, surface->drawable,
         &surface->base.width, &surface->base.height);
***************
*** 417,421 ****
  
  static void
! _glc_glx_surface_show (void *abstract_surface)
  {
    glc_glx_surface_t *surface = (glc_glx_surface_t *) abstract_surface;
--- 423,427 ----
  
  static void
! _glc_glx_surface_flush (void *abstract_surface)
  {
    glc_glx_surface_t *surface = (glc_glx_surface_t *) abstract_surface;

Index: glc_glxext.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glxext.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** a/glc_glxext.h	6 Mar 2004 13:58:17 -0000	1.1
--- b/glc_glxext.h	27 Mar 2004 00:02:07 -0000	1.2
***************
*** 107,112 ****
  
  #ifndef GLX_ARB_multisample
! #define GLX_SAMPLE_BUFFERS_ARB             0x186a0
! #define GLX_SAMPLES_ARB                    0x186a1
  #endif
  
--- 107,112 ----
  
  #ifndef GLX_ARB_multisample
! #define GLX_SAMPLE_BUFFERS_ARB              0x186a0
! #define GLX_SAMPLES_ARB                     0x186a1
  #endif
  

Index: glc_operator.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_operator.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glc_operator.c	10 Feb 2004 23:38:36 -0000	1.3
--- b/glc_operator.c	27 Mar 2004 00:02:07 -0000	1.4
***************
*** 96,97 ****
--- 96,130 ----
    }
  }
+ 
+ void
+ glc_set_clip_operator (glc_int_clip_operator_t op, int mask)
+ {
+   glEnable (GL_STENCIL_TEST);
+   
+   switch (op) {
+   case GLC_INT_CLIP_OPERATOR_SET:
+     glClearStencil (0x0);
+     glClear (GL_STENCIL_BUFFER_BIT);
+   case GLC_INT_CLIP_OPERATOR_UNION:
+     glStencilFunc (GL_ALWAYS, mask, mask);
+     glStencilOp (GL_REPLACE, GL_REPLACE, GL_REPLACE);
+     break;
+   case GLC_INT_CLIP_OPERATOR_INTERSECT:
+     glStencilFunc (GL_EQUAL, mask, mask);
+     glStencilOp (GL_KEEP, GL_REPLACE, GL_REPLACE);
+     break;
+   case GLC_INT_CLIP_OPERATOR_INCR_INTERSECT:
+     glStencilFunc (GL_EQUAL, mask - 0x1, mask - 0x1);
+     glStencilOp (GL_KEEP, GL_INCR, GL_INCR);
+     break;
+   case GLC_INT_CLIP_OPERATOR_DECR_INTERSECT:
+     glStencilFunc (GL_EQUAL, mask + 0x1, mask + 0x1);
+     glStencilOp (GL_KEEP, GL_DECR, GL_DECR);
+     break;
+   case GLC_INT_CLIP_OPERATOR_CLIP:
+   default:
+     glStencilFunc (GL_EQUAL, mask, mask);
+     glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
+     break;
+   }
+ }

Index: glc_program.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_program.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** a/glc_program.c	21 Mar 2004 13:41:02 -0000	1.9
--- b/glc_program.c	27 Mar 2004 00:02:07 -0000	1.10
***************
*** 677,681 ****
      
      if (src->convolution) {
!       if (mask && mask->programmatic &&
            ((glc_programmatic_surface_t *) mask)->type ==
            GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
--- 677,681 ----
      
      if (src->convolution) {
!       if (mask && SURFACE_PROGRAMMATIC (mask) &&
            ((glc_programmatic_surface_t *) mask)->type ==
            GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
***************
*** 693,697 ****
      
      if (mask && mask->convolution) {
!       if (src->programmatic &&
            ((glc_programmatic_surface_t *) src)->type ==
            GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
--- 693,697 ----
      
      if (mask && mask->convolution) {
!       if (SURFACE_PROGRAMMATIC (src) &&
            ((glc_programmatic_surface_t *) src)->type ==
            GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
***************
*** 708,717 ****
      }
  
!     if (src->programmatic) {
        type = GLC_PROGRAM_TYPE_SRC_PROGRAMMATIC;
        goto OK1;
      }
      
!     if (mask && mask->programmatic) {
        type = GLC_PROGRAM_TYPE_MASK_PROGRAMMATIC;
        goto OK1;
--- 708,717 ----
      }
  
!     if (SURFACE_PROGRAMMATIC (src)) {
        type = GLC_PROGRAM_TYPE_SRC_PROGRAMMATIC;
        goto OK1;
      }
      
!     if (mask && SURFACE_PROGRAMMATIC (mask)) {
        type = GLC_PROGRAM_TYPE_MASK_PROGRAMMATIC;
        goto OK1;
***************
*** 719,723 ****
    }
    
!   if (src->programmatic &&
        ((glc_programmatic_surface_t *) src)->type ==
        GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
--- 719,723 ----
    }
    
!   if (SURFACE_PROGRAMMATIC (src) &&
        ((glc_programmatic_surface_t *) src)->type ==
        GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
***************
*** 726,730 ****
    }
    
!   if (mask && mask->programmatic &&
        ((glc_programmatic_surface_t *) mask)->type ==
        GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
--- 726,730 ----
    }
    
!   if (mask && SURFACE_PROGRAMMATIC (mask) &&
        ((glc_programmatic_surface_t *) mask)->type ==
        GLC_PROGRAMMATIC_SURFACE_SOLID_TYPE) {
***************
*** 733,742 ****
    }
    
!   if (mask && (!mask->programmatic))
      type = GLC_PROGRAM_TYPE_SIMPLE;
  
   OK1:
!   if ((src->programmatic || src->convolution) &&
!       (mask && (mask->programmatic || mask->convolution)))
      return GLC_PROGRAM_TYPE_NOT_SUPPORTED;
    
--- 733,742 ----
    }
    
!   if (mask && (!SURFACE_PROGRAMMATIC (mask)))
      type = GLC_PROGRAM_TYPE_SIMPLE;
  
   OK1:
!   if ((SURFACE_PROGRAMMATIC (src) || src->convolution) &&
!       (mask && (SURFACE_PROGRAMMATIC (mask) || mask->convolution)))
      return GLC_PROGRAM_TYPE_NOT_SUPPORTED;
    

Index: glc_programmatic.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_programmatic.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glc_programmatic.c	21 Mar 2004 13:41:03 -0000	1.5
--- b/glc_programmatic.c	27 Mar 2004 00:02:07 -0000	1.6
***************
*** 37,40 ****
--- 37,41 ----
  _glc_programmatic_surface_create_similar (void *abstract_templ,
                                            glc_format_name_t format_name,
+                                           glc_bool_t drawable,
                                            int width,
                                            int height)
***************
*** 110,114 ****
  
    surface = (glc_programmatic_surface_t *)
!     malloc (sizeof (glc_programmatic_surface_t));
    if (surface == NULL)
      return NULL;
--- 111,115 ----
  
    surface = (glc_programmatic_surface_t *)
!     calloc (1, sizeof (glc_programmatic_surface_t));
    if (surface == NULL)
      return NULL;
***************
*** 116,120 ****
    glc_surface_init (&surface->base, &glc_programmatic_surface_backend);
    
!   surface->base.programmatic = 1;
    surface->base.texture = &surface->texture;
    surface->texture.name = 0;
--- 117,121 ----
    glc_surface_init (&surface->base, &glc_programmatic_surface_backend);
    
!   surface->base.hint_mask |= GLC_HINT_PROGRAMMATIC_MASK;
    surface->base.texture = &surface->texture;
    surface->texture.name = 0;
***************
*** 125,129 ****
      surface->texture.texcoord_height = 1.0;
    surface->texture.repeatable = surface->texture.repeat = 1;
-   surface->base.repeat = 0;
    
    return surface;
--- 126,129 ----

Index: glc_rect.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_rect.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** a/glc_rect.c	10 Feb 2004 23:38:36 -0000	1.9
--- b/glc_rect.c	27 Mar 2004 00:02:07 -0000	1.10
***************
*** 58,61 ****
--- 58,91 ----
  
  void
+ glc_int_fill_rectangles (glc_operator_t op,
+                          glc_surface_t *dst,
+                          const glc_color_t *color,
+                          const glc_rectangle_t *rects,
+                          int n_rects)
+ {
+   glc_region_box_t bounds;
+   
+   glc_rectangle_bounds (n_rects, rects, &bounds);
+   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
+       bounds.x2 < 0 || bounds.y2 < 0)
+     return;
+ 
+   glColor4us (color->red, color->green, color->blue, color->alpha);
+ 
+   glc_set_operator (op);
+     
+   glBegin (GL_QUADS);
+   
+   for (; n_rects; n_rects--, rects++) {
+     glVertex2i (rects->x, rects->y);
+     glVertex2i (rects->x + rects->width, rects->y);
+     glVertex2i (rects->x + rects->width, rects->y + rects->height);
+     glVertex2i (rects->x, rects->y + rects->height);
+   }
+   
+   glEnd ();
+ }
+ 
+ void
  glc_fill_rectangle (glc_operator_t op,
                      glc_surface_t *dst,
***************
*** 67,70 ****
--- 97,101 ----
  {
    glc_region_box_t bounds;
+   glc_rectangle_t rect;
  
    bounds.x1 = x;
***************
*** 76,79 ****
--- 107,115 ----
      return;
  
+   rect.x = x;
+   rect.y = y;
+   rect.width = width;
+   rect.height = height;
+ 
    if (!glc_surface_push_current (dst, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
      glc_surface_pop_current (dst);
***************
*** 81,98 ****
    }
  
!   glShadeModel (GL_FLAT);
!   
!   glColor4us (color->red, color->green, color->blue, color->alpha);
! 
!   glc_set_operator (op);
!                    
!   glBegin (GL_QUADS);
!     
!   glVertex2i (bounds.x1, bounds.y1);
!   glVertex2i (bounds.x2, bounds.y1);
!   glVertex2i (bounds.x2, bounds.y2);
!   glVertex2i (bounds.x1, bounds.y2);
!     
!   glEnd ();
  
    glc_surface_dirty (dst, &bounds);
--- 117,121 ----
    }
  
!   glc_int_fill_rectangles (op, dst, color, &rect, 1);
  
    glc_surface_dirty (dst, &bounds);
***************
*** 120,141 ****
    }
  
!   glShadeModel (GL_FLAT);
! 
!   glColor4us (color->red, color->green, color->blue, color->alpha);
! 
!   glc_set_operator (op);
!     
!   glBegin (GL_QUADS);
!   
!   for (; n_rects; n_rects--, rects++) {
!     glVertex2i (rects->x, rects->y);
!     glVertex2i (rects->x + rects->width, rects->y);
!     glVertex2i (rects->x + rects->width, rects->y + rects->height);
!     glVertex2i (rects->x, rects->y + rects->height);
!   }
!   
!   glEnd ();
  
!   glc_surface_dirty (dst, &bounds);  
    glc_surface_pop_current (dst);
  }
--- 143,149 ----
    }
  
!   glc_int_fill_rectangles (op, dst, color, rects, n_rects);
  
!   glc_surface_dirty (dst, &bounds);
    glc_surface_pop_current (dst);
  }

Index: glc_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_surface.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** a/glc_surface.c	21 Mar 2004 13:41:03 -0000	1.24
--- b/glc_surface.c	27 Mar 2004 00:02:07 -0000	1.25
***************
*** 41,61 ****
    surface->backend = backend;
  
-   surface->format = NULL;
-   surface->texture = NULL;
-   surface->feature_mask = 0;
-   surface->repeat = 0;
-   surface->transform = NULL;
-   surface->transforms = NULL;
-   surface->n_transforms = 0;
-   surface->anti_aliasing = 0;
    surface->filter = GLC_FILTER_NEAREST;
    surface->polyedge = GLC_POLYEDGE_SMOOTH;
-   surface->status_mask = 0;
-   surface->implicit_mask = 0;
-   surface->dirty = 0;
-   surface->requires_flipping = 1;
-   surface->convolution = NULL;
-   surface->clear_exterior = 0;
-   surface->programmatic = 0;
  }
  
--- 41,46 ----
***************
*** 71,82 ****
  
  glc_surface_t *
! glc_surface_create_similar (glc_surface_t *templ,
!                             glc_format_name_t format_name,
!                             int width,
!                             int height)
  {
!   glc_surface_t *surface =
!     templ->backend->create_similar (templ, format_name, width, height);
  
    if (surface)
      surface->polyedge = templ->polyedge;
--- 56,73 ----
  
  glc_surface_t *
! glc_int_surface_create_similar (glc_surface_t *templ,
!                                 glc_format_name_t format_name,
!                                 glc_bool_t drawable,
!                                 int width,
!                                 int height)
  {
!   glc_surface_t *surface;
  
+   if (width < 1 || height < 1)
+     return NULL;
+   
+   surface = templ->backend->create_similar (templ, format_name, drawable,
+                                             width, height);
+   
    if (surface)
      surface->polyedge = templ->polyedge;
***************
*** 86,89 ****
--- 77,90 ----
  
  glc_surface_t *
+ glc_surface_create_similar (glc_surface_t *templ,
+                             glc_format_name_t format_name,
+                             int width,
+                             int height)
+ {
+   return glc_int_surface_create_similar (templ, format_name, 0, width, height);
+ }
+ slim_hidden_def(glc_surface_create_similar);
+ 
+ glc_surface_t *
  glc_surface_create_solid (glc_color_t *color)
  {
***************
*** 142,147 ****
                              glc_texture_t *mask_texture)
  {
!   return
!     glc_program_enable (type, surface, src, mask, src_texture, mask_texture);
  }
  
--- 143,147 ----
                              glc_texture_t *mask_texture)
  {
!   glc_program_enable (type, surface, src, mask, src_texture, mask_texture);
  }
  
***************
*** 209,213 ****
    box->x2 = MAXSHORT;
    
!   if (surface->programmatic || surface->repeat || surface->transform)
      return;
      
--- 209,215 ----
    box->x2 = MAXSHORT;
    
!   if (SURFACE_PROGRAMMATIC (surface) ||
!       SURFACE_REPEAT (surface) ||
!       surface->transform)
      return;
      
***************
*** 230,234 ****
    };
  
!   if (surface->programmatic)
      return;
  
--- 232,236 ----
    };
  
!   if (SURFACE_PROGRAMMATIC (surface))
      return;
  
***************
*** 265,269 ****
                               glc_convolution_t *convolution)
  {
!   if (surface->programmatic)
      return;
    
--- 267,271 ----
                               glc_convolution_t *convolution)
  {
!   if (SURFACE_PROGRAMMATIC (surface))
      return;
    
***************
*** 311,318 ****
                          glc_bool_t repeat)
  {
!   if (surface->programmatic)
      return;
    
!   surface->repeat = repeat;
  }
  slim_hidden_def(glc_surface_set_repeat);
--- 313,320 ----
                          glc_bool_t repeat)
  {
!   if (SURFACE_PROGRAMMATIC (surface))
      return;
    
!   surface->hint_mask |= GLC_INT_HINT_REPEAT_MASK;
  }
  slim_hidden_def(glc_surface_set_repeat);
***************
*** 322,326 ****
                          glc_filter_t filter)
  {
!   if (surface->programmatic)
      return;
    
--- 324,328 ----
                          glc_filter_t filter)
  {
!   if (SURFACE_PROGRAMMATIC (surface))
      return;
    
***************
*** 340,345 ****
  glc_surface_get_width (glc_surface_t *surface)
  {
!   if (surface->programmatic)
!     return 1;
    
    return surface->width;
--- 342,347 ----
  glc_surface_get_width (glc_surface_t *surface)
  {
!   if (SURFACE_PROGRAMMATIC (surface))
!     return INT_MAX;
    
    return surface->width;
***************
*** 350,355 ****
  glc_surface_get_height (glc_surface_t *surface)
  {
!   if (surface->programmatic)
!     return 1;
    
    return surface->height;
--- 352,357 ----
  glc_surface_get_height (glc_surface_t *surface)
  {
!   if (SURFACE_PROGRAMMATIC (surface))
!     return INT_MAX;
    
    return surface->height;
***************
*** 364,372 ****
  
  void
! glc_surface_realize (glc_surface_t *surface)
  {
!   surface->backend->realize (surface);
  }
! slim_hidden_def(glc_surface_realize);
  
  static void
--- 366,374 ----
  
  void
! glc_surface_update_size (glc_surface_t *surface)
  {
!   surface->backend->update_size (surface);
  }
! slim_hidden_def(glc_surface_update_size);
  
  static void
***************
*** 393,403 ****
  
  void
! glc_surface_show (glc_surface_t *surface,
!                   int x,
!                   int y,
!                   unsigned int width,
!                   unsigned int height)
  {
!   if (surface->programmatic)
      return;
    
--- 395,405 ----
  
  void
! glc_surface_flush (glc_surface_t *surface,
!                    int x,
!                    int y,
!                    unsigned int width,
!                    unsigned int height)
  {
!   if (SURFACE_PROGRAMMATIC (surface))
      return;
    
***************
*** 406,410 ****
        (x + (int) width) >= surface->width &&
        (y + (int) height) >= surface->height) {
!     surface->backend->show (surface);
    } else if (width > 0 && height > 0) {
      if (x < 0) x = 0;
--- 408,412 ----
        (x + (int) width) >= surface->width &&
        (y + (int) height) >= surface->height) {
!     surface->backend->flush (surface);
    } else if (width > 0 && height > 0) {
      if (x < 0) x = 0;
***************
*** 429,433 ****
    }
  }
! slim_hidden_def(glc_surface_show);
  
  void
--- 431,435 ----
    }
  }
! slim_hidden_def(glc_surface_flush);
  
  void
***************
*** 440,444 ****
      surface->dirty_region.y2 = surface->height;
    } else {
!     if (!surface->dirty) {
        surface->dirty_region = *region;
      } else
--- 442,446 ----
      surface->dirty_region.y2 = surface->height;
    } else {
!     if (!SURFACE_DIRTY (surface)) {
        surface->dirty_region = *region;
      } else
***************
*** 448,452 ****
    }
    
!   surface->dirty = 1;
    
    glFlush ();
--- 450,454 ----
    }
    
!   surface->hint_mask |= GLC_INT_HINT_DIRTY_MASK;
    
    glFlush ();
***************
*** 488,492 ****
    glDisable (GL_POLYGON_SMOOTH);
    glShadeModel (GL_FLAT);
!   glColorMask (1, 1, 1, 1);
  }
  
--- 490,499 ----
    glDisable (GL_POLYGON_SMOOTH);
    glShadeModel (GL_FLAT);
!   glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
! 
!   if (surface->clip_mask)
!     glc_set_clip_operator (GLC_INT_CLIP_OPERATOR_CLIP, surface->clip_mask);
!   else
!     glDisable (GL_STENCIL_TEST);
  }
  
***************
*** 504,508 ****
    GLenum format, type;
  
!   if (surface->programmatic)
      return;
  
--- 511,515 ----
    GLenum format, type;
  
!   if (SURFACE_PROGRAMMATIC (surface))
      return;
  
***************
*** 577,581 ****
    int bytes_per_pixel;
  
!   if (surface->programmatic)
      return;
  
--- 584,588 ----
    int bytes_per_pixel;
  
!   if (SURFACE_PROGRAMMATIC (surface))
      return;
  
***************
*** 602,606 ****
      glc_set_operator (GLC_OPERATOR_SRC);
  
!     if (surface->requires_flipping)
        glPixelZoom (1.0, -1.0);
      
--- 609,613 ----
      glc_set_operator (GLC_OPERATOR_SRC);
  
!     if (!SURFACE_REQUIRES_NO_FLIPPING(surface))
        glPixelZoom (1.0, -1.0);
      
***************
*** 660,668 ****
      return;
  
!   if (!surface->programmatic) {
      glc_texture_bind (texture);
      glc_texture_ensure_filter (texture, surface->filter);
      glc_texture_ensure_repeat (texture,
!                                (surface->repeat && texture->repeatable));
      glc_texture_unbind (texture);
    }
--- 667,676 ----
      return;
  
!   if (!SURFACE_PROGRAMMATIC (surface)) {
      glc_texture_bind (texture);
      glc_texture_ensure_filter (texture, surface->filter);
      glc_texture_ensure_repeat (texture,
!                                (SURFACE_REPEAT (surface) &&
!                                 texture->repeatable));
      glc_texture_unbind (texture);
    }
***************
*** 709,715 ****
  
  unsigned long
! glc_surface_features (glc_surface_t *surface)
  {
    return surface->feature_mask;
  }
! slim_hidden_def(glc_surface_features);
--- 717,915 ----
  
  unsigned long
! glc_surface_get_features (glc_surface_t *surface)
  {
    return surface->feature_mask;
  }
! slim_hidden_def(glc_surface_get_features);
! 
! void
! glc_int_surface_clip_rectangles (glc_surface_t *surface,
!                                  glc_int_clip_operator_t op,
!                                  int mask,
!                                  const glc_rectangle_t *rects,
!                                  int n_rects)
! {
!   static glc_color_t color = { 0x0000, 0x0000, 0x0000, 0x0000 };
! 
!   if (n_rects == 0)
!     return;
! 
!   if ((op == GLC_INT_CLIP_OPERATOR_SET || op == GLC_INT_CLIP_OPERATOR_UNION) &&
!       (n_rects == 1 &&
!        rects->x <= 0 && rects->y <= 0 &&
!        rects->width >= surface->width &&
!        rects->height >= surface->height)) {
!     surface->clip_mask = 0x0;
!     return;
!   }
! 
!   if (surface->format->stencil_size < 1)
!     return;
! 
!   if (!glc_surface_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     glc_surface_pop_current (surface);
!     return;
!   }
! 
!   glc_set_clip_operator (op, mask);
!   
!   glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
! 
!   glc_int_fill_rectangles (GLC_OPERATOR_SRC,
!                            surface,
!                            &color,
!                            rects,
!                            n_rects);
!   
!   glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
!   
!   surface->clip_mask = mask;
! 
!   glc_surface_pop_current (surface);
! }
! 
! void
! glc_surface_clip_rectangles (glc_surface_t *surface,
!                              glc_clip_operator_t op,
!                              const glc_rectangle_t *rects,
!                              int n_rects)
! {
!   glc_int_surface_clip_rectangles (surface, (glc_int_clip_operator_t) op,
!                                    0x1, rects, n_rects);
! }
! slim_hidden_def(glc_surface_clip_rectangles);
! 
! void
! glc_int_surface_clip_trapezoids (glc_surface_t *surface,
!                                  glc_int_clip_operator_t op,
!                                  int mask,
!                                  const glc_trapezoid_t *traps,
!                                  int n_traps)
! {
!   static glc_color_t color = { 0x0000, 0x0000, 0x0000, 0x0000 };
! 
!   if (n_traps == 0)
!     return;
! 
!   if ((op == GLC_INT_CLIP_OPERATOR_SET || op == GLC_INT_CLIP_OPERATOR_UNION) &&
!       (n_traps == 1 &&
!        FIXED_TO_INT (traps->top) <= 0 &&
!        FIXED_TO_INT (traps->bottom) >= surface->height &&
!        FIXED_TO_INT (traps->left.p1.x) <= 0 &&
!        FIXED_TO_INT (traps->left.p2.x) <= 0 &&
!        FIXED_TO_INT (traps->right.p1.x) >= surface->width &&
!        FIXED_TO_INT (traps->right.p2.x) >= surface->width)) {
!     surface->clip_mask = 0x0;
!     return;
!   }
!   
!   if (surface->format->stencil_size < 1)
!     return;
! 
!   if (!glc_surface_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     glc_surface_pop_current (surface);
!     return;
!   }
! 
!   glc_set_clip_operator (op, mask);
!   
!   glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
! 
!   glc_int_fill_trapezoids (GLC_OPERATOR_SRC,
!                            surface,
!                            0, 0,
!                            &color,
!                            traps,
!                            n_traps);
!     
!   glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
! 
!   surface->clip_mask = mask;
! 
!   glc_surface_pop_current (surface);
! }
! 
! void
! glc_surface_clip_trapezoids (glc_surface_t *surface,
!                              glc_clip_operator_t op,
!                              const glc_trapezoid_t *traps,
!                              int n_traps)
! {
!   glc_int_surface_clip_trapezoids (surface, (glc_int_clip_operator_t) op,
!                                    0x1, traps, n_traps);
! }
! slim_hidden_def(glc_surface_clip_trapezoids);
! 
! void
! glc_int_surface_clip_triangles (glc_surface_t *surface,
!                                 glc_int_clip_operator_t op,
!                                 int mask,
!                                 glc_triangle_type_t type,
!                                 const glc_point_fixed_t *points,
!                                 int n_points)                               
! {
!   static glc_color_t color = { 0x0000, 0x0000, 0x0000, 0x0000 };
! 
!   if (n_points < 3)
!     return;
!   
!   if (surface->format->stencil_size < 1)
!     return;
! 
!   if (!glc_surface_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     glc_surface_pop_current (surface);
!     return;
!   }
!   
!   glc_set_clip_operator (op, mask);
!   
!   glColorMask (GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
! 
!   glc_int_fill_triangles (GLC_OPERATOR_SRC,
!                           surface,
!                           type,
!                           0, 0,
!                           &color,                        
!                           points,
!                           n_points);
!   
!   glColorMask (GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
! 
!   surface->clip_mask = mask;
! 
!   glc_surface_pop_current (surface);
! }
! 
! void
! glc_surface_clip_triangles (glc_surface_t *surface,
!                             glc_clip_operator_t op,
!                             const glc_triangle_t *tris,
!                             int n_tris)
! {
!   glc_int_surface_clip_triangles (surface, (glc_int_clip_operator_t) op, 0x1,
!                                   GLC_TRIANGLE_TYPE_NORMAL,
!                                   (glc_point_fixed_t *) tris, n_tris * 3);
! }
! slim_hidden_def(glc_surface_clip_triangles);
! 
! glc_format_t *
! glc_surface_get_format (glc_surface_t *surface)
! {
!   return surface->format;
! }
! slim_hidden_def(glc_surface_get_format);
! 
! unsigned long
! glc_surface_get_hints (glc_surface_t *surface)
! {
!   unsigned hint_mask;
! 
!   hint_mask = surface->hint_mask &
!     (GLC_HINT_OFFSCREEN_MASK | GLC_HINT_PROGRAMMATIC_MASK);
! 
!   if (surface->clip_mask)
!     hint_mask |= GLC_HINT_CLIPPING_MASK;
!   
!   return hint_mask;
! }
! slim_hidden_def(glc_surface_get_hints);

Index: glc_texture.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_texture.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** a/glc_texture.c	21 Mar 2004 13:41:03 -0000	1.13
--- b/glc_texture.c	27 Mar 2004 00:02:07 -0000	1.14
***************
*** 33,37 ****
  
  static void
! _glc_texture_find_best_target (int width, int height,
                                 long int target_mask,
                                 unsigned int *target)
--- 33,37 ----
  
  static void
! _glc_texture_find_best_target (unsigned int width, unsigned int height,
                                 long int target_mask,
                                 unsigned int *target)
***************
*** 40,45 ****
  
    if ((!(target_mask & GLC_TEXTURE_TARGET_2D_MASK)) ||
!       (!glc_int_is_power_of_two (width)) ||
!       (!glc_int_is_power_of_two (height))) {
      if (target_mask & GLC_TEXTURE_TARGET_RECTANGLE_MASK)
        *target = GL_TEXTURE_RECTANGLE_EXT;
--- 40,45 ----
  
    if ((!(target_mask & GLC_TEXTURE_TARGET_2D_MASK)) ||
!       (!glc_uint_is_power_of_two (width)) ||
!       (!glc_uint_is_power_of_two (height))) {
      if (target_mask & GLC_TEXTURE_TARGET_RECTANGLE_MASK)
        *target = GL_TEXTURE_RECTANGLE_EXT;
***************
*** 48,53 ****
  
  glc_texture_t *
! glc_texture_generate (int width,
!                       int height,
                        unsigned int texture_format,
                        long int target_mask)
--- 48,53 ----
  
  glc_texture_t *
! glc_texture_generate (unsigned int width,
!                       unsigned int height,
                        unsigned int texture_format,
                        long int target_mask)
***************
*** 71,76 ****
      
      if (texture->target == GL_TEXTURE_2D) {
!       glc_int_to_power_of_two (&texture->width);
!       glc_int_to_power_of_two (&texture->height);
      }
    } else
--- 71,76 ----
      
      if (texture->target == GL_TEXTURE_2D) {
!       glc_uint_to_power_of_two (&texture->width);
!       glc_uint_to_power_of_two (&texture->height);
      }
    } else
***************
*** 117,121 ****
  glc_texture_destroy (glc_texture_t *texture)
  { 
!   glDeleteTextures (1, (GLuint *) &texture->name);
    free (texture);
  }
--- 117,121 ----
  glc_texture_destroy (glc_texture_t *texture)
  { 
!   glDeleteTextures (1, &texture->name);
    free (texture);
  }

Index: glc_trap.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_trap.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** a/glc_trap.c	13 Mar 2004 23:44:29 -0000	1.15
--- b/glc_trap.c	27 Mar 2004 00:02:07 -0000	1.16
***************
*** 68,72 ****
    for (; n_traps; n_traps--, traps++) {
      int16_t x1, y1, x2, y2;
! 
      if (!TRAPEZOID_VALID (traps))
        continue;
--- 68,72 ----
    for (; n_traps; n_traps--, traps++) {
      int16_t x1, y1, x2, y2;
!     
      if (!TRAPEZOID_VALID (traps))
        continue;
***************
*** 96,99 ****
--- 96,171 ----
  
  void
+ glc_int_fill_trapezoids (glc_operator_t op,
+                          glc_surface_t *dst,
+                          int x_offset,
+                          int y_offset,
+                          const glc_color_t *color,
+                          const glc_trapezoid_t *traps,
+                          int n_traps)
+ {
+   if (SURFACE_IMPLICIT_MASK (dst)) {
+     glClearColor (0.0, 0.0, 0.0, 0.0);
+     glClear (GL_COLOR_BUFFER_BIT);
+   }
+ 
+   glColor4us (color->red, color->green, color->blue, color->alpha);
+ 
+   glc_set_operator (op);
+     
+   glBegin (GL_QUADS);
+   
+   for (; n_traps; n_traps--, traps++) {
+     double top, bottom;
+     
+     if (!TRAPEZOID_VALID (traps))
+       continue;
+     
+     top = y_offset + FIXED_TO_DOUBLE (traps->top);
+     bottom = y_offset + FIXED_TO_DOUBLE (traps->bottom);
+ 
+     glVertex2d (x_offset +
+                 FIXED_TO_DOUBLE (glc_line_fixed_x
+                                  (&traps->left, traps->top, 0)), top);
+     glVertex2d (x_offset +
+                 FIXED_TO_DOUBLE (glc_line_fixed_x
+                                  (&traps->right, traps->top, 1)), top);
+     glVertex2d (x_offset +
+                 FIXED_TO_DOUBLE (glc_line_fixed_x
+                                  (&traps->right, traps->bottom, 1)), bottom);
+     glVertex2d (x_offset +
+                 FIXED_TO_DOUBLE (glc_line_fixed_x
+                                  (&traps->left, traps->bottom, 0)), bottom);
+   }
+   
+   glEnd ();
+ }
+ 
+ void
+ glc_fill_trapezoids (glc_operator_t op,
+                      glc_surface_t *dst,
+                      const glc_color_t *color,
+                      const glc_trapezoid_t *traps,
+                      int n_traps)
+ {
+   glc_region_box_t bounds;
+   
+   glc_trapezoid_bounds (n_traps, traps, &bounds);
+   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
+       bounds.x2 < 0 || bounds.y2 < 0)
+     return;
+ 
+   if (!glc_surface_push_current (dst, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
+     glc_surface_pop_current (dst);
+     return;
+   }
+   
+   glc_int_fill_trapezoids (op, dst, 0, 0, color, traps, n_traps);
+ 
+   glc_surface_dirty (dst, &bounds);
+   glc_surface_pop_current (dst);
+ }
+ slim_hidden_def(glc_fill_trapezoids);
+ 
+ void
  glc_composite_trapezoids (glc_operator_t op,
                            glc_surface_t *src,
***************
*** 105,111 ****
  {
    glc_surface_t *mask;
!   glc_region_box_t trap_bounds, src_bounds, dst_bounds, bounds;
!   double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
  
    if (n_traps == 0)
--- 177,185 ----
  {
    glc_surface_t *mask;
!   glc_region_box_t trap_bounds;
!   glc_bool_t use_mask;
    int x_dst, y_dst;
+   int x_offset, y_offset;
+   int width, height;
  
    if (n_traps == 0)
***************
*** 115,204 ****
    y_dst = traps[0].left.p1.y >> 16;
  
!   glc_trapezoid_bounds (n_traps, traps, &trap_bounds);
!   glc_surface_bounds (src, &src_bounds);
!   glc_surface_bounds (dst, &dst_bounds);
! 
!   src_bounds.x1 += (x_dst - x_src);
!   src_bounds.y1 += (y_dst - y_src);
!   src_bounds.x2 += (x_dst - x_src);
!   src_bounds.y2 += (y_dst - y_src);
  
!   glc_intersect_region (&src_bounds, &trap_bounds, &bounds);
!   glc_intersect_region (&dst_bounds, &bounds, &bounds);
  
!   if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
!     return;
!   
!   x_draw_offset = (double) -bounds.x1;
!   y_draw_offset = (double) -bounds.y1;
!   
!   mask = glc_surface_create_similar (dst, GLC_STANDARD_A8,
!                                      bounds.x2 - bounds.x1,
!                                      bounds.y2 - bounds.y1);
!   
!   if (!mask) {
!     glc_surface_status_add (dst, GLC_STATUS_NOT_SUPPORTED_MASK);
!     return;
!   }
  
!   mask->implicit_mask = 1;
  
!   if (!glc_surface_push_current (mask, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     glc_surface_pop_current (mask);
!     return;
!   }
!   
!   glClearColor (0.0, 0.0, 0.0, 0.0);
!   glClear (GL_COLOR_BUFFER_BIT);
!   glColor4f (1.0, 1.0, 1.0, 1.0);
  
!   glc_set_operator (GLC_OPERATOR_SRC);
  
!   if (mask->polyedge == GLC_POLYEDGE_SMOOTH) {
!     if (!mask->anti_aliasing) {
!       glEnable (GL_POLYGON_SMOOTH);
!       glEnable (GL_BLEND);
!       glHint (GL_POLYGON_SMOOTH, GL_NICEST);
!       glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);
      }
-   }
  
!   glBegin (GL_QUADS);
  
!   for (; n_traps; n_traps--, traps++) {
!     double top, bottom;
      
!     if (!TRAPEZOID_VALID (traps))
!       continue;
      
!     top =  y_draw_offset + FIXED_TO_DOUBLE (traps->top);
!     bottom =  y_draw_offset + FIXED_TO_DOUBLE (traps->bottom);
! 
!     glVertex2d (x_draw_offset +
!                 FIXED_TO_DOUBLE (glc_line_fixed_x
!                                  (&traps->left, traps->top, 0)), top);
!     glVertex2d (x_draw_offset +
!                 FIXED_TO_DOUBLE (glc_line_fixed_x
!                                  (&traps->right, traps->top, 1)), top);
!     glVertex2d (x_draw_offset +
!                 FIXED_TO_DOUBLE (glc_line_fixed_x
!                                  (&traps->right, traps->bottom, 1)), bottom);
!     glVertex2d (x_draw_offset +
!                 FIXED_TO_DOUBLE (glc_line_fixed_x
!                                  (&traps->left, traps->bottom, 0)), bottom);
!   }
  
!   glEnd ();
  
!   if (mask->polyedge == GLC_POLYEDGE_SMOOTH) {
!     if (!mask->anti_aliasing) {
!       glDisable (GL_POLYGON_SMOOTH);
!       glDisable (GL_BLEND);
!     }
    }
! 
!   glc_surface_dirty (mask, NULL);
!   glc_surface_pop_current (mask);
! 
    glc_composite (op,
                   src,
--- 189,270 ----
    y_dst = traps[0].left.p1.y >> 16;
  
!   if (dst->format->stencil_size > dst->clip_mask)
!     use_mask = 0;
!   else
!     use_mask = 1;
  
!   glc_trapezoid_bounds (n_traps, traps, &trap_bounds);
  
!   if (use_mask) {
!     glc_region_box_t src_bounds, dst_bounds, bounds;
!     static glc_color_t color = { 0xffff, 0xffff, 0xffff, 0xffff };
!     
!     glc_surface_bounds (src, &src_bounds);
!     glc_surface_bounds (dst, &dst_bounds);
  
!     src_bounds.x1 += (x_dst - x_src);
!     src_bounds.y1 += (y_dst - y_src);
!     src_bounds.x2 += (x_dst - x_src);
!     src_bounds.y2 += (y_dst - y_src);
  
!     glc_intersect_region (&src_bounds, &trap_bounds, &bounds);
!     glc_intersect_region (&dst_bounds, &bounds, &bounds);
  
!     if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
!       return;
!     
!     mask = glc_int_surface_create_similar (dst, GLC_STANDARD_A8,
!                                            1,
!                                            bounds.x2 - bounds.x1,
!                                            bounds.y2 - bounds.y1);
!     
!     if (!mask) {
!       glc_surface_status_add (dst, GLC_STATUS_NOT_SUPPORTED_MASK);
!       return;
!     }
!     
!     mask->hint_mask |= GLC_INT_HINT_IMPLICIT_MASK_MASK;
  
!     if (!glc_surface_push_current (mask, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!       glc_surface_pop_current (mask);
!       return;
      }
  
!     glc_int_fill_trapezoids (GLC_OPERATOR_SRC,
!                              mask, -bounds.x1, -bounds.y1,
!                              &color, traps, n_traps);
  
!     glc_surface_dirty (mask, NULL);
!     glc_surface_pop_current (mask);
      
!     x_offset = bounds.x1;
!     y_offset = bounds.y1;
!     width = mask->width;
!     height = mask->height;
!   } else {
!     glc_int_clip_operator_t clip_op;
      
!     if (trap_bounds.x1 > dst->width || trap_bounds.y1 > dst->height ||
!         trap_bounds.x2 < 0 || trap_bounds.y2 < 0)
!       return;
  
!     if (dst->clip_mask)
!       clip_op = GLC_INT_CLIP_OPERATOR_INCR_INTERSECT;
!     else
!       clip_op = GLC_INT_CLIP_OPERATOR_SET;
  
!     glc_int_surface_clip_trapezoids (dst,
!                                      clip_op,
!                                      dst->clip_mask + 0x1,
!                                      traps,
!                                      n_traps);
!     
!     x_offset = trap_bounds.x1;
!     y_offset = trap_bounds.y1;
!     width = trap_bounds.x2 - trap_bounds.x1;
!     height = trap_bounds.y2 - trap_bounds.y1;
!     mask = NULL;
    }
!   
    glc_composite (op,
                   src,
***************
*** 208,215 ****
                   y_src + trap_bounds.y1 - y_dst,
                   0, 0,
!                  bounds.x1, bounds.y1,
!                  mask->width, mask->height);              
!   
!   glc_surface_destroy (mask);
  }
  slim_hidden_def(glc_composite_trapezoids);
--- 274,296 ----
                   y_src + trap_bounds.y1 - y_dst,
                   0, 0,
!                  x_offset, y_offset,
!                  width, height);
! 
!   if (use_mask) {
!     glc_surface_destroy (mask);
!   } else {
!     glc_int_clip_operator_t clip_op;
!     static glc_rectangle_t rect = { 0, 0, MAXSHORT, MAXSHORT };
!     
!     if (dst->clip_mask > 0x1)
!       clip_op = GLC_INT_CLIP_OPERATOR_DECR_INTERSECT;
!     else
!       clip_op = GLC_INT_CLIP_OPERATOR_SET;
! 
!     glc_int_surface_clip_rectangles (dst,
!                                      clip_op,
!                                      dst->clip_mask - 0x1,
!                                      &rect, 1);
!   }
  }
  slim_hidden_def(glc_composite_trapezoids);
***************
*** 274,279 ****
    glc_set_operator (op);
  
-   glShadeModel (GL_FLAT);
- 
    for (index = 0; index < n_color_traps; index++) {
      
--- 355,358 ----
***************
*** 333,338 ****
    
    glEnd ();
-   
-   glShadeModel (GL_FLAT);
  
    glc_surface_dirty (dst, &bounds);
--- 412,415 ----

Index: glc_tri.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_tri.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** a/glc_tri.c	13 Mar 2004 23:44:29 -0000	1.13
--- b/glc_tri.c	27 Mar 2004 00:02:07 -0000	1.14
***************
*** 58,61 ****
--- 58,62 ----
      else if (y2 > box->y2)
        box->y2 = y2;
+     
      points++;
    }
***************
*** 63,255 ****
  
  void
! glc_composite_triangles (glc_operator_t op,
!                          glc_surface_t *src,
!                          glc_surface_t *dst,
!                          int x_src,
!                          int y_src,
!                          const glc_triangle_t *tris,
!                          int n_tris)
  {
!   glc_surface_t *mask;
!   glc_region_box_t tri_bounds, src_bounds, dst_bounds, bounds;
!   double x_draw_offset, y_draw_offset;
!   int x_dst, y_dst;
! 
!   x_dst = tris[0].p1.x >> 16;
!   y_dst = tris[0].p1.y >> 16;
! 
!   glc_point_fixed_bounds (n_tris * 3, (glc_point_fixed_t *) tris, &tri_bounds);
!   glc_surface_bounds (src, &src_bounds);
!   glc_surface_bounds (dst, &dst_bounds);
! 
!   src_bounds.x1 += (x_dst - x_src);
!   src_bounds.y1 += (y_dst - y_src);
!   src_bounds.x2 += (x_dst - x_src);
!   src_bounds.y2 += (y_dst - y_src);
! 
!   glc_intersect_region (&src_bounds, &tri_bounds, &bounds);
!   glc_intersect_region (&dst_bounds, &bounds, &bounds);
! 
!   if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
!     return;
!   
!   x_draw_offset = (double) -bounds.x1;
!   y_draw_offset = (double) -bounds.y1;
!   
!   mask = glc_surface_create_similar (dst, GLC_STANDARD_A8,
!                                      bounds.x2 - bounds.x1,
!                                      bounds.y2 - bounds.y1);
!   
!   if (!mask) {
!     glc_surface_status_add (dst, GLC_STATUS_NOT_SUPPORTED_MASK);
!     return;
!   }
! 
!   mask->implicit_mask = 1;
! 
!   if (!glc_surface_push_current (mask, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     glc_surface_pop_current (mask);
!     return;
    }
  
!   glClearColor (0.0, 0.0, 0.0, 0.0);
!   glClear (GL_COLOR_BUFFER_BIT);
!   glColor4f (1.0, 1.0, 1.0, 1.0);
  
!   glc_set_operator (GLC_OPERATOR_SRC);
  
!   if (mask->polyedge == GLC_POLYEDGE_SMOOTH) {
!     if (!mask->anti_aliasing) {
!       glEnable (GL_POLYGON_SMOOTH);
!       glEnable (GL_BLEND);
!       glHint(GL_POLYGON_SMOOTH, GL_NICEST);
!       glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);
!     }
!   }
!   
!   glBegin (GL_TRIANGLES);
!   
!   for (; n_tris; n_tris--, tris++) {
!     glVertex2d (x_draw_offset + FIXED_TO_DOUBLE (tris->p1.x),
!                 y_draw_offset + FIXED_TO_DOUBLE (tris->p1.y));
!     glVertex2d (x_draw_offset + FIXED_TO_DOUBLE (tris->p2.x),
!                 y_draw_offset + FIXED_TO_DOUBLE (tris->p2.y));
!     glVertex2d (x_draw_offset + FIXED_TO_DOUBLE (tris->p3.x),
!                 y_draw_offset + FIXED_TO_DOUBLE (tris->p3.y));
    }
    
    glEnd ();
  
!   if (mask->polyedge == GLC_POLYEDGE_SMOOTH) {
!     if (!mask->anti_aliasing) {
!       glDisable (GL_POLYGON_SMOOTH);
!       glDisable (GL_BLEND);
!     }
    }
  
!   glc_surface_dirty (mask, NULL);
!   glc_surface_pop_current (mask);
  
!   glc_composite (op,
!                  src,
!                  mask,
!                  dst,
!                  x_src + tri_bounds.x1 - x_dst,
!                  y_src + tri_bounds.y1 - y_dst,
!                  0, 0,
!                  bounds.x1, bounds.y1,
!                  mask->width, mask->height);
!   
!   glc_surface_destroy (mask);
  }
! slim_hidden_def(glc_composite_triangles);
!      
! void
! glc_composite_tri_strip (glc_operator_t op,
!                          glc_surface_t *src,
!                          glc_surface_t *dst,
!                          int x_src,
!                          int y_src,
!                          const glc_point_fixed_t *points,
!                          int n_points)
  {
    glc_surface_t *mask;
!   glc_region_box_t tri_bounds, src_bounds, dst_bounds, bounds;
!   double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
! 
!   if (n_points < 3)
!     return;
  
    x_dst = points[0].x >> 16;
    y_dst = points[0].y >> 16;
  
    glc_point_fixed_bounds (n_points, points, &tri_bounds);
-   glc_surface_bounds (src, &src_bounds);
-   glc_surface_bounds (dst, &dst_bounds);
  
!   src_bounds.x1 += (x_dst - x_src);
!   src_bounds.y1 += (y_dst - y_src);
!   src_bounds.x2 += (x_dst - x_src);
!   src_bounds.y2 += (y_dst - y_src);
  
!   glc_intersect_region (&src_bounds, &tri_bounds, &bounds);
!   glc_intersect_region (&dst_bounds, &bounds, &bounds);
  
!   if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
!     return;
!   
!   x_draw_offset = (double) -bounds.x1;
!   y_draw_offset = (double) -bounds.y1;
    
!   mask = glc_surface_create_similar (dst, GLC_STANDARD_A8,
!                                      bounds.x2 - bounds.x1,
!                                      bounds.y2 - bounds.y1);
    
!   if (!mask) {
!     glc_surface_status_add (dst, GLC_STATUS_NOT_SUPPORTED_MASK);
!     return;
!   }
! 
!   mask->implicit_mask = 1;
  
!   if (!glc_surface_push_current (mask, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     glc_surface_pop_current (mask);
!     return;
!   }
  
!   glClearColor (0.0, 0.0, 0.0, 0.0);
!   glClear (GL_COLOR_BUFFER_BIT);
!   glColor4f (1.0, 1.0, 1.0, 1.0);
  
!   glc_set_operator (GLC_OPERATOR_SRC);
  
!   if (mask->polyedge == GLC_POLYEDGE_SMOOTH) {
!     if (!mask->anti_aliasing) {
!       glEnable (GL_POLYGON_SMOOTH);
!       glEnable (GL_BLEND);
!       glHint(GL_POLYGON_SMOOTH, GL_NICEST);
!       glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);
!     }
!   }
  
!   glBegin (GL_TRIANGLE_STRIP);
!   
!   for (; n_points; n_points--, points++)
!     glVertex2d (x_draw_offset + FIXED_TO_DOUBLE (points->x),
!                 y_draw_offset + FIXED_TO_DOUBLE (points->y));
!   
!   glEnd ();
  
!   if (mask->polyedge == GLC_POLYEDGE_SMOOTH) {
!     if (!mask->anti_aliasing) {
!       glDisable (GL_POLYGON_SMOOTH);
!       glDisable (GL_BLEND);
!     }
    }
  
-   glc_surface_dirty (mask, NULL);
-   glc_surface_pop_current (mask);
-   
    glc_composite (op,
                   src,
--- 64,237 ----
  
  void
! glc_int_fill_triangles (glc_operator_t op,
!                         glc_surface_t *dst,
!                         glc_triangle_type_t type,
!                         int x_offset,
!                         int y_offset,
!                         const glc_color_t *color,
!                         const glc_point_fixed_t *points,
!                         int n_points)
  {
!   if (SURFACE_IMPLICIT_MASK (dst)) {
!     glClearColor (0.0, 0.0, 0.0, 0.0);
!     glClear (GL_COLOR_BUFFER_BIT);
    }
  
!   glColor4us (color->red, color->green, color->blue, color->alpha);
  
!   glc_set_operator (op);
  
!   switch (type) {
!   case GLC_TRIANGLE_TYPE_NORMAL:
!     glBegin (GL_TRIANGLES);
!     break;
!   case GLC_TRIANGLE_TYPE_STRIP:
!     glBegin (GL_TRIANGLE_STRIP);
!     break;
!   case GLC_TRIANGLE_TYPE_FAN:
!     glBegin (GL_TRIANGLE_FAN);
!     break;
    }
+ 
+   for (; n_points; n_points--, points++)
+     glVertex2d (x_offset + FIXED_TO_DOUBLE (points->x),
+                 y_offset + FIXED_TO_DOUBLE (points->y));
    
    glEnd ();
+ }
  
! void
! glc_fill_triangles (glc_operator_t op,
!                     glc_surface_t *dst,
!                     const glc_color_t *color,
!                     const glc_triangle_t *tris,
!                     int n_tris)
! {
!   glc_region_box_t bounds;
!   
!   glc_point_fixed_bounds (n_tris * 3, (glc_point_fixed_t *) tris, &bounds);
!   if (bounds.x1 > dst->width || bounds.y1 > dst->height ||
!       bounds.x2 < 0 || bounds.y2 < 0)
!     return;
!     
!   if (!glc_surface_push_current (dst, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     glc_surface_pop_current (dst);
!     return;
    }
  
!   glc_int_fill_triangles (op,
!                           dst,
!                           GLC_TRIANGLE_TYPE_NORMAL,
!                           0, 0,
!                           color,
!                           (glc_point_fixed_t *) tris,
!                           n_tris * 3);
  
!   glc_surface_dirty (dst, &bounds);  
!   glc_surface_pop_current (dst);
  }
! slim_hidden_def(glc_fill_triangles);
! 
! static void
! glc_int_composite_triangles (glc_operator_t op,
!                              glc_surface_t *src,
!                              glc_surface_t *dst,
!                              int x_src,
!                              int y_src,
!                              glc_triangle_type_t type,
!                              const glc_point_fixed_t *points,
!                              int n_points)
  {
    glc_surface_t *mask;
!   glc_region_box_t tri_bounds;
!   glc_bool_t use_mask;
    int x_dst, y_dst;
!   int x_offset, y_offset;
!   int width, height;
  
    x_dst = points[0].x >> 16;
    y_dst = points[0].y >> 16;
  
+   if (dst->format->stencil_size > dst->clip_mask)
+     use_mask = 0;
+   else
+     use_mask = 1;
+ 
    glc_point_fixed_bounds (n_points, points, &tri_bounds);
  
!   if (use_mask) {
!     glc_region_box_t src_bounds, dst_bounds, bounds;
!     static glc_color_t color = { 0xffff, 0xffff, 0xffff, 0xffff };
!     
!     glc_surface_bounds (src, &src_bounds);
!     glc_surface_bounds (dst, &dst_bounds);
  
!     src_bounds.x1 += (x_dst - x_src);
!     src_bounds.y1 += (y_dst - y_src);
!     src_bounds.x2 += (x_dst - x_src);
!     src_bounds.y2 += (y_dst - y_src);
  
!     glc_intersect_region (&src_bounds, &tri_bounds, &bounds);
!     glc_intersect_region (&dst_bounds, &bounds, &bounds);
! 
!     if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
!       return;
    
!     mask = glc_int_surface_create_similar (dst, GLC_STANDARD_A8,
!                                            1,
!                                            bounds.x2 - bounds.x1,
!                                            bounds.y2 - bounds.y1);
    
!     if (!mask) {
!       glc_surface_status_add (dst, GLC_STATUS_NOT_SUPPORTED_MASK);
!       return;
!     }
!     
!     mask->hint_mask |= GLC_INT_HINT_IMPLICIT_MASK_MASK;
  
!     if (!glc_surface_push_current (mask, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!       glc_surface_pop_current (mask);
!       return;
!     }
  
!     glc_int_fill_triangles (GLC_OPERATOR_SRC,
!                             mask,
!                             type,
!                             -bounds.x1, -bounds.y1,
!                             &color, points, n_points);
  
!     glc_surface_dirty (mask, NULL);
!     glc_surface_pop_current (mask);
  
!     x_offset = bounds.x1;
!     y_offset = bounds.y1;
!     width = mask->width;
!     height = mask->height;
!   } else {
!     glc_int_clip_operator_t clip_op;
!     
!     if (tri_bounds.x1 > dst->width || tri_bounds.y1 > dst->height ||
!         tri_bounds.x2 < 0 || tri_bounds.y2 < 0)
!       return;
  
!     if (dst->clip_mask)
!       clip_op = GLC_INT_CLIP_OPERATOR_INCR_INTERSECT;
!     else
!       clip_op = GLC_INT_CLIP_OPERATOR_SET;
  
!     glc_int_surface_clip_triangles (dst,
!                                     clip_op,
!                                     dst->clip_mask + 0x1,
!                                     type,
!                                     points,
!                                     n_points);
!     
!     x_offset = tri_bounds.x1;
!     y_offset = tri_bounds.y1;
!     width = tri_bounds.x2 - tri_bounds.x1;
!     height = tri_bounds.y2 - tri_bounds.y1;
!     mask = NULL;
    }
  
    glc_composite (op,
                   src,
***************
*** 259,266 ****
                   y_src + tri_bounds.y1 - y_dst,
                   0, 0,
!                  bounds.x1, bounds.y1,
!                  mask->width, mask->height);
  
!   glc_surface_destroy (mask);
  }
  slim_hidden_def(glc_composite_tri_strip);
--- 241,293 ----
                   y_src + tri_bounds.y1 - y_dst,
                   0, 0,
!                  x_offset, y_offset,
!                  width, height);
  
!   if (use_mask) {
!     glc_surface_destroy (mask);
!   } else {
!     glc_int_clip_operator_t clip_op;
!     static glc_rectangle_t rect = { 0, 0, MAXSHORT, MAXSHORT };
!     
!     if (dst->clip_mask > 0x1)
!       clip_op = GLC_INT_CLIP_OPERATOR_DECR_INTERSECT;
!     else
!       clip_op = GLC_INT_CLIP_OPERATOR_SET;
! 
!     glc_int_surface_clip_rectangles (dst,
!                                      clip_op,
!                                      dst->clip_mask - 0x1,
!                                      &rect, 1);
!   }
! }
! 
! void
! glc_composite_triangles (glc_operator_t op,
!                          glc_surface_t *src,
!                          glc_surface_t *dst,
!                          int x_src,
!                          int y_src,
!                          const glc_triangle_t *tris,
!                          int n_tris)
! {
!   glc_int_composite_triangles (op, src, dst, x_src, y_src,
!                                GLC_TRIANGLE_TYPE_NORMAL,
!                                (glc_point_fixed_t *) tris,
!                                n_tris * 3);
! }
! slim_hidden_def(glc_composite_triangles);
!      
! void
! glc_composite_tri_strip (glc_operator_t op,
!                          glc_surface_t *src,
!                          glc_surface_t *dst,
!                          int x_src,
!                          int y_src,
!                          const glc_point_fixed_t *points,
!                          int n_points)
! {
!   glc_int_composite_triangles (op, src, dst, x_src, y_src,
!                                GLC_TRIANGLE_TYPE_STRIP,
!                                points, n_points);
  }
  slim_hidden_def(glc_composite_tri_strip);
***************
*** 275,367 ****
                         int n_points)
  {
!   glc_surface_t *mask;
!   glc_region_box_t tri_bounds, src_bounds, dst_bounds, bounds;
!   double x_draw_offset, y_draw_offset;
!   int x_dst, y_dst;
! 
!   if (n_points < 3)
!     return;
! 
!   x_dst = points[0].x >> 16;
!   y_dst = points[0].y >> 16;
! 
!   glc_point_fixed_bounds (n_points, points, &tri_bounds);
!   glc_surface_bounds (src, &src_bounds);
!   glc_surface_bounds (dst, &dst_bounds);
! 
!   src_bounds.x1 += (x_dst - x_src);
!   src_bounds.y1 += (y_dst - y_src);
!   src_bounds.x2 += (x_dst - x_src);
!   src_bounds.y2 += (y_dst - y_src);
! 
!   glc_intersect_region (&src_bounds, &tri_bounds, &bounds);
!   glc_intersect_region (&dst_bounds, &bounds, &bounds);
! 
!   if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
!     return;
!   
!   x_draw_offset = (double) -bounds.x1;
!   y_draw_offset = (double) -bounds.y1;
!   
!   mask = glc_surface_create_similar (dst, GLC_STANDARD_A8,
!                                      bounds.x2 - bounds.x1,
!                                      bounds.y2 - bounds.y1);
!   
!   if (!mask) {
!     glc_surface_status_add (dst, GLC_STATUS_NOT_SUPPORTED_MASK);
!     return;
!   }
!   
!   mask->implicit_mask = 1;
! 
!   if (!glc_surface_push_current (mask, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     glc_surface_pop_current (mask);
!     return;
!   }
! 
!   glClearColor (0.0, 0.0, 0.0, 0.0);
!   glClear (GL_COLOR_BUFFER_BIT);
!   glColor4f (1.0, 1.0, 1.0, 1.0);
! 
!   glc_set_operator (GLC_OPERATOR_SRC);
! 
!   if (mask->polyedge == GLC_POLYEDGE_SMOOTH) {
!     if (!mask->anti_aliasing) {
!       glEnable (GL_POLYGON_SMOOTH);
!       glEnable (GL_BLEND);
!       glHint(GL_POLYGON_SMOOTH, GL_NICEST);
!       glBlendFunc (GL_SRC_ALPHA_SATURATE, GL_ONE);
!     }
!   }
!   
!   glBegin (GL_TRIANGLE_FAN);
! 
!   for (; n_points; n_points--, points++)
!     glVertex2d (x_draw_offset + FIXED_TO_DOUBLE (points->x),
!                 y_draw_offset + FIXED_TO_DOUBLE (points->y));
!   
!   glEnd ();
! 
!   if (mask->polyedge == GLC_POLYEDGE_SMOOTH) {
!     if (!mask->anti_aliasing) {
!       glDisable (GL_POLYGON_SMOOTH);
!       glDisable (GL_BLEND);
!     }
!   }
! 
!   glc_surface_dirty (mask, NULL);
!   glc_surface_pop_current (mask);
! 
!   glc_composite (op,
!                  src,
!                  mask,
!                  dst,
!                  x_src + tri_bounds.x1 - x_dst,
!                  y_src + tri_bounds.y1 - y_dst,
!                  0, 0,
!                  bounds.x1, bounds.y1,
!                  mask->width, mask->height);
! 
!   glc_surface_destroy (mask);
  }
  slim_hidden_def(glc_composite_tri_fan);
--- 302,308 ----
                         int n_points)
  {
!   glc_int_composite_triangles (op, src, dst, x_src, y_src,
!                                GLC_TRIANGLE_TYPE_FAN,
!                                points, n_points);
  }
  slim_hidden_def(glc_composite_tri_fan);
***************
*** 446,450 ****
    glc_set_operator (op);
  
-   glShadeModel (GL_FLAT);
    for (index = 0; index < n_color_tris; index++) {
      if (memcmp (&color_tris[index].p1.color,
--- 387,390 ----
***************
*** 487,492 ****
    glEnd ();
  
-   glShadeModel (GL_FLAT);
- 
    glc_surface_dirty (dst, &bounds);
    glc_surface_pop_current (dst);
--- 427,430 ----

Index: glc_util.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_util.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** a/glc_util.c	21 Mar 2004 13:41:03 -0000	1.10
--- b/glc_util.c	27 Mar 2004 00:02:07 -0000	1.11
***************
*** 171,177 ****
  
  glc_bool_t
! glc_int_is_power_of_two (int value)
  {
!   int x = 1;
    
    while (x < value)
--- 171,177 ----
  
  glc_bool_t
! glc_uint_is_power_of_two (unsigned int value)
  {
!   unsigned int x = 1;
    
    while (x < value)
***************
*** 182,188 ****
  
  void
! glc_int_to_power_of_two (int *value)
  {
!   int x = 1;
    
    while (x < *value)
--- 182,188 ----
  
  void
! glc_uint_to_power_of_two (unsigned int *value)
  {
!   unsigned int x = 1;
    
    while (x < *value)

Index: glcint.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glcint.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** a/glcint.h	21 Mar 2004 13:41:03 -0000	1.27
--- b/glcint.h	27 Mar 2004 00:02:07 -0000	1.28
***************
*** 33,36 ****
--- 33,39 ----
  #include <limits.h>
  
+ #define LIBGLC_USE_GLX_BACKEND
+ #define LIBGLC_USE_AGL_BACKEND
+ 
  #include "glc.h"
  
***************
*** 77,81 ****
  #define GLC_TEXTURE_TARGET_NPOT_MASK      (1L << 2)
  
! #define GLC_FORMAT_ALL_EXCEPT_ID_MASK ((1 << 16) - 2)
  
  #ifdef LIBGLC_HAS_AGL_BACKEND
--- 80,84 ----
  #define GLC_TEXTURE_TARGET_NPOT_MASK      (1L << 2)
  
! #define GLC_FORMAT_ALL_EXCEPT_ID_MASK ((1L << 17) - 2)
  
  #ifdef LIBGLC_HAS_AGL_BACKEND
***************
*** 152,155 ****
--- 155,164 ----
  } glc_constraint_t;
  
+ typedef enum {
+   GLC_TRIANGLE_TYPE_NORMAL,
+   GLC_TRIANGLE_TYPE_STRIP,
+   GLC_TRIANGLE_TYPE_FAN
+ } glc_triangle_type_t;
+ 
  typedef struct _glc_region_box_t {
    int x1, x2, y1, y2;
***************
*** 169,173 ****
  
  typedef struct _glc_texture {
!   unsigned int name;
    unsigned int target;
    unsigned int format;
--- 178,182 ----
  
  typedef struct _glc_texture {
!   GLuint name;
    unsigned int target;
    unsigned int format;
***************
*** 177,182 ****
    glc_bool_t repeat;
    
!   int width;
!   int height;
  
    double texcoord_width;
--- 186,191 ----
    glc_bool_t repeat;
    
!   unsigned int width;
!   unsigned int height;
  
    double texcoord_width;
***************
*** 190,193 ****
--- 199,203 ----
    (*create_similar) (void *surface,
                       glc_format_name_t format_name,
+                      glc_bool_t drawable,
                       int width,
                       int height);
***************
*** 207,216 ****
    
    void
!   (*realize) (void *surface);
  
    void
!   (*show) (void *surface);
  } glc_surface_backend_t;
  
  struct _glc_surface {
    const glc_surface_backend_t *backend;
--- 217,250 ----
    
    void
!   (*update_size) (void *surface);
  
    void
!   (*flush) (void *surface);
  } glc_surface_backend_t;
  
+ #define GLC_INT_HINT_REPEAT_MASK               (1L << 4)
+ #define GLC_INT_HINT_IMPLICIT_MASK_MASK        (1L << 5)
+ #define GLC_INT_HINT_DIRTY_MASK                (1L << 6)
+ #define GLC_INT_HINT_REQUIRES_NO_FLIPPING_MASK (1L << 7)
+ #define GLC_INT_HINT_CLEAR_EXTERIOR_MASK       (1L << 8)
+ 
+ #define SURFACE_PROGRAMMATIC(surface) \
+   (surface->hint_mask & GLC_HINT_PROGRAMMATIC_MASK)
+ 
+ #define SURFACE_REPEAT(surface) \
+   (surface->hint_mask & GLC_INT_HINT_REPEAT_MASK)
+ 
+ #define SURFACE_IMPLICIT_MASK(surface) \
+   (surface->hint_mask & GLC_INT_HINT_IMPLICIT_MASK_MASK)
+ 
+ #define SURFACE_DIRTY(surface) \
+   (surface->hint_mask & GLC_INT_HINT_DIRTY_MASK)
+ 
+ #define SURFACE_REQUIRES_NO_FLIPPING(surface) \
+   (surface->hint_mask & GLC_INT_HINT_REQUIRES_NO_FLIPPING_MASK)
+ 
+ #define SURFACE_CLEAR_EXTERIOR(surface) \
+   (surface->hint_mask & GLC_INT_HINT_CLEAR_EXTERIOR_MASK)
+ 
  struct _glc_surface {
    const glc_surface_backend_t *backend;
***************
*** 218,240 ****
    glc_format_t *format;
    glc_texture_t *texture;
!   long int status_mask;
!   long int feature_mask;
    glc_filter_t filter;
-   glc_bool_t repeat;
    glc_polyedge_t polyedge;
    glc_matrix_t *transform;
    glc_matrix_t *transforms;
    unsigned int n_transforms;
-   glc_bool_t anti_aliasing;
    int width, height;
-   glc_bool_t implicit_mask;
-   glc_bool_t dirty;
    glc_region_box_t dirty_region;
-   glc_bool_t requires_flipping;
    glc_gl_proc_address_list_t *proc_address;
    glc_programs_t *programs;
    glc_matrix_t *convolution;
!   glc_bool_t clear_exterior;
!   glc_bool_t programmatic;
  };
  
--- 252,269 ----
    glc_format_t *format;
    glc_texture_t *texture;
!   unsigned long status_mask;
!   unsigned long feature_mask;
    glc_filter_t filter;
    glc_polyedge_t polyedge;
    glc_matrix_t *transform;
    glc_matrix_t *transforms;
    unsigned int n_transforms;
    int width, height;
    glc_region_box_t dirty_region;
    glc_gl_proc_address_list_t *proc_address;
    glc_programs_t *programs;
    glc_matrix_t *convolution;
!   unsigned int clip_mask;
!   unsigned long hint_mask;
  };
  
***************
*** 247,251 ****
    unsigned char *data;
    unsigned int size;
!   unsigned int texture;
    glc_filter_t filter;
    glc_extend_t extend;
--- 276,280 ----
    unsigned char *data;
    unsigned int size;
!   GLuint texture;
    glc_filter_t filter;
    glc_extend_t extend;
***************
*** 308,311 ****
--- 337,353 ----
  glc_set_operator (glc_operator_t op);
  
+ typedef enum glc_int_clip_operator {
+   GLC_INT_CLIP_OPERATOR_SET = GLC_CLIP_OPERATOR_SET,
+   GLC_INT_CLIP_OPERATOR_UNION = GLC_CLIP_OPERATOR_UNION,
+   GLC_INT_CLIP_OPERATOR_INTERSECT = GLC_CLIP_OPERATOR_INTERSECT,
+   GLC_INT_CLIP_OPERATOR_INCR_INTERSECT,
+   GLC_INT_CLIP_OPERATOR_DECR_INTERSECT,
+   GLC_INT_CLIP_OPERATOR_CLIP
+ } glc_int_clip_operator_t;
+ 
+ extern void __internal_linkage
+ glc_set_clip_operator (glc_int_clip_operator_t op,
+                        int mask);
+ 
  extern void __internal_linkage
  glc_intersect_region (glc_region_box_t *box1,
***************
*** 339,350 ****
  
  extern glc_bool_t __internal_linkage
! glc_int_is_power_of_two (int value);
  
  extern void __internal_linkage
! glc_int_to_power_of_two (int *value);
  
  extern glc_texture_t *__internal_linkage
! glc_texture_generate (int width,
!                       int height,
                        unsigned int texture_format,
                        long int target_mask);
--- 381,392 ----
  
  extern glc_bool_t __internal_linkage
! glc_uint_is_power_of_two (unsigned int value);
  
  extern void __internal_linkage
! glc_uint_to_power_of_two (unsigned int *value);
  
  extern glc_texture_t *__internal_linkage
! glc_texture_generate (unsigned int width,
!                       unsigned int height,
                        unsigned int texture_format,
                        long int target_mask);
***************
*** 389,398 ****
  glc_surface_deinit (glc_surface_t *surface);
  
- extern glc_surface_t * __internal_linkage
- glc_surface_create_similar (glc_surface_t *templ,
-                             glc_format_name_t format_name,
-                             int width,
-                             int height);
- 
  extern glc_texture_t *__internal_linkage
  glc_surface_get_texture (glc_surface_t *surface);
--- 431,434 ----
***************
*** 437,440 ****
--- 473,505 ----
  glc_status_pop_from_mask (long int *mask);
  
+ extern glc_surface_t *__internal_linkage
+ glc_int_surface_create_similar (glc_surface_t *templ,
+                                 glc_format_name_t format_name,
+                                 glc_bool_t drawable,
+                                 int width,
+                                 int height);
+ 
+ extern void __internal_linkage
+ glc_int_surface_clip_rectangles (glc_surface_t *surface,
+                                  glc_int_clip_operator_t op,
+                                  int mask,
+                                  const glc_rectangle_t *rects,
+                                  int n_rects);
+ 
+ extern void __internal_linkage
+ glc_int_surface_clip_trapezoids (glc_surface_t *surface,
+                                  glc_int_clip_operator_t op,
+                                  int mask,
+                                  const glc_trapezoid_t *traps,
+                                  int n_traps);
+ 
+ extern void __internal_linkage
+ glc_int_surface_clip_triangles (glc_surface_t *surface,
+                                 glc_int_clip_operator_t op,
+                                 int mask,
+                                 glc_triangle_type_t type,
+                                 const glc_point_fixed_t *points,
+                                 int n_points);
+ 
  extern glc_format_t *__internal_linkage
  glc_format_find (glc_format_t *formats,
***************
*** 506,509 ****
--- 571,600 ----
  glc_color_range_reference (glc_color_range_t *color_range);
  
+ extern void __internal_linkage
+ glc_int_fill_rectangles (glc_operator_t op,
+                          glc_surface_t *dst,
+                          const glc_color_t *color,
+                          const glc_rectangle_t *rects,
+                          int n_rects);
+ 
+ extern void __internal_linkage
+ glc_int_fill_trapezoids (glc_operator_t op,
+                          glc_surface_t *dst,
+                          int x_offset,
+                          int y_offset,
+                          const glc_color_t *color,
+                          const glc_trapezoid_t *traps,
+                          int n_traps);
+ 
+ extern void __internal_linkage
+ glc_int_fill_triangles (glc_operator_t op,
+                         glc_surface_t *dst,
+                         glc_triangle_type_t type,
+                         int x_offset,
+                         int y_offset,
+                         const glc_color_t *color,
+                         const glc_point_fixed_t *points,
+                         int n_points);
+ 
  #define MAXSHORT SHRT_MAX
  #define MINSHORT SHRT_MIN
***************
*** 563,566 ****
--- 654,658 ----
  /* Avoid unnecessary PLT entries.  */
  
+ slim_hidden_proto(glc_surface_create_similar)
  slim_hidden_proto(glc_surface_create_solid)
  slim_hidden_proto(glc_surface_create_linear)
***************
*** 573,578 ****
  slim_hidden_proto(glc_surface_get_width)
  slim_hidden_proto(glc_surface_get_height)
! slim_hidden_proto(glc_surface_realize)
! slim_hidden_proto(glc_surface_show)
  slim_hidden_proto(glc_surface_read_pixels)
  slim_hidden_proto(glc_surface_draw_pixels)
--- 665,670 ----
  slim_hidden_proto(glc_surface_get_width)
  slim_hidden_proto(glc_surface_get_height)
! slim_hidden_proto(glc_surface_update_size)
! slim_hidden_proto(glc_surface_flush)
  slim_hidden_proto(glc_surface_read_pixels)
  slim_hidden_proto(glc_surface_draw_pixels)
***************
*** 581,589 ****
  slim_hidden_proto(glc_surface_gl_begin)
  slim_hidden_proto(glc_surface_gl_end)
! slim_hidden_proto(glc_surface_features)
  slim_hidden_proto(glc_fill_rectangle)
  slim_hidden_proto(glc_fill_rectangles)
  slim_hidden_proto(glc_composite_trapezoids)
  slim_hidden_proto(glc_color_trapezoids)
  slim_hidden_proto(glc_composite_triangles)
  slim_hidden_proto(glc_composite_tri_strip)
--- 673,688 ----
  slim_hidden_proto(glc_surface_gl_begin)
  slim_hidden_proto(glc_surface_gl_end)
! slim_hidden_proto(glc_surface_get_features)
! slim_hidden_proto(glc_surface_clip_rectangles)
! slim_hidden_proto(glc_surface_clip_trapezoids)
! slim_hidden_proto(glc_surface_clip_triangles)
! slim_hidden_proto(glc_surface_get_format)
! slim_hidden_proto(glc_surface_get_hints)
  slim_hidden_proto(glc_fill_rectangle)
  slim_hidden_proto(glc_fill_rectangles)
+ slim_hidden_proto(glc_fill_trapezoids)
  slim_hidden_proto(glc_composite_trapezoids)
  slim_hidden_proto(glc_color_trapezoids)
+ slim_hidden_proto(glc_fill_triangles)
  slim_hidden_proto(glc_composite_triangles)
  slim_hidden_proto(glc_composite_tri_strip)
***************
*** 742,747 ****
  /* Avoid unnecessary PLT entries.  */
  
- slim_hidden_proto(glc_glx_initialize)
- slim_hidden_proto(glc_glx_features)
  slim_hidden_proto(glc_glx_find_format)
  slim_hidden_proto(glc_glx_find_standard_format)
--- 841,844 ----
***************
*** 849,854 ****
  /* Avoid unnecessary PLT entries.  */
  
- slim_hidden_proto(glc_agl_initialize)
- slim_hidden_proto(glc_agl_features)
  slim_hidden_proto(glc_agl_find_format)
  slim_hidden_proto(glc_agl_find_standard_format)
--- 946,949 ----





More information about the cairo-commit mailing list