[cairo-commit] glitz/src glitz.c, 1.21, 1.22 glitz_agl_extension.c, 1.7, 1.8 glitz_agl_surface.c, 1.16, 1.17 glitz_aglint.h, 1.10, 1.11 glitz_buffer.c, 1.1, 1.2 glitz_compose.c, 1.3, 1.4 glitz_filter.c, 1.3, 1.4 glitz_geometry.c, 1.1, 1.2 glitz_glx_extension.c, 1.10, 1.11 glitz_glx_info.c, 1.15, 1.16 glitz_glx_surface.c, 1.18, 1.19 glitz_glxint.h, 1.14, 1.15 glitz_pixel.c, 1.5, 1.6 glitz_rect.c, 1.8, 1.9 glitz_surface.c, 1.19, 1.20 glitz_texture.c, 1.11, 1.12 glitzint.h, 1.23, 1.24

David Reveman commit at pdx.freedesktop.org
Mon Sep 6 15:23:33 PDT 2004


Committed by: davidr

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

Modified Files:
	glitz.c glitz_agl_extension.c glitz_agl_surface.c 
	glitz_aglint.h glitz_buffer.c glitz_compose.c glitz_filter.c 
	glitz_geometry.c glitz_glx_extension.c glitz_glx_info.c 
	glitz_glx_surface.c glitz_glxint.h glitz_pixel.c glitz_rect.c 
	glitz_surface.c glitz_texture.c glitzint.h 
Log Message:
Added support for fill type transparent even though GL_ARB_texture_border_clamp is missing

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** glitz.c	3 Sep 2004 14:27:58 -0000	1.21
--- glitz.c	6 Sep 2004 22:23:29 -0000	1.22
***************
*** 181,185 ****
                                 rect.x1 - x_mask,
                                 rect.y1 - y_mask,
-                                mask->height,
                                 mask->flags);
      
--- 181,184 ----
***************
*** 227,231 ****
                                 rect.x1 - y_src,
                                 rect.y1 - x_src,
-                                src->height,
                                 src->flags);
  
--- 226,229 ----
***************
*** 470,474 ****
          glitz_texture_bind (gl, texture);
  
!         glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, height, ~0); 
  
          gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
--- 468,472 ----
          glitz_texture_bind (gl, texture);
  
!         glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, ~0); 
  
          gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,

Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_extension.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glitz_agl_extension.c	3 Sep 2004 14:27:58 -0000	1.7
--- glitz_agl_extension.c	6 Sep 2004 22:23:29 -0000	1.8
***************
*** 96,109 ****
  
    if (thread_info->agl_feature_mask &
!       GLITZ_AGL_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) {
!     thread_info->texture_mask |= GLITZ_TEXTURE_TARGET_NON_POWER_OF_TWO_MASK;
      thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK;
-   } 
  
    if (thread_info->agl_feature_mask &
!       GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK) {
!     thread_info->texture_mask |= GLITZ_TEXTURE_TARGET_RECTANGLE_MASK;
      thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK;
-   }
  
    if (thread_info->agl_feature_mask &
--- 96,105 ----
  
    if (thread_info->agl_feature_mask &
!       GLITZ_AGL_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK)
      thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK;
  
    if (thread_info->agl_feature_mask &
!       GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK)
      thread_info->feature_mask |= GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK;
  
    if (thread_info->agl_feature_mask &

Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** glitz_agl_surface.c	3 Sep 2004 14:27:58 -0000	1.16
--- glitz_agl_surface.c	6 Sep 2004 22:23:29 -0000	1.17
***************
*** 90,94 ****
                                    &copy_box, &copy_box);
  
!     if (!surface->base.texture.allocated)
        glitz_texture_allocate (&surface->base.backend->gl,
                                &surface->base.texture);  
--- 90,94 ----
                                    &copy_box, &copy_box);
  
!     if (!(TEXTURE_ALLOCATED (&surface->base.texture)))
        glitz_texture_allocate (&surface->base.backend->gl,
                                &surface->base.texture);  
***************
*** 102,115 ****
                                  copy_box.y1);
      
!     surface->base.flags &= ~GLITZ_FLAG_DIRTY_MASK;
    }
  
    if (allocate) {
!     if (!surface->base.texture.allocated)
        glitz_texture_allocate (&surface->base.backend->gl,
                                &surface->base.texture);
    }
    
!   if (surface->base.texture.allocated)
      return &surface->base.texture;
    else
--- 102,115 ----
                                  copy_box.y1);
      
!     surface->base.flags &= ~GLITZ_SURFACE_FLAG_DIRTY_MASK;
    }
  
    if (allocate) {
!     if (!(TEXTURE_ALLOCATED (&surface->base.texture)))
        glitz_texture_allocate (&surface->base.backend->gl,
                                &surface->base.texture);
    }
    
!   if (TEXTURE_ALLOCATED (&surface->base.texture))
      return &surface->base.texture;
    else
***************
*** 138,142 ****
    glitz_agl_surface_t *surface;
    glitz_agl_context_t *context;
-   unsigned long texture_mask;
  
    context = glitz_agl_context_get (thread_info, format, 1);
--- 138,141 ----
***************
*** 147,175 ****
    if (surface == NULL)
      return NULL;
! 
!   texture_mask = thread_info->texture_mask;
! 
!   /* Seems to be a problem with binding a pbuffer to some power of two sized
!      textures. This will try to avoid the problem. */
!   if (((width > 1) && (width < 64)) ||
!       ((height > 1) && (height < 64))) {
!     if (texture_mask != GLITZ_TEXTURE_TARGET_2D_MASK)
!       texture_mask &= ~GLITZ_TEXTURE_TARGET_2D_MASK;
!   }
! 
    glitz_surface_init (&surface->base,
                        &context->backend,
                        format,
                        width,
!                       height,
!                       texture_mask);
    
    surface->thread_info = thread_info;
    surface->context = context;
  
!   surface->base.flags |= GLITZ_FLAG_OFFSCREEN_MASK;
  
    if (format->draw.offscreen)
!     surface->base.flags |= GLITZ_FLAG_DRAWABLE_MASK;
  
    return &surface->base;
--- 146,163 ----
    if (surface == NULL)
      return NULL;
!   
    glitz_surface_init (&surface->base,
                        &context->backend,
                        format,
                        width,
!                       height);
    
    surface->thread_info = thread_info;
    surface->context = context;
  
!   surface->base.flags |= GLITZ_SURFACE_FLAG_OFFSCREEN_MASK;
  
    if (format->draw.offscreen)
!     surface->base.flags |= GLITZ_SURFACE_FLAG_DRAWABLE_MASK;
  
    return &surface->base;
***************
*** 209,214 ****
                        format,
                        width,
!                       height,
!                       thread_info->texture_mask);
    
    surface->thread_info = thread_info;
--- 197,201 ----
                        format,
                        width,
!                       height);
    
    surface->thread_info = thread_info;
***************
*** 217,221 ****
    surface->drawable = GetWindowPort (window);
  
!   surface->base.flags |= GLITZ_FLAG_DRAWABLE_MASK;
    
    return &surface->base;
--- 204,208 ----
    surface->drawable = GetWindowPort (window);
  
!   surface->base.flags |= GLITZ_SURFACE_FLAG_DRAWABLE_MASK;
    
    return &surface->base;

Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** glitz_aglint.h	3 Sep 2004 14:27:58 -0000	1.10
--- glitz_aglint.h	6 Sep 2004 22:23:29 -0000	1.11
***************
*** 80,84 ****
    unsigned long feature_mask;
    unsigned long agl_feature_mask;
-   unsigned long texture_mask;
  
    glitz_program_map_t program_map;
--- 80,83 ----

Index: glitz_buffer.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_buffer.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** glitz_buffer.c	3 Sep 2004 14:27:58 -0000	1.1
--- glitz_buffer.c	6 Sep 2004 22:23:29 -0000	1.2
***************
*** 269,273 ****
      glitz_surface_push_current (buffer->surface, GLITZ_CN_ANY_CONTEXT_CURRENT);
      
!     if (buffer->surface->backend->gl.unmap_buffer (buffer->target))
        status = GLITZ_STATUS_CONTENT_DESTROYED;
        
--- 269,274 ----
      glitz_surface_push_current (buffer->surface, GLITZ_CN_ANY_CONTEXT_CURRENT);
      
!     if (buffer->surface->backend->gl.unmap_buffer (buffer->target) ==
!         GLITZ_GL_FALSE)
        status = GLITZ_STATUS_CONTENT_DESTROYED;
        

Index: glitz_compose.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_compose.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** glitz_compose.c	3 Sep 2004 14:27:58 -0000	1.3
--- glitz_compose.c	6 Sep 2004 22:23:29 -0000	1.4
***************
*** 411,415 ****
  #define SURFACE_WRAP(surface, feature_mask) \
    (SURFACE_REPEAT (surface)? \
!    ((surface)->texture.repeatable && \
      ( \
       (!SURFACE_MIRRORED (surface)) || \
--- 411,415 ----
  #define SURFACE_WRAP(surface, feature_mask) \
    (SURFACE_REPEAT (surface)? \
!    (TEXTURE_REPEATABLE (&(surface)->texture) && \
      ( \
       (!SURFACE_MIRRORED (surface)) || \
***************
*** 418,429 ****
      ) \
     : \
!    (SURFACE_PAD (surface)? \
!     ((surface)->texture.repeatable || \
!      (surface)->texture.target != GLITZ_GL_TEXTURE_2D) \
      : \
!     ((feature_mask) & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
      ) \
!    )
! 
  static glitz_surface_type_t
  _glitz_get_surface_type (glitz_surface_t *surface,
--- 418,430 ----
      ) \
     : \
!    ((SURFACE_PAD (surface))? \
!     (TEXTURE_PADABLE (&(surface)->texture)) \
      : \
!     (SURFACE_SIMPLE_TRANSFORM (surface) || \
!      ((feature_mask) & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
      ) \
!    ) \
!   )
!      
  static glitz_surface_type_t
  _glitz_get_surface_type (glitz_surface_t *surface,

Index: glitz_filter.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_filter.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** glitz_filter.c	3 Sep 2004 14:27:58 -0000	1.3
--- glitz_filter.c	6 Sep 2004 22:23:29 -0000	1.4
***************
*** 100,104 ****
    switch (filter) {
    case GLITZ_FILTER_CONVOLUTION: {
!     glitz_float_t dm, dn, sum, tx, ty;
      int cx, cy, m, n, j;
      
--- 100,104 ----
    switch (filter) {
    case GLITZ_FILTER_CONVOLUTION: {
!     glitz_float_t dm, dn, sum;
      int cx, cy, m, n, j;
      
***************
*** 120,126 ****
      cy = n / 2;
  
-     tx = surface->texture.texcoord_width / surface->texture.width;
-     ty = surface->texture.texcoord_height / surface->texture.height;
- 
      sum = 0.0f;
      for (i = 0; i < m; i++) {
--- 120,123 ----
***************
*** 132,137 ****
          if (weight != 0.0f) {
            vec = &vecs[surface->filter_params->id++];
!           vec->v[0] = (i - cx) * tx;
!           vec->v[1] = (cy - j) * ty;
            vec->v[2] = weight;
            vec->v[3] = 0.0f;
--- 129,134 ----
          if (weight != 0.0f) {
            vec = &vecs[surface->filter_params->id++];
!           vec->v[0] = (i - cx) * surface->texture.texcoord_width_unit;
!           vec->v[1] = (cy - j) * surface->texture.texcoord_height_unit;
            vec->v[2] = weight;
            vec->v[3] = 0.0f;
***************
*** 150,154 ****
    } break;
    case GLITZ_FILTER_GAUSSIAN: {
!     glitz_float_t radius, sigma, alpha, scale, xy_scale, sum, tx, ty;
      int half_size, x, y;
      
--- 147,151 ----
    } break;
    case GLITZ_FILTER_GAUSSIAN: {
!     glitz_float_t radius, sigma, alpha, scale, xy_scale, sum;
      int half_size, x, y;
      
***************
*** 178,184 ****
      surface->filter_params->id = 0;
  
-     tx = surface->texture.texcoord_width / surface->texture.width;
-     ty = surface->texture.texcoord_height / surface->texture.height;
- 
      sum = 0.0f;
      for (x = 0; x < size; x++) {
--- 175,178 ----
***************
*** 196,201 ****
          if (amp > 0.0f) {
            vec = &vecs[surface->filter_params->id++];
!           vec->v[0] = fx * tx;
!           vec->v[1] = fy * ty;
            vec->v[2] = amp;
            vec->v[3] = 0.0f;
--- 190,195 ----
          if (amp > 0.0f) {
            vec = &vecs[surface->filter_params->id++];
!           vec->v[0] = fx * surface->texture.texcoord_width_unit;
!           vec->v[1] = fy * surface->texture.texcoord_height_unit;
            vec->v[2] = amp;
            vec->v[3] = 0.0f;
***************
*** 291,295 ****
        vecs[i].v[1] *= surface->texture.texcoord_height_unit;
        
!       vecs[i].v[1] = surface->texture.texcoord_height - vecs[i].v[1];
        vecs[i].v[3] = i;
      }
--- 285,289 ----
        vecs[i].v[1] *= surface->texture.texcoord_height_unit;
        
!       vecs[i].v[1] = surface->texture.box.y2 - vecs[i].v[1];
        vecs[i].v[3] = i;
      }
***************
*** 351,355 ****
      break;
    case GLITZ_FILTER_LINEAR_GRADIENT:
!     if (surface->flags & GLITZ_FLAG_REPEAT_MASK) {
        if (SURFACE_MIRRORED (surface))
          surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REFLECT;
--- 345,349 ----
      break;
    case GLITZ_FILTER_LINEAR_GRADIENT:
!     if (surface->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) {
        if (SURFACE_MIRRORED (surface))
          surface->filter_params->fp_type = GLITZ_FP_LINEAR_GRADIENT_REFLECT;
***************
*** 362,366 ****
      break;
    case GLITZ_FILTER_RADIAL_GRADIENT:
!     if (surface->flags & GLITZ_FLAG_REPEAT_MASK) {
        if (SURFACE_MIRRORED (surface))
          surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REFLECT;
--- 356,360 ----
      break;
    case GLITZ_FILTER_RADIAL_GRADIENT:
!     if (surface->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) {
        if (SURFACE_MIRRORED (surface))
          surface->filter_params->fp_type = GLITZ_FP_RADIAL_GRADIENT_REFLECT;

Index: glitz_geometry.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_geometry.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** glitz_geometry.c	3 Sep 2004 14:27:58 -0000	1.1
--- glitz_geometry.c	6 Sep 2004 22:23:29 -0000	1.2
***************
*** 159,172 ****
      if (dst->format->multisample.samples > 1) {
        if (format->edge_hint != GLITZ_GEOMETRY_EDGE_HINT_SHARP) {
!         dst->flags |= GLITZ_FLAG_MULTISAMPLE_MASK;
  
          if (format->edge_hint != GLITZ_GEOMETRY_EDGE_HINT_FAST_SMOOTH)
!           dst->flags |= GLITZ_FLAG_NICEST_MULTISAMPLE_MASK;
          else
!           dst->flags &= ~GLITZ_FLAG_NICEST_MULTISAMPLE_MASK;
          
          dst->update_mask |= GLITZ_UPDATE_MULTISAMPLE_MASK;
        } else {
!         dst->flags &= ~GLITZ_FLAG_MULTISAMPLE_MASK;
          dst->update_mask |= GLITZ_UPDATE_MULTISAMPLE_MASK;
        }
--- 159,172 ----
      if (dst->format->multisample.samples > 1) {
        if (format->edge_hint != GLITZ_GEOMETRY_EDGE_HINT_SHARP) {
!         dst->flags |= GLITZ_SURFACE_FLAG_MULTISAMPLE_MASK;
  
          if (format->edge_hint != GLITZ_GEOMETRY_EDGE_HINT_FAST_SMOOTH)
!           dst->flags |= GLITZ_SURFACE_FLAG_NICEST_MULTISAMPLE_MASK;
          else
!           dst->flags &= ~GLITZ_SURFACE_FLAG_NICEST_MULTISAMPLE_MASK;
          
          dst->update_mask |= GLITZ_UPDATE_MULTISAMPLE_MASK;
        } else {
!         dst->flags &= ~GLITZ_SURFACE_FLAG_MULTISAMPLE_MASK;
          dst->update_mask |= GLITZ_UPDATE_MULTISAMPLE_MASK;
        }
***************
*** 202,206 ****
    } else {
      if (dst->format->multisample.samples > 1) {
!       dst->flags &= ~GLITZ_FLAG_MULTISAMPLE_MASK;
        dst->update_mask |= GLITZ_UPDATE_MULTISAMPLE_MASK;
      } else
--- 202,206 ----
    } else {
      if (dst->format->multisample.samples > 1) {
!       dst->flags &= ~GLITZ_SURFACE_FLAG_MULTISAMPLE_MASK;
        dst->update_mask |= GLITZ_UPDATE_MULTISAMPLE_MASK;
      } else

Index: glitz_glx_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_extension.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** glitz_glx_extension.c	3 Sep 2004 14:27:58 -0000	1.10
--- glitz_glx_extension.c	6 Sep 2004 22:23:29 -0000	1.11
***************
*** 119,132 ****
  
    if (screen_info->glx_feature_mask &
!       GLITZ_GLX_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) {
!     screen_info->texture_mask |= GLITZ_TEXTURE_TARGET_NON_POWER_OF_TWO_MASK;
      screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK;
-   }
  
    if (screen_info->glx_feature_mask &
!       GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK) {
!     screen_info->texture_mask |= GLITZ_TEXTURE_TARGET_RECTANGLE_MASK;
      screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK;
-   }
  
    if (screen_info->glx_feature_mask &
--- 119,128 ----
  
    if (screen_info->glx_feature_mask &
!       GLITZ_GLX_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK)
      screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK;
  
    if (screen_info->glx_feature_mask &
!       GLITZ_GLX_FEATURE_TEXTURE_RECTANGLE_MASK)
      screen_info->feature_mask |= GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK;
  
    if (screen_info->glx_feature_mask &

Index: glitz_glx_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_info.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** glitz_glx_info.c	3 Sep 2004 14:27:58 -0000	1.15
--- glitz_glx_info.c	6 Sep 2004 22:23:29 -0000	1.16
***************
*** 455,459 ****
    screen_info->glx_feature_mask = 0;
    screen_info->feature_mask = 0;
-   screen_info->texture_mask = GLITZ_TEXTURE_TARGET_2D_MASK;
  
    if (screen_info->root_context.context &&
--- 455,458 ----

Index: glitz_glx_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_surface.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** glitz_glx_surface.c	3 Sep 2004 14:27:58 -0000	1.18
--- glitz_glx_surface.c	6 Sep 2004 22:23:29 -0000	1.19
***************
*** 122,126 ****
    glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
    
!   if (surface->base.flags & GLITZ_FLAG_DIRTY_MASK) {
      glitz_bounding_box_t copy_box;
  
--- 122,126 ----
    glitz_glx_surface_t *surface = (glitz_glx_surface_t *) abstract_surface;
    
!   if (surface->base.flags & GLITZ_SURFACE_FLAG_DIRTY_MASK) {
      glitz_bounding_box_t copy_box;
  
***************
*** 131,135 ****
                                    &copy_box, &copy_box);
  
!     if (!surface->base.texture.allocated)
        glitz_texture_allocate (&surface->base.backend->gl,
                                &surface->base.texture);  
--- 131,135 ----
                                    &copy_box, &copy_box);
  
!     if (!(TEXTURE_ALLOCATED (&surface->base.texture)))
        glitz_texture_allocate (&surface->base.backend->gl,
                                &surface->base.texture);  
***************
*** 143,156 ****
                                  copy_box.y1);
      
!     surface->base.flags &= ~GLITZ_FLAG_DIRTY_MASK;
    }
  
    if (allocate) {
!     if (!surface->base.texture.allocated)
        glitz_texture_allocate (&surface->base.backend->gl,
                                &surface->base.texture);
    }
    
!   if (surface->base.texture.allocated)
      return &surface->base.texture;
    else
--- 143,156 ----
                                  copy_box.y1);
      
!     surface->base.flags &= ~GLITZ_SURFACE_FLAG_DIRTY_MASK;
    }
  
    if (allocate) {
!     if (!(TEXTURE_ALLOCATED (&surface->base.texture)))
        glitz_texture_allocate (&surface->base.backend->gl,
                                &surface->base.texture);
    }
    
!   if (TEXTURE_ALLOCATED (&surface->base.texture))
      return &surface->base.texture;
    else
***************
*** 179,192 ****
                        format,
                        width,
!                       height,
!                       screen_info->texture_mask);
    
    surface->screen_info = screen_info;
    surface->context = context;
    
!   surface->base.flags |= GLITZ_FLAG_OFFSCREEN_MASK;
  
    if (format->draw.offscreen)
!     surface->base.flags |= GLITZ_FLAG_DRAWABLE_MASK;
  
    if (surface->context->backend.gl.need_lookup) {
--- 179,191 ----
                        format,
                        width,
!                       height);
    
    surface->screen_info = screen_info;
    surface->context = context;
    
!   surface->base.flags |= GLITZ_SURFACE_FLAG_OFFSCREEN_MASK;
  
    if (format->draw.offscreen)
!     surface->base.flags |= GLITZ_SURFACE_FLAG_DRAWABLE_MASK;
  
    if (surface->context->backend.gl.need_lookup) {
***************
*** 207,212 ****
  
    return
!     _glitz_glx_surface_create (glitz_glx_screen_info_get
!                                (display, screen),
                                 format, width, height);
  }
--- 206,210 ----
  
    return
!     _glitz_glx_surface_create (glitz_glx_screen_info_get (display, screen),
                                 format, width, height);
  }
***************
*** 240,245 ****
                        format,
                        width,
!                       height,
!                       screen_info->texture_mask);
    
    surface->screen_info = screen_info;
--- 238,242 ----
                        format,
                        width,
!                       height);
    
    surface->screen_info = screen_info;
***************
*** 247,251 ****
    surface->drawable = window;
  
!   surface->base.flags |= GLITZ_FLAG_DRAWABLE_MASK;
  
    if (surface->context->backend.gl.need_lookup) {
--- 244,248 ----
    surface->drawable = window;
  
!   surface->base.flags |= GLITZ_SURFACE_FLAG_DRAWABLE_MASK;
  
    if (surface->context->backend.gl.need_lookup) {

Index: glitz_glxint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glxint.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** glitz_glxint.h	3 Sep 2004 14:27:58 -0000	1.14
--- glitz_glxint.h	6 Sep 2004 22:23:29 -0000	1.15
***************
*** 115,119 ****
    unsigned long feature_mask;
    unsigned long glx_feature_mask;
-   unsigned long texture_mask;
  
    glitz_program_map_t program_map;
--- 115,118 ----

Index: glitz_pixel.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_pixel.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_pixel.c	3 Sep 2004 14:27:58 -0000	1.5
--- glitz_pixel.c	6 Sep 2004 22:23:29 -0000	1.6
***************
*** 518,525 ****
        gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 2);
    } else
!     gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 1);    
  
    gl->tex_sub_image_2d (texture->target, 0,
!                         x_dst, dst->height - y_dst - height,
                          width, height,
                          gl_format->format, gl_format->type,
--- 518,526 ----
        gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 2);
    } else
!     gl->pixel_store_i (GLITZ_GL_UNPACK_ALIGNMENT, 1);
  
    gl->tex_sub_image_2d (texture->target, 0,
!                         texture->box.x1 + x_dst,
!                         texture->box.y2 - y_dst - height,
                          width, height,
                          gl_format->format, gl_format->type,
***************
*** 527,531 ****
  
    if (to_drawable) {
!     glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, height, ~0); 
  
      gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
--- 528,532 ----
  
    if (to_drawable) {
!     glitz_texture_set_tex_gen (gl, texture, x_dst, y_dst, ~0); 
  
      gl->tex_env_f (GLITZ_GL_TEXTURE_ENV, GLITZ_GL_TEXTURE_ENV_MODE,
***************
*** 550,559 ****
      if (x_dst == 0 && y_dst == 0 &&
          width == dst->width && height == dst->height)
!       dst->flags &= ~GLITZ_FLAG_DIRTY_MASK;
    }
    
    glitz_texture_unbind (gl, texture);
  
!   dst->flags |= GLITZ_FLAG_SOLID_DIRTY_MASK;
  
    if (transform == 0)
--- 551,560 ----
      if (x_dst == 0 && y_dst == 0 &&
          width == dst->width && height == dst->height)
!       dst->flags &= ~GLITZ_SURFACE_FLAG_DIRTY_MASK;
    }
    
    glitz_texture_unbind (gl, texture);
  
!   dst->flags |= GLITZ_SURFACE_FLAG_SOLID_DIRTY_MASK;
  
    if (transform == 0)
***************
*** 622,627 ****
        src_w = texture->width;
        src_h = texture->height;
!       src_x = x_src;
!       src_y = y_src;
      }
  
--- 623,628 ----
        src_w = texture->width;
        src_h = texture->height;
!       src_x = x_src + texture->box.x1;
!       src_y = y_src + texture->box.y1;
      }
  

Index: glitz_rect.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_rect.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** glitz_rect.c	3 Sep 2004 14:27:58 -0000	1.8
--- glitz_rect.c	6 Sep 2004 22:23:29 -0000	1.9
***************
*** 79,83 ****
      STORE_16 (dst->solid.alpha, dst->format->alpha_size, color->alpha);
      
!     dst->flags |= GLITZ_FLAG_DRAWABLE_DIRTY_MASK;
      return;
    }
--- 79,83 ----
      STORE_16 (dst->solid.alpha, dst->format->alpha_size, color->alpha);
      
!     dst->flags |= GLITZ_SURFACE_FLAG_DRAWABLE_DIRTY_MASK;
      return;
    }

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** glitz_surface.c	3 Sep 2004 14:27:58 -0000	1.19
--- glitz_surface.c	6 Sep 2004 22:23:29 -0000	1.20
***************
*** 38,43 ****
                      glitz_format_t *format,
                      int width,
!                     int height,
!                     unsigned long texture_mask)
  {
    surface->backend = backend;
--- 38,42 ----
                      glitz_format_t *format,
                      int width,
!                     int height)
  {
    surface->backend = backend;
***************
*** 67,76 ****
  
    if (width == 1 && height == 1) {
!     surface->flags |= GLITZ_FLAG_SOLID_MASK;
      surface->solid.red = surface->solid.green = surface->solid.blue = 0x0;
      surface->solid.alpha = 0xffff;
    }
  
!   surface->flags |= GLITZ_FLAG_TEXTURE_COORDS_MASK;
  
    glitz_texture_init (&surface->texture,
--- 66,76 ----
  
    if (width == 1 && height == 1) {
!     surface->flags |= GLITZ_SURFACE_FLAG_SOLID_MASK;
      surface->solid.red = surface->solid.green = surface->solid.blue = 0x0;
      surface->solid.alpha = 0xffff;
    }
  
!   surface->flags |= GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
!   surface->flags |= GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK;
  
    glitz_texture_init (&surface->texture,
***************
*** 79,83 ****
                                                              backend->n_formats,
                                                              format),
!                       texture_mask);
  }
  
--- 79,83 ----
                                                              backend->n_formats,
                                                              format),
!                       backend->feature_mask);
  }
  
***************
*** 176,180 ****
      glitz_gl_float_t color[4];
  
!     if (surface->texture.allocated) {
        color[0] = surface->solid.red / 65535.0f;
        color[1] = surface->solid.green / 65535.0f;
--- 176,180 ----
      glitz_gl_float_t color[4];
  
!     if (TEXTURE_ALLOCATED (&surface->texture)) {
        color[0] = surface->solid.red / 65535.0f;
        color[1] = surface->solid.green / 65535.0f;
***************
*** 183,192 ****
      
        glitz_texture_bind (gl, &surface->texture);
!       gl->tex_sub_image_2d (surface->texture.target, 0, 0, 0, 1, 1,
!                             GLITZ_GL_RGBA, GLITZ_GL_FLOAT, color);
        glitz_texture_unbind (gl, &surface->texture);
      }
    }
!   surface->flags &= ~GLITZ_FLAG_DRAWABLE_DIRTY_MASK;
  }
  
--- 183,193 ----
      
        glitz_texture_bind (gl, &surface->texture);
!       gl->tex_sub_image_2d (surface->texture.target, 0,
!                             surface->texture.box.x1, surface->texture.box.y1,
!                             1, 1, GLITZ_GL_RGBA, GLITZ_GL_FLOAT, color);
        glitz_texture_unbind (gl, &surface->texture);
      }
    }
!   surface->flags &= ~GLITZ_SURFACE_FLAG_DRAWABLE_DIRTY_MASK;
  }
  
***************
*** 196,202 ****
    if (SURFACE_DIRTY (surface) || SURFACE_SOLID_DIRTY (surface)) {
      glitz_gl_proc_address_list_t *gl = &surface->backend->gl;
!     glitz_gl_float_t color[4];
!     
!     glitz_texture_t *texture = glitz_surface_get_texture (surface, 0);
      if (texture) {
        glitz_texture_bind (gl, texture);
--- 197,206 ----
    if (SURFACE_DIRTY (surface) || SURFACE_SOLID_DIRTY (surface)) {
      glitz_gl_proc_address_list_t *gl = &surface->backend->gl;
!     glitz_gl_float_t *c, color[64];
!     glitz_texture_t *texture;
! 
!     texture = glitz_surface_get_texture (surface, 0);
! 
!     c = &color[(texture->box.y1 * texture->width + texture->box.x1) * 4];
      if (texture) {
        glitz_texture_bind (gl, texture);
***************
*** 205,218 ****
        glitz_texture_unbind (gl, texture);
      } else {
!       color[0] = color[1] = color[2] = 0.0f;
!       color[3] = 1.0f;
      }
    
!     surface->solid.red = color[0] * 65535.0f;
!     surface->solid.green = color[1] * 65535.0f;
!     surface->solid.blue = color[2] * 65535.0f;
!     surface->solid.alpha = color[3] * 65535.0f;
  
!     surface->flags &= ~GLITZ_FLAG_SOLID_DIRTY_MASK;
    }
  }
--- 209,222 ----
        glitz_texture_unbind (gl, texture);
      } else {
!       c[0] = c[1] = c[2] = 0.0f;
!       c[3] = 1.0f;
      }
    
!     surface->solid.red = c[0] * 65535.0f;
!     surface->solid.green = c[1] * 65535.0f;
!     surface->solid.blue = c[2] * 65535.0f;
!     surface->solid.alpha = c[3] * 65535.0f;
  
!     surface->flags &= ~GLITZ_SURFACE_FLAG_SOLID_DIRTY_MASK;
    }
  }
***************
*** 254,258 ****
    
    if (transform) {
!     glitz_gl_float_t *m, *t;
      
      if (!surface->transform) {
--- 258,262 ----
    
    if (transform) {
!     glitz_gl_float_t height, *m, *t;
      
      if (!surface->transform) {
***************
*** 301,304 ****
--- 305,312 ----
         
         the following code does it pretty efficiently. */
+ 
+     height = surface->texture.texcoord_height_unit *
+       (surface->texture.box.y2 - surface->texture.box.y1);
+       
      t[0] = m[0];
      t[4] = m[4];
***************
*** 311,319 ****
      t[15] = m[15];
      
!     t[1] = surface->texture.texcoord_height * t[3] - m[1];
!     t[5] = surface->texture.texcoord_height * t[7] - m[5];
      t[9] = 0.0f;
!     t[13] = surface->texture.texcoord_height * t[15] -
!       surface->texture.texcoord_height_unit * m[13];
  
      t[2] = 0.0f;
--- 319,326 ----
      t[15] = m[15];
      
!     t[1] = height * t[3] - m[1];
!     t[5] = height * t[7] - m[5];
      t[9] = 0.0f;
!     t[13] = height * t[15] - surface->texture.texcoord_height_unit * m[13];
  
      t[2] = 0.0f;
***************
*** 328,334 ****
  
      /* translate y = -texture_height */
!     t[12] -= t[4] * surface->texture.texcoord_height;
!     t[13] -= t[5] * surface->texture.texcoord_height;
!     t[15] -= t[7] * surface->texture.texcoord_height;
    } else {
      if (surface->transform)
--- 335,348 ----
  
      /* translate y = -texture_height */
!     t[12] -= t[4] * height;
!     t[13] -= t[5] * height;
!     t[15] -= t[7] * height;
! 
!     if (t[0] == 1.0 && t[4] == 0.0 &&
!         t[1] == 0.0 && t[5] == 1.0 &&
!         t[3] == 0.0 && t[7] == 0.0 && t[15] == 1.0)
!       surface->flags |= GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK;
!     else
!       surface->flags &= ~GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK;
    } else {
      if (surface->transform)
***************
*** 336,339 ****
--- 350,354 ----
      
      surface->transform = NULL;
+     surface->flags |= GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK;
    }
  }
***************
*** 346,367 ****
    switch (fill) {
    case GLITZ_FILL_TRANSPARENT:
!     surface->flags &= ~GLITZ_FLAG_REPEAT_MASK;
!     surface->flags &= ~GLITZ_FLAG_MIRRORED_MASK;
!     surface->flags &= ~GLITZ_FLAG_PAD_MASK;
      break;
    case GLITZ_FILL_NEAREST:
!     surface->flags &= ~GLITZ_FLAG_REPEAT_MASK;
!     surface->flags &= ~GLITZ_FLAG_MIRRORED_MASK;
!     surface->flags |= GLITZ_FLAG_PAD_MASK;
      break;
    case GLITZ_FILL_REPEAT:
!     surface->flags |= GLITZ_FLAG_REPEAT_MASK;
!     surface->flags &= ~GLITZ_FLAG_MIRRORED_MASK;
!     surface->flags &= ~GLITZ_FLAG_PAD_MASK;
      break;
    case GLITZ_FILL_REFLECT:
!     surface->flags |= GLITZ_FLAG_REPEAT_MASK;
!     surface->flags |= GLITZ_FLAG_MIRRORED_MASK;
!     surface->flags &= ~GLITZ_FLAG_PAD_MASK;
      break;
    }
--- 361,382 ----
    switch (fill) {
    case GLITZ_FILL_TRANSPARENT:
!     surface->flags &= ~GLITZ_SURFACE_FLAG_REPEAT_MASK;
!     surface->flags &= ~GLITZ_SURFACE_FLAG_MIRRORED_MASK;
!     surface->flags &= ~GLITZ_SURFACE_FLAG_PAD_MASK;
      break;
    case GLITZ_FILL_NEAREST:
!     surface->flags &= ~GLITZ_SURFACE_FLAG_REPEAT_MASK;
!     surface->flags &= ~GLITZ_SURFACE_FLAG_MIRRORED_MASK;
!     surface->flags |= GLITZ_SURFACE_FLAG_PAD_MASK;
      break;
    case GLITZ_FILL_REPEAT:
!     surface->flags |= GLITZ_SURFACE_FLAG_REPEAT_MASK;
!     surface->flags &= ~GLITZ_SURFACE_FLAG_MIRRORED_MASK;
!     surface->flags &= ~GLITZ_SURFACE_FLAG_PAD_MASK;
      break;
    case GLITZ_FILL_REFLECT:
!     surface->flags |= GLITZ_SURFACE_FLAG_REPEAT_MASK;
!     surface->flags |= GLITZ_SURFACE_FLAG_MIRRORED_MASK;
!     surface->flags &= ~GLITZ_SURFACE_FLAG_PAD_MASK;
      break;
    }
***************
*** 376,382 ****
  {
    if (component_alpha && surface->format->red_size)
!     surface->flags |= GLITZ_FLAG_COMPONENT_ALPHA_MASK;
    else
!     surface->flags &= ~GLITZ_FLAG_COMPONENT_ALPHA_MASK;
  }
  slim_hidden_def(glitz_surface_set_component_alpha);
--- 391,397 ----
  {
    if (component_alpha && surface->format->red_size)
!     surface->flags |= GLITZ_SURFACE_FLAG_COMPONENT_ALPHA_MASK;
    else
!     surface->flags &= ~GLITZ_SURFACE_FLAG_COMPONENT_ALPHA_MASK;
  }
  slim_hidden_def(glitz_surface_set_component_alpha);
***************
*** 396,423 ****
      switch (filter) {
      case GLITZ_FILTER_NEAREST:
!       surface->flags &= ~GLITZ_FLAG_FRAGMENT_FILTER_MASK;
!       surface->flags &= ~GLITZ_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_BILINEAR:
!       surface->flags &= ~GLITZ_FLAG_FRAGMENT_FILTER_MASK;
!       surface->flags |= GLITZ_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_CONVOLUTION:
      case GLITZ_FILTER_GAUSSIAN:
!       surface->flags |= GLITZ_FLAG_FRAGMENT_FILTER_MASK;
!       surface->flags |= GLITZ_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_LINEAR_GRADIENT:
      case GLITZ_FILTER_RADIAL_GRADIENT:
!       surface->flags |= GLITZ_FLAG_FRAGMENT_FILTER_MASK;
!       surface->flags &= ~GLITZ_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags |= GLITZ_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags &= ~GLITZ_FLAG_TEXTURE_COORDS_MASK;
        break;
      }
--- 411,438 ----
      switch (filter) {
      case GLITZ_FILTER_NEAREST:
!       surface->flags &= ~GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_BILINEAR:
!       surface->flags &= ~GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_CONVOLUTION:
      case GLITZ_FILTER_GAUSSIAN:
!       surface->flags |= GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
        break;
      case GLITZ_FILTER_LINEAR_GRADIENT:
      case GLITZ_FILTER_RADIAL_GRADIENT:
!       surface->flags |= GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK;
!       surface->flags |= GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK;
!       surface->flags &= ~GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK;
        break;
      }
***************
*** 555,559 ****
    }
    
!   surface->flags |= (GLITZ_FLAG_DIRTY_MASK | GLITZ_FLAG_SOLID_DIRTY_MASK);
  }
  
--- 570,575 ----
    }
    
!   surface->flags |=
!     (GLITZ_SURFACE_FLAG_DIRTY_MASK | GLITZ_SURFACE_FLAG_SOLID_DIRTY_MASK);
  }
  

Index: glitz_texture.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_texture.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** glitz_texture.c	3 Sep 2004 14:27:58 -0000	1.11
--- glitz_texture.c	6 Sep 2004 22:23:29 -0000	1.12
***************
*** 37,83 ****
                      unsigned int height,
                      unsigned int texture_format,
!                     unsigned long target_mask)
  {
    texture->filter = 0;
    texture->wrap = 0;
-   texture->width = width;
-   texture->height = height;
    texture->format = texture_format;
    texture->name = 0;
!   texture->allocated = 0;
!     
!   if (target_mask & GLITZ_TEXTURE_TARGET_NON_POWER_OF_TWO_MASK) {
      texture->target = GLITZ_GL_TEXTURE_2D;
-     texture->repeatable = 1;
-     texture->texcoord_width = texture->texcoord_height = 1.0f;
    } else {
!     
!     if (POWER_OF_TWO (width) && POWER_OF_TWO (height)) {
!       texture->target = GLITZ_GL_TEXTURE_2D;
!       texture->repeatable = 1;
!       texture->texcoord_width = texture->texcoord_height = 1.0f;
      } else {
!       texture->repeatable = 0;
!       if (target_mask & GLITZ_TEXTURE_TARGET_RECTANGLE_MASK) {
!         texture->target = GLITZ_GL_TEXTURE_RECTANGLE;
!         texture->texcoord_width = texture->width;
!         texture->texcoord_height = texture->height;
!       } else {
!         texture->target = GLITZ_GL_TEXTURE_2D;
!         
!         if (!POWER_OF_TWO (texture->width))
!           texture->width = glitz_uint_to_power_of_two (texture->width);
          
!         if (!POWER_OF_TWO (texture->height))
!           texture->height = glitz_uint_to_power_of_two (texture->height);
! 
!         texture->texcoord_width = (glitz_float_t) width / texture->width;
!         texture->texcoord_height = (glitz_float_t) height / texture->height;
!       }
      }
    }
  
!   texture->texcoord_width_unit = texture->texcoord_width / texture->width;
!   texture->texcoord_height_unit = texture->texcoord_height / texture->height;
  }
  
--- 37,90 ----
                      unsigned int height,
                      unsigned int texture_format,
!                     unsigned long feature_mask)
  {
    texture->filter = 0;
    texture->wrap = 0;
    texture->format = texture_format;
    texture->name = 0;
!   texture->flags = GLITZ_TEXTURE_FLAG_REPEATABLE_MASK |
!     GLITZ_TEXTURE_FLAG_PADABLE_MASK;
! 
!   if (feature_mask & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) {
!     texture->box.x1 = texture->box.y1 = 0;
!     texture->box.x2 = texture->width = width;
!     texture->box.y2 = texture->height = height;
!   } else {
!     texture->box.x1 = texture->box.y1 = 1;
!     texture->box.x2 = width + 1;
!     texture->box.y2 = height + 1;
!     texture->width = width + 2;
!     texture->height = height + 2;
!     texture->flags &= ~(GLITZ_TEXTURE_FLAG_REPEATABLE_MASK |
!                         GLITZ_TEXTURE_FLAG_PADABLE_MASK);
!   }
! 
!   if ((feature_mask & GLITZ_FEATURE_TEXTURE_NON_POWER_OF_TWO_MASK) ||
!       (POWER_OF_TWO (texture->width) && POWER_OF_TWO (texture->height))) {
      texture->target = GLITZ_GL_TEXTURE_2D;
    } else {
!     texture->flags &= ~GLITZ_TEXTURE_FLAG_REPEATABLE_MASK;
!       
!     if (feature_mask & GLITZ_FEATURE_TEXTURE_RECTANGLE_MASK) {
!       texture->target = GLITZ_GL_TEXTURE_RECTANGLE;
      } else {
!       texture->target = GLITZ_GL_TEXTURE_2D;
!       texture->flags &= ~GLITZ_TEXTURE_FLAG_PADABLE_MASK;
          
!       if (!POWER_OF_TWO (texture->width))
!         texture->width = glitz_uint_to_power_of_two (texture->width);
!       
!       if (!POWER_OF_TWO (texture->height))
!         texture->height = glitz_uint_to_power_of_two (texture->height);
      }
    }
  
!   if (texture->target == GLITZ_GL_TEXTURE_2D) {
!     texture->texcoord_width_unit = 1.0f / texture->width;
!     texture->texcoord_height_unit = 1.0f / texture->height;
!   } else {
!     texture->texcoord_width_unit = 1.0f;
!     texture->texcoord_height_unit = 1.0f;
!   }
  }
  
***************
*** 91,112 ****
      gl->gen_textures (1, &texture->name);
  
!   texture->allocated = 1;
! 
    glitz_texture_bind (gl, texture);
  
!   /* unused texels must be cleared */
!   if ((!texture->repeatable) && texture->target == GLITZ_GL_TEXTURE_2D) {
      data = malloc (texture->width * texture->height * 4);
!     memset (data, 0, texture->width * texture->height * 4);
    }
!       
    gl->tex_image_2d (texture->target, 0, texture->format,
                      texture->width, texture->height,
                      0, GLITZ_GL_RGBA, GLITZ_GL_UNSIGNED_BYTE, data);
  
    if (data)
      free (data);
- 
-   glitz_texture_unbind (gl, texture);
  }
  
--- 98,120 ----
      gl->gen_textures (1, &texture->name);
  
!   texture->flags |= GLITZ_TEXTURE_FLAG_ALLOCATED_MASK;
!   
    glitz_texture_bind (gl, texture);
  
!   if (texture->box.x2 != texture->width ||
!       texture->box.y2 != texture->height) {
      data = malloc (texture->width * texture->height * 4);
!     if (data)
!       memset (data, 0, texture->width * texture->height * 4);
    }
!   
    gl->tex_image_2d (texture->target, 0, texture->format,
                      texture->width, texture->height,
                      0, GLITZ_GL_RGBA, GLITZ_GL_UNSIGNED_BYTE, data);
+   
+   glitz_texture_unbind (gl, texture);
  
    if (data)
      free (data);
  }
  
***************
*** 182,186 ****
  {
    glitz_gl_proc_address_list_t *gl = &surface->backend->gl;
-   int tex_height;
    
    glitz_surface_push_current (surface, GLITZ_CN_SURFACE_DRAWABLE_CURRENT);
--- 190,193 ----
***************
*** 191,202 ****
      gl->read_buffer (surface->read_buffer);
  
-   if (texture->target == GLITZ_GL_TEXTURE_2D)
-     tex_height = (int) (texture->height * texture->texcoord_height);
-   else
-     tex_height = (int) texture->texcoord_height;
-   
    gl->copy_tex_sub_image_2d (texture->target, 0,
!                              x_texture,
!                              tex_height - y_texture - height,
                               x_surface,
                               surface->height - y_surface - height,
--- 198,204 ----
      gl->read_buffer (surface->read_buffer);
  
    gl->copy_tex_sub_image_2d (texture->target, 0,
!                              texture->box.x1 + x_texture,
!                              texture->box.y2 - y_texture - height,
                               x_surface,
                               surface->height - y_surface - height,
***************
*** 212,224 ****
                             int x_src,
                             int y_src,
-                            int height,
                             unsigned long flags)
  {
    glitz_vec4_t plane;
  
!   if (flags & GLITZ_FLAG_TEXTURE_COORDS_MASK) {
      plane.v[1] = plane.v[2] = 0.0f;
      plane.v[0] = texture->texcoord_width_unit;
!     plane.v[3] = -x_src * texture->texcoord_width_unit;
    } else {
      plane.v[1] = plane.v[2] = 0.0f;
--- 214,225 ----
                             int x_src,
                             int y_src,
                             unsigned long flags)
  {
    glitz_vec4_t plane;
  
!   if (flags & GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK) {
      plane.v[1] = plane.v[2] = 0.0f;
      plane.v[0] = texture->texcoord_width_unit;
!     plane.v[3] = -(x_src - texture->box.x1) * texture->texcoord_width_unit;
    } else {
      plane.v[1] = plane.v[2] = 0.0f;
***************
*** 232,243 ****
    gl->enable (GLITZ_GL_TEXTURE_GEN_S);
  
!   if (flags & GLITZ_FLAG_TEXTURE_COORDS_MASK) {
      plane.v[0] = 0.0f;
      plane.v[1] = -texture->texcoord_height_unit;
!     plane.v[3] = (y_src + height) * texture->texcoord_height_unit;
    } else {
      plane.v[0] = 0.0f;
      plane.v[1] = 1.0;
!     plane.v[3] = -y_src;
    }
    
--- 233,244 ----
    gl->enable (GLITZ_GL_TEXTURE_GEN_S);
  
!   if (flags & GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK) {
      plane.v[0] = 0.0f;
      plane.v[1] = -texture->texcoord_height_unit;
!     plane.v[3] = (y_src + texture->box.y2) * texture->texcoord_height_unit;
    } else {
      plane.v[0] = 0.0f;
      plane.v[1] = 1.0;
!     plane.v[3] = y_src;
    }
    

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** glitzint.h	3 Sep 2004 14:27:58 -0000	1.23
--- glitzint.h	6 Sep 2004 22:23:29 -0000	1.24
***************
*** 68,75 ****
  #define GLITZ_STATUS_CONTENT_DESTROYED_MASK  (1L << 3)
  
- #define GLITZ_TEXTURE_TARGET_2D_MASK               (1L << 0)
- #define GLITZ_TEXTURE_TARGET_RECTANGLE_MASK        (1L << 1)
- #define GLITZ_TEXTURE_TARGET_NON_POWER_OF_TWO_MASK (1L << 2)
- 
  #define GLITZ_FORMAT_ALL_EXCEPT_ID_MASK ((1L << 19) - 2)
  
--- 68,71 ----
***************
*** 234,242 ****
  } glitz_vec4_t;
  
  typedef struct _glitz_texture {
    glitz_gl_uint_t name;
    glitz_gl_enum_t target;
    glitz_gl_enum_t format;
!   glitz_bool_t allocated;
    
    glitz_gl_enum_t filter;
--- 230,251 ----
  } glitz_vec4_t;
  
+ #define GLITZ_TEXTURE_FLAG_ALLOCATED_MASK     (1L <<  0)
+ #define GLITZ_TEXTURE_FLAG_REPEATABLE_MASK    (1L <<  1)
+ #define GLITZ_TEXTURE_FLAG_PADABLE_MASK       (1L <<  2)
+ 
+ #define TEXTURE_ALLOCATED(texture) \
+   ((texture)->flags & GLITZ_TEXTURE_FLAG_ALLOCATED_MASK)
+ 
+ #define TEXTURE_REPEATABLE(texture) \
+   ((texture)->flags & GLITZ_TEXTURE_FLAG_REPEATABLE_MASK)
+ 
+ #define TEXTURE_PADABLE(texture) \
+   ((texture)->flags & GLITZ_TEXTURE_FLAG_PADABLE_MASK)
+ 
  typedef struct _glitz_texture {
    glitz_gl_uint_t name;
    glitz_gl_enum_t target;
    glitz_gl_enum_t format;
!   unsigned long flags;
    
    glitz_gl_enum_t filter;
***************
*** 246,255 ****
    unsigned int height;
  
!   glitz_float_t texcoord_width;
!   glitz_float_t texcoord_height;
    glitz_float_t texcoord_width_unit;
    glitz_float_t texcoord_height_unit;
- 
-   glitz_bool_t repeatable;
  } glitz_texture_t;
  
--- 255,262 ----
    unsigned int height;
  
!   glitz_bounding_box_t box;
!   
    glitz_float_t texcoord_width_unit;
    glitz_float_t texcoord_height_unit;
  } glitz_texture_t;
  
***************
*** 311,376 ****
  } glitz_surface_backend_t;
  
! #define GLITZ_FLAG_SOLID_MASK                   (1L <<  0)
! #define GLITZ_FLAG_OFFSCREEN_MASK               (1L <<  1)
! #define GLITZ_FLAG_REPEAT_MASK                  (1L <<  2)
! #define GLITZ_FLAG_MIRRORED_MASK                (1L <<  3)
! #define GLITZ_FLAG_PAD_MASK                     (1L <<  4)
! #define GLITZ_FLAG_DIRTY_MASK                   (1L <<  5)
! #define GLITZ_FLAG_COMPONENT_ALPHA_MASK         (1L <<  6)
! #define GLITZ_FLAG_MULTISAMPLE_MASK             (1L <<  7)
! #define GLITZ_FLAG_NICEST_MULTISAMPLE_MASK      (1L <<  8)
! #define GLITZ_FLAG_SOLID_DIRTY_MASK             (1L <<  9)
! #define GLITZ_FLAG_DRAWABLE_DIRTY_MASK          (1L << 10)
! #define GLITZ_FLAG_FRAGMENT_FILTER_MASK         (1L << 11)
! #define GLITZ_FLAG_LINEAR_TRANSFORM_FILTER_MASK (1L << 12)
! #define GLITZ_FLAG_DRAWABLE_MASK                (1L << 13)
! #define GLITZ_FLAG_IGNORE_REPEAT_MASK           (1L << 14)
! #define GLITZ_FLAG_TEXTURE_COORDS_MASK          (1L << 15)
  
  #define SURFACE_OFFSCREEN(surface) \
!   ((surface)->flags & GLITZ_FLAG_OFFSCREEN_MASK)
  
  #define SURFACE_SOLID(surface) \
!   ((surface)->flags & GLITZ_FLAG_SOLID_MASK)
  
  #define SURFACE_REPEAT(surface) \
!   (((surface)->flags & GLITZ_FLAG_REPEAT_MASK) && \
!    (!((surface)->flags & GLITZ_FLAG_IGNORE_REPEAT_MASK)))
  
  #define SURFACE_MIRRORED(surface) \
!   ((surface)->flags & GLITZ_FLAG_MIRRORED_MASK)
  
  #define SURFACE_PAD(surface) \
!   ((surface)->flags & GLITZ_FLAG_PAD_MASK)
  
  #define SURFACE_DIRTY(surface) \
!   ((surface)->flags & GLITZ_FLAG_DIRTY_MASK)
  
  #define SURFACE_COMPONENT_ALPHA(surface) \
!   ((surface)->flags & GLITZ_FLAG_COMPONENT_ALPHA_MASK)
  
  #define SURFACE_MULTISAMPLE(surface) \
!   ((surface)->flags & GLITZ_FLAG_MULTISAMPLE_MASK)
  
  #define SURFACE_NICEST_MULTISAMPLE(surface) \
!   ((surface)->flags & GLITZ_FLAG_NICEST_MULTISAMPLE_MASK)
  
  #define SURFACE_SOLID_DIRTY(surface) \
!   ((surface)->flags & GLITZ_FLAG_SOLID_DIRTY_MASK)
  
  #define SURFACE_DRAWABLE_DIRTY(surface) \
!   ((surface)->flags & GLITZ_FLAG_DRAWABLE_DIRTY_MASK)
  
  #define SURFACE_FRAGMENT_FILTER(surface) \
!   ((surface)->flags & GLITZ_FLAG_FRAGMENT_FILTER_MASK)
  
  #define SURFACE_LINEAR_TRANSFORM_FILTER(surface) \
!   ((surface)->flags & GLITZ_FLAG_LINEAR_TRANSFORM_FILTER_MASK)
  
  #define SURFACE_DRAWABLE(surface) \
!   ((surface)->flags & GLITZ_FLAG_DRAWABLE_MASK)
  
  #define SURFACE_TEXTURE_COORDS(surface) \
!   ((surface)->flags & GLITZ_FLAG_TEXTURE_COORDS_MASK)
  
  typedef struct _glitz_sample_offset {
--- 318,387 ----
  } glitz_surface_backend_t;
  
! #define GLITZ_SURFACE_FLAG_SOLID_MASK                   (1L <<  0)
! #define GLITZ_SURFACE_FLAG_OFFSCREEN_MASK               (1L <<  1)
! #define GLITZ_SURFACE_FLAG_REPEAT_MASK                  (1L <<  2)
! #define GLITZ_SURFACE_FLAG_MIRRORED_MASK                (1L <<  3)
! #define GLITZ_SURFACE_FLAG_PAD_MASK                     (1L <<  4)
! #define GLITZ_SURFACE_FLAG_DIRTY_MASK                   (1L <<  5)
! #define GLITZ_SURFACE_FLAG_COMPONENT_ALPHA_MASK         (1L <<  6)
! #define GLITZ_SURFACE_FLAG_MULTISAMPLE_MASK             (1L <<  7)
! #define GLITZ_SURFACE_FLAG_NICEST_MULTISAMPLE_MASK      (1L <<  8)
! #define GLITZ_SURFACE_FLAG_SOLID_DIRTY_MASK             (1L <<  9)
! #define GLITZ_SURFACE_FLAG_DRAWABLE_DIRTY_MASK          (1L << 10)
! #define GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK         (1L << 11)
! #define GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK (1L << 12)
! #define GLITZ_SURFACE_FLAG_DRAWABLE_MASK                (1L << 13)
! #define GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK           (1L << 14)
! #define GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK          (1L << 15)
! #define GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK        (1L << 16)
  
  #define SURFACE_OFFSCREEN(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_OFFSCREEN_MASK)
  
  #define SURFACE_SOLID(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_SOLID_MASK)
  
  #define SURFACE_REPEAT(surface) \
!   (((surface)->flags & GLITZ_SURFACE_FLAG_REPEAT_MASK) && \
!    (!((surface)->flags & GLITZ_SURFACE_FLAG_IGNORE_REPEAT_MASK)))
  
  #define SURFACE_MIRRORED(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_MIRRORED_MASK)
  
  #define SURFACE_PAD(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_PAD_MASK)
  
  #define SURFACE_DIRTY(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_DIRTY_MASK)
  
  #define SURFACE_COMPONENT_ALPHA(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_COMPONENT_ALPHA_MASK)
  
  #define SURFACE_MULTISAMPLE(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_MULTISAMPLE_MASK)
  
  #define SURFACE_NICEST_MULTISAMPLE(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_NICEST_MULTISAMPLE_MASK)
  
  #define SURFACE_SOLID_DIRTY(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_SOLID_DIRTY_MASK)
  
  #define SURFACE_DRAWABLE_DIRTY(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_DRAWABLE_DIRTY_MASK)
  
  #define SURFACE_FRAGMENT_FILTER(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_FRAGMENT_FILTER_MASK)
  
  #define SURFACE_LINEAR_TRANSFORM_FILTER(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_LINEAR_TRANSFORM_FILTER_MASK)
  
  #define SURFACE_DRAWABLE(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_DRAWABLE_MASK)
  
  #define SURFACE_TEXTURE_COORDS(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_TEXTURE_COORDS_MASK)
! 
! #define SURFACE_SIMPLE_TRANSFORM(surface) \
!   ((surface)->flags & GLITZ_SURFACE_FLAG_SIMPLE_TRANSFORM_MASK)
  
  typedef struct _glitz_sample_offset {
***************
*** 422,426 ****
  typedef void (*glitz_combine_function_t) (glitz_composite_op_t *);
  
! typedef struct _glitz_render_t {
    glitz_combine_type_t type;
    glitz_combine_function_t enable;
--- 433,437 ----
  typedef void (*glitz_combine_function_t) (glitz_composite_op_t *);
  
! typedef struct _glitz_combine_t {
    glitz_combine_type_t type;
    glitz_combine_function_t enable;
***************
*** 488,492 ****
                      unsigned int height,
                      unsigned int texture_format,
!                     unsigned long target_mask);
  
  void
--- 499,503 ----
                      unsigned int height,
                      unsigned int texture_format,
!                     unsigned long feature_mask);
  
  void
***************
*** 531,535 ****
                             int x_src,
                             int y_src,
-                            int height,
                             unsigned long flags);
  
--- 542,545 ----
***************
*** 539,544 ****
                      glitz_format_t *format,
                      int width,
!                     int height,
!                     unsigned long texture_mask);
  
  void
--- 549,553 ----
                      glitz_format_t *format,
                      int width,
!                     int height);
  
  void




More information about the cairo-commit mailing list