[cairo-commit] glitz/src glitz-agl.h, 1.2, 1.3 glitz-glx.h, 1.2, 1.3 glitz.c, 1.10, 1.11 glitz.h, 1.10, 1.11 glitz_agl_context.c, 1.3, 1.4 glitz_agl_format.c, 1.2, 1.3 glitz_agl_surface.c, 1.8, 1.9 glitz_aglint.h, 1.5, 1.6 glitz_format.c, 1.3, 1.4 glitz_glx_format.c, 1.5, 1.6 glitz_glx_surface.c, 1.10, 1.11 glitz_programmatic.c, 1.6, 1.7 glitz_surface.c, 1.11, 1.12 glitz_trap.c, 1.4, 1.5 glitz_tri.c, 1.4, 1.5 glitzint.h, 1.14, 1.15

David Reveman commit at pdx.freedesktop.org
Mon May 24 00:16:45 PDT 2004


Committed by: davidr

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

Modified Files:
	glitz-agl.h glitz-glx.h glitz.c glitz.h glitz_agl_context.c 
	glitz_agl_format.c glitz_agl_surface.c glitz_aglint.h 
	glitz_format.c glitz_glx_format.c glitz_glx_surface.c 
	glitz_programmatic.c glitz_surface.c glitz_trap.c glitz_tri.c 
	glitzint.h 
Log Message:
Added support for read-only surfaces

Index: glitz-agl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz-agl.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz-agl.h	9 May 2004 20:54:51 -0000	1.2
--- b/glitz-agl.h	24 May 2004 07:16:42 -0000	1.3
***************
*** 54,58 ****
    
  glitz_format_t *
! glitz_agl_find_standard_format (unsigned long options,
                                  glitz_format_name_t format_name);
  
--- 54,58 ----
    
  glitz_format_t *
! glitz_agl_find_standard_format (unsigned long option_mask,
                                  glitz_format_name_t format_name);
  

Index: glitz-glx.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz-glx.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz-glx.h	9 May 2004 20:54:51 -0000	1.2
--- b/glitz-glx.h	24 May 2004 07:16:42 -0000	1.3
***************
*** 59,63 ****
  glitz_glx_find_standard_format (Display *display,
                                  int screen,
!                                 unsigned long options,
                                  glitz_format_name_t format_name);
  
--- 59,63 ----
  glitz_glx_find_standard_format (Display *display,
                                  int screen,
!                                 unsigned long option_mask,
                                  glitz_format_name_t format_name);
  

Index: glitz.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** a/glitz.c	20 May 2004 00:00:06 -0000	1.10
--- b/glitz.c	24 May 2004 07:16:42 -0000	1.11
***************
*** 464,472 ****
        
        mask_surface = intermediate =
!         glitz_int_surface_create_similar (dst,
!                                           GLITZ_STANDARD_ARGB32,
!                                           1,
!                                           mask_bounds.x2 - mask_bounds.x1,
!                                           mask_bounds.y2 - mask_bounds.y1);
        
        if (!mask_surface) {
--- 464,470 ----
        
        mask_surface = intermediate =
!         glitz_surface_create_intermediate (dst, GLITZ_INTERMEDIATE_RGBA,
!                                            mask_bounds.x2 - mask_bounds.x1,
!                                            mask_bounds.y2 - mask_bounds.y1);
        
        if (!mask_surface) {
***************
*** 899,903 ****
  
        gl->disable (GLITZ_GL_SCISSOR_TEST);
!       gl->disable (GLITZ_GL_DITHER);    
        glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
        
--- 897,902 ----
  
        gl->disable (GLITZ_GL_SCISSOR_TEST);
!       gl->disable (GLITZ_GL_DITHER);
!       gl->disable (GLITZ_GL_STENCIL_TEST);
        glitz_set_operator (gl, GLITZ_OPERATOR_SRC);
        

Index: glitz.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** a/glitz.h	20 May 2004 00:05:43 -0000	1.10
--- b/glitz.h	24 May 2004 07:16:42 -0000	1.11
***************
*** 163,170 ****
  #define GLITZ_FORMAT_STENCIL_SIZE_MASK        (1L << 11)
  #define GLITZ_FORMAT_DOUBLEBUFFER_MASK        (1L << 12)
! #define GLITZ_FORMAT_ONSCREEN_MASK            (1L << 13)
! #define GLITZ_FORMAT_OFFSCREEN_MASK           (1L << 14)
! #define GLITZ_FORMAT_MULTISAMPLE_MASK         (1L << 15)
! #define GLITZ_FORMAT_MULTISAMPLE_SAMPLES_MASK (1L << 16)
  
  typedef unsigned long int glitz_format_id_t;
--- 163,172 ----
  #define GLITZ_FORMAT_STENCIL_SIZE_MASK        (1L << 11)
  #define GLITZ_FORMAT_DOUBLEBUFFER_MASK        (1L << 12)
! #define GLITZ_FORMAT_READ_ONSCREEN_MASK       (1L << 13)
! #define GLITZ_FORMAT_READ_OFFSCREEN_MASK      (1L << 14)
! #define GLITZ_FORMAT_DRAW_ONSCREEN_MASK       (1L << 15)
! #define GLITZ_FORMAT_DRAW_OFFSCREEN_MASK      (1L << 16)
! #define GLITZ_FORMAT_MULTISAMPLE_MASK         (1L << 17)
! #define GLITZ_FORMAT_MULTISAMPLE_SAMPLES_MASK (1L << 18)
  
  typedef unsigned long int glitz_format_id_t;
***************
*** 198,202 ****
    
    glitz_bool_t doublebuffer;
!   glitz_drawable_type_t drawable;
    glitz_multisample_format_t multisample;
  } glitz_format_t;
--- 200,205 ----
    
    glitz_bool_t doublebuffer;
!   glitz_drawable_type_t read;
!   glitz_drawable_type_t draw;
    glitz_multisample_format_t multisample;
  } glitz_format_t;
***************
*** 208,211 ****
--- 211,215 ----
  #define GLITZ_FORMAT_OPTION_MULTISAMPLE_MASK    (1L << 4)
  #define GLITZ_FORMAT_OPTION_NO_MULTISAMPLE_MASK (1L << 5)
+ #define GLITZ_FORMAT_OPTION_READONLY_MASK       (1L << 6)
  
  /* glitz_status.c */
***************
*** 395,404 ****
  glitz_surface_get_format (glitz_surface_t *surface);
  
  glitz_surface_t *
  glitz_surface_create_similar (glitz_surface_t *templ,
!                               glitz_format_name_t format,
                                int width,
                                int height);
!   
  #define GLITZ_HINT_CLIPPING_MASK     (1L << 0)
  #define GLITZ_HINT_OFFSCREEN_MASK    (1L << 1)
--- 399,419 ----
  glitz_surface_get_format (glitz_surface_t *surface);
  
+ glitz_format_t *
+ glitz_surface_find_similar_standard_format (glitz_surface_t *surface,
+                                             unsigned long option_mask,
+                                             glitz_format_name_t format_name);
+ 
+ glitz_format_t *
+ glitz_surface_find_similar_format (glitz_surface_t *surface,
+                                    unsigned long mask,
+                                    const glitz_format_t *templ,
+                                    int count);
+ 
  glitz_surface_t *
  glitz_surface_create_similar (glitz_surface_t *templ,
!                               glitz_format_t *format,
                                int width,
                                int height);
! 
  #define GLITZ_HINT_CLIPPING_MASK     (1L << 0)
  #define GLITZ_HINT_OFFSCREEN_MASK    (1L << 1)

Index: glitz_agl_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_context.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_agl_context.c	18 May 2004 15:01:50 -0000	1.3
--- b/glitz_agl_context.c	24 May 2004 07:16:42 -0000	1.4
***************
*** 130,134 ****
  {
    AGLContext context = aglGetCurrentContext ();
!   
    switch (constraint) {
    case GLITZ_CN_NONE:
--- 130,134 ----
  {
    AGLContext context = aglGetCurrentContext ();
! 
    switch (constraint) {
    case GLITZ_CN_NONE:

Index: glitz_agl_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_format.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** a/glitz_agl_format.c	1 May 2004 20:36:34 -0000	1.2
--- b/glitz_agl_format.c	24 May 2004 07:16:42 -0000	1.3
***************
*** 285,293 ****
      format.id = (unsigned long int) pixel_format;
  
!     format.drawable.onscreen = 1;
      if (thread_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK)
!       format.drawable.offscreen = 1;
      else
!       format.drawable.offscreen = 0;
        
      aglDescribePixelFormat (pixel_format, AGL_RED_SIZE, &value);
--- 285,293 ----
      format.id = (unsigned long int) pixel_format;
  
!     format.read.onscreen = format.draw.onscreen = 1;
      if (thread_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK)
!       format.read.offscreen = format.draw.offscreen = 1;
      else
!       format.read.offscreen = format.draw.offscreen = 0;
        
      aglDescribePixelFormat (pixel_format, AGL_RED_SIZE, &value);
***************
*** 313,317 ****
          if (!(thread_info->feature_mask &
                GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK))
!           format.drawable.offscreen = 0;
        }
      } else {
--- 313,317 ----
          if (!(thread_info->feature_mask &
                GLITZ_FEATURE_OFFSCREEN_MULTISAMPLE_MASK))
!           format.read.offscreen = format.draw.offscreen = 0;
        }
      } else {
***************
*** 344,362 ****
      
      thread_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
-     
-     /* Adding fake offscreen formats. Surfaces created with these format can
-        only be used with draw/read pixel functions and as source in composite
-        functions. */
-     memset (&format, 0, sizeof (glitz_format_t));
-     format.drawable.offscreen = 1;
-     format.alpha_size = format.red_size = format.green_size =
-       format.blue_size = 8;
-     _glitz_add_format (thread_info, &format);
-     format.alpha_size = 0;
-     _glitz_add_format (thread_info, &format);
-     format.alpha_size = 8;
-     format.red_size = format.green_size = format.blue_size = 0;
-     _glitz_add_format (thread_info, &format);
    }
    
    _glitz_move_out_ids (thread_info);
--- 344,361 ----
      
      thread_info->feature_mask &= ~GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK;
    }
+ 
+   /* Adding read only offscreen formats. Surfaces created with these format
+      can only be used with draw/read pixel functions and as source. */
+   memset (&format, 0, sizeof (glitz_format_t));
+   format.read.offscreen = 1;
+   format.alpha_size = format.red_size = format.green_size =
+     format.blue_size = 8;
+   _glitz_add_format (thread_info, &format);
+   format.alpha_size = 0;
+   _glitz_add_format (thread_info, &format);
+   format.alpha_size = 8;
+   format.red_size = format.green_size = format.blue_size = 0;
+   _glitz_add_format (thread_info, &format);
    
    _glitz_move_out_ids (thread_info);
***************
*** 376,380 ****
  
  glitz_format_t *
! glitz_agl_find_standard_format (unsigned long options,
                                  glitz_format_name_t format_name)
  {
--- 375,379 ----
  
  glitz_format_t *
! glitz_agl_find_standard_format (unsigned long option_mask,
                                  glitz_format_name_t format_name)
  {
***************
*** 383,387 ****
    return
      glitz_format_find_standard (thread_info->formats, thread_info->n_formats,
!                                 options, format_name);
  }
  slim_hidden_def(glitz_agl_find_standard_format);
--- 382,386 ----
    return
      glitz_format_find_standard (thread_info->formats, thread_info->n_formats,
!                                 option_mask, format_name);
  }
  slim_hidden_def(glitz_agl_find_standard_format);

Index: glitz_agl_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_agl_surface.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** a/glitz_agl_surface.c	18 May 2004 15:01:50 -0000	1.8
--- b/glitz_agl_surface.c	24 May 2004 07:16:42 -0000	1.9
***************
*** 36,41 ****
  static glitz_surface_t *
  _glitz_agl_surface_create_similar (void *abstract_templ,
!                                    glitz_format_name_t format_name,
!                                    glitz_bool_t drawable,
                                     int width,
                                     int height);
--- 36,40 ----
  static glitz_surface_t *
  _glitz_agl_surface_create_similar (void *abstract_templ,
!                                    glitz_format_t *format,
                                     int width,
                                     int height);
***************
*** 119,123 ****
          surface->bound_buffer = surface->base.read_buffer;
        }
!       
        return &surface->base.texture;
      } else 
--- 118,122 ----
          surface->bound_buffer = surface->base.read_buffer;
        }
! 
        return &surface->base.texture;
      } else 
***************
*** 202,205 ****
--- 201,206 ----
                        &_glitz_agl_gl_proc_address,
                        format,
+                       thread_info->formats,
+                       thread_info->n_formats,
                        width,
                        height,
***************
*** 214,218 ****
    _glitz_agl_set_features (surface);
  
!   if (thread_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK) {
      surface->pbuffer = glitz_agl_pbuffer_create (&surface->base.texture);
      if (surface->pbuffer) {
--- 215,219 ----
    _glitz_agl_set_features (surface);
  
!   if (surface->base.format->draw.offscreen) {
      surface->pbuffer = glitz_agl_pbuffer_create (&surface->base.texture);
      if (surface->pbuffer) {
***************
*** 264,267 ****
--- 265,270 ----
                        &_glitz_agl_gl_proc_address,
                        format,
+                       thread_info->formats,
+                       thread_info->n_formats,
                        width,
                        height,
***************
*** 282,308 ****
  static glitz_surface_t *
  _glitz_agl_surface_create_similar (void *abstract_templ,
!                                    glitz_format_name_t format_name,
!                                    glitz_bool_t drawable,
                                     int width,
                                     int height)
  {
    glitz_agl_surface_t *templ = (glitz_agl_surface_t *) abstract_templ;
-   
-   if ((!drawable) ||
-       (templ->thread_info->agl_feature_mask &
-        GLITZ_AGL_FEATURE_PBUFFER_MASK)) {
-     glitz_format_t *format;
  
!     format = glitz_format_find_standard (templ->thread_info->formats,
!                                          templ->thread_info->n_formats,
!                                          GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
!                                          format_name);
!     
!     if (format)
!       return _glitz_agl_surface_create (templ->thread_info, format,
!                                         width, height);
!   }
!       
!   return NULL;
  }
  
--- 285,298 ----
  static glitz_surface_t *
  _glitz_agl_surface_create_similar (void *abstract_templ,
!                                    glitz_format_t *format,
                                     int width,
                                     int height)
  {
    glitz_agl_surface_t *templ = (glitz_agl_surface_t *) abstract_templ;
  
!   if (!format->read.offscreen)
!     return NULL;
!   
!   return _glitz_agl_surface_create (templ->thread_info, format, width, height);
  }
  
***************
*** 321,328 ****
        
        if (pbuffer == surface->pbuffer)
!         glitz_agl_context_make_current (surface);
      } else if (surface->drawable) {
        if (aglGetDrawable (context) == surface->drawable)
!         glitz_agl_context_make_current (surface);
      }
    }
--- 311,318 ----
        
        if (pbuffer == surface->pbuffer)
!         glitz_agl_context_make_current (surface, 0);
      } else if (surface->drawable) {
        if (aglGetDrawable (context) == surface->drawable)
!         glitz_agl_context_make_current (surface, 0);
      }
    }

Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_aglint.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glitz_aglint.h	18 May 2004 15:01:50 -0000	1.5
--- b/glitz_aglint.h	24 May 2004 07:16:42 -0000	1.6
***************
*** 108,112 ****
  
  extern void __internal_linkage
! glitz_agl_context_make_current (glitz_agl_surface_t *surface);
  
  extern glitz_agl_surface_t *__internal_linkage
--- 108,113 ----
  
  extern void __internal_linkage
! glitz_agl_context_make_current (glitz_agl_surface_t *surface,
!                                 glitz_bool_t flush);
  
  extern glitz_agl_surface_t *__internal_linkage

Index: glitz_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_format.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** a/glitz_format.c	1 May 2004 20:36:34 -0000	1.3
--- b/glitz_format.c	24 May 2004 07:16:42 -0000	1.4
***************
*** 102,111 ****
          continue;
  
!     if (mask & GLITZ_FORMAT_ONSCREEN_MASK)
!       if (templ->drawable.onscreen != formats->drawable.onscreen)
          continue;
      
!     if (mask & GLITZ_FORMAT_OFFSCREEN_MASK)
!       if (templ->drawable.offscreen != formats->drawable.offscreen)
          continue;
  
--- 102,119 ----
          continue;
  
!     if (mask & GLITZ_FORMAT_READ_ONSCREEN_MASK)
!       if (templ->read.onscreen != formats->read.onscreen)
          continue;
      
!     if (mask & GLITZ_FORMAT_READ_OFFSCREEN_MASK)
!       if (templ->read.offscreen != formats->read.offscreen)
!         continue;
! 
!     if (mask & GLITZ_FORMAT_DRAW_ONSCREEN_MASK)
!       if (templ->draw.onscreen != formats->draw.onscreen)
!         continue;
!     
!     if (mask & GLITZ_FORMAT_DRAW_OFFSCREEN_MASK)
!       if (templ->draw.offscreen != formats->draw.offscreen)
          continue;
  
***************
*** 134,144 ****
  
    if (options & GLITZ_FORMAT_OPTION_ONSCREEN_MASK) {
!     format->drawable.onscreen = 1;
!     *mask |= GLITZ_FORMAT_ONSCREEN_MASK;
    }
  
    if (options & GLITZ_FORMAT_OPTION_OFFSCREEN_MASK) {
!     format->drawable.offscreen = 1;
!     *mask |= GLITZ_FORMAT_OFFSCREEN_MASK;
    }
  
--- 142,152 ----
  
    if (options & GLITZ_FORMAT_OPTION_ONSCREEN_MASK) {
!     format->draw.onscreen = 1;
!     *mask |= GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
    }
  
    if (options & GLITZ_FORMAT_OPTION_OFFSCREEN_MASK) {
!     format->read.offscreen = 1;
!     *mask |= GLITZ_FORMAT_READ_OFFSCREEN_MASK;
    }
  
***************
*** 152,155 ****
--- 160,169 ----
      *mask |= GLITZ_FORMAT_MULTISAMPLE_MASK;
    }
+ 
+   if (options & GLITZ_FORMAT_OPTION_READONLY_MASK) {
+     format->draw.offscreen = format->draw.onscreen = 0;
+     *mask |= GLITZ_FORMAT_DRAW_ONSCREEN_MASK;
+     *mask |= GLITZ_FORMAT_DRAW_OFFSCREEN_MASK;
+   }
  }
  

Index: glitz_glx_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_format.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** a/glitz_glx_format.c	9 May 2004 20:54:51 -0000	1.5
--- b/glitz_glx_format.c	24 May 2004 07:16:42 -0000	1.6
***************
*** 57,66 ****
      if (format[i]->doublebuffer)
        score[i] += 10;
!     if (format[i]->drawable.onscreen)
        score[i] += 10;
!     if (format[i]->drawable.offscreen)
        score[i] += 10;
!     if (format[i]->drawable.offscreen &&
!         format[i]->drawable.onscreen)
        score[i] += 5;
      if (format[i]->multisample.supported) 
--- 57,65 ----
      if (format[i]->doublebuffer)
        score[i] += 10;
!     if (format[i]->draw.onscreen)
        score[i] += 10;
!     if (format[i]->draw.offscreen)
        score[i] += 10;
!     if (format[i]->draw.offscreen && format[i]->draw.onscreen)
        score[i] += 5;
      if (format[i]->multisample.supported) 
***************
*** 120,125 ****
  
    /* Offscreen drawing never supported if GLX is older than 1.3 */
!   format.drawable.offscreen = 0;
!   format.drawable.onscreen = 1;
  
    for (i = 0; i < num_visuals; i++) {
--- 119,124 ----
  
    /* Offscreen drawing never supported if GLX is older than 1.3 */
!   format.draw.offscreen = 0;
!   format.draw.onscreen = format.read.onscreen = 1;
  
    for (i = 0; i < num_visuals; i++) {
***************
*** 225,230 ****
        continue;
      
!     format.drawable.onscreen = (value & GLX_WINDOW_BIT)? 1: 0;
!     format.drawable.offscreen = (value & GLX_PBUFFER_BIT)? 1: 0;
      
      glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_FBCONFIG_ID, &value);
--- 224,231 ----
        continue;
      
!     format.read.onscreen = format.draw.onscreen =
!       (value & GLX_WINDOW_BIT)? 1: 0;
!     format.read.offscreen = format.draw.offscreen =
!       (value & GLX_PBUFFER_BIT)? 1: 0;
      
      glx->get_fbconfig_attrib (display, fbconfigs[i], GLX_FBCONFIG_ID, &value);
***************
*** 283,289 ****
  
  static void
! glitz_glx_use_fake_offscreen_formats (glitz_glx_screen_info_t *screen_info)
  {
-   glitz_format_t format;
    glitz_format_t *formats = screen_info->formats;
    int n_formats = screen_info->n_formats;
--- 284,289 ----
  
  static void
! glitz_glx_remove_offscreen_drawing (glitz_glx_screen_info_t *screen_info)
  {
    glitz_format_t *formats = screen_info->formats;
    int n_formats = screen_info->n_formats;
***************
*** 292,310 ****
  
    for (; n_formats; n_formats--, formats++)
!     formats->drawable.offscreen = 0;
!   
!   /* Adding fake offscreen formats. Surfaces created with these format can
!      only be used with draw/read pixel functions and as source in composite
!      functions. */
!   memset (&format, 0, sizeof (glitz_format_t));
!   format.drawable.offscreen = 1;
!   format.alpha_size = format.red_size = format.green_size =
!     format.blue_size = 8;
!   _glitz_add_format (screen_info, &format);
!   format.alpha_size = 0;
!   _glitz_add_format (screen_info, &format);
!   format.alpha_size = 8;
!   format.red_size = format.green_size = format.blue_size = 0;
!   _glitz_add_format (screen_info, &format);
  }
  
--- 292,296 ----
  
    for (; n_formats; n_formats--, formats++)
!     formats->draw.offscreen = 0;
  }
  
***************
*** 313,317 ****
  {
    glitz_bool_t status = 1;
!   glitz_format_t *format;
  
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_GLX13_MASK)
--- 299,304 ----
  {
    glitz_bool_t status = 1;
!   glitz_format_t *formats;
!   glitz_format_t format;
  
    if (screen_info->glx_feature_mask & GLITZ_GLX_FEATURE_GLX13_MASK)
***************
*** 321,332 ****
      glitz_glx_query_formats_glx12 (screen_info);
    
!   format = glitz_format_find_standard (screen_info->formats,
!                                        screen_info->n_formats,
!                                        GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
!                                        GLITZ_STANDARD_ARGB32);
  
!   if (format == NULL ||
!       glitz_glx_ensure_pbuffer_support (screen_info, format->id))
!     glitz_glx_use_fake_offscreen_formats (screen_info);
    
    _glitz_move_out_ids (screen_info);
--- 308,332 ----
      glitz_glx_query_formats_glx12 (screen_info);
    
!   formats = glitz_format_find_standard (screen_info->formats,
!                                         screen_info->n_formats,
!                                         GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
!                                         GLITZ_STANDARD_ARGB32);
  
!   if (formats == NULL ||
!       glitz_glx_ensure_pbuffer_support (screen_info, formats->id))
!     glitz_glx_remove_offscreen_drawing (screen_info);
! 
!   /* Adding read only offscreen formats. Surfaces created with these format
!      can only be used with draw/read pixel functions and as source. */
!   memset (&format, 0, sizeof (glitz_format_t));
!   format.read.offscreen = 1;
!   format.alpha_size = format.red_size = format.green_size =
!     format.blue_size = 8;
!   _glitz_add_format (screen_info, &format);
!   format.alpha_size = 0;
!   _glitz_add_format (screen_info, &format);
!   format.alpha_size = 8;
!   format.red_size = format.green_size = format.blue_size = 0;
!   _glitz_add_format (screen_info, &format);
    
    _glitz_move_out_ids (screen_info);
***************
*** 351,355 ****
  glitz_glx_find_standard_format (Display *display,
                                  int screen,
!                                 unsigned long options,
                                  glitz_format_name_t format_name)
  {
--- 351,355 ----
  glitz_glx_find_standard_format (Display *display,
                                  int screen,
!                                 unsigned long option_mask,
                                  glitz_format_name_t format_name)
  {
***************
*** 359,363 ****
    return
      glitz_format_find_standard (screen_info->formats, screen_info->n_formats,
!                                 options, format_name);
  }
  slim_hidden_def(glitz_glx_find_standard_format);
--- 359,363 ----
    return
      glitz_format_find_standard (screen_info->formats, screen_info->n_formats,
!                                 option_mask, format_name);
  }
  slim_hidden_def(glitz_glx_find_standard_format);

Index: glitz_glx_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_glx_surface.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** a/glitz_glx_surface.c	18 May 2004 15:01:50 -0000	1.10
--- b/glitz_glx_surface.c	24 May 2004 07:16:42 -0000	1.11
***************
*** 34,39 ****
  static glitz_surface_t *
  _glitz_glx_surface_create_similar (void *abstract_templ,
!                                    glitz_format_name_t format_name,
!                                    glitz_bool_t drawable,
                                     int width,
                                     int height);
--- 34,38 ----
  static glitz_surface_t *
  _glitz_glx_surface_create_similar (void *abstract_templ,
!                                    glitz_format_t *format,
                                     int width,
                                     int height);
***************
*** 235,238 ****
--- 234,239 ----
                        &context->gl,
                        format,
+                       screen_info->formats,
+                       screen_info->n_formats,
                        width,
                        height,
***************
*** 245,249 ****
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
!   if (screen_info->feature_mask & GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK) {
      glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
      
--- 246,250 ----
    surface->base.hint_mask |= GLITZ_HINT_OFFSCREEN_MASK;
  
!   if (surface->base.format->draw.offscreen) {
      glitz_surface_push_current (&surface->base, GLITZ_CN_ANY_CONTEXT_CURRENT);
      
***************
*** 304,307 ****
--- 305,310 ----
                        &context->gl,
                        format,
+                       screen_info->formats,
+                       screen_info->n_formats,
                        width,
                        height,
***************
*** 321,345 ****
  static glitz_surface_t *
  _glitz_glx_surface_create_similar (void *abstract_templ,
!                                    glitz_format_name_t format_name,
!                                    glitz_bool_t drawable,
                                     int width,
                                     int height)
  {
    glitz_glx_surface_t *templ = (glitz_glx_surface_t *) abstract_templ;
    
!   if ((!drawable) || (templ->screen_info->feature_mask &
!                       GLITZ_FEATURE_OFFSCREEN_DRAWING_MASK)) {
!     glitz_format_t *format;
!     
!     format = glitz_format_find_standard (templ->screen_info->formats,
!                                          templ->screen_info->n_formats,
!                                          GLITZ_FORMAT_OPTION_OFFSCREEN_MASK,
!                                          format_name);
!     if (format)
!       return _glitz_glx_surface_create (templ->screen_info, format,
!                                         width, height);
!   }
!   
!   return NULL;
  }
  
--- 324,337 ----
  static glitz_surface_t *
  _glitz_glx_surface_create_similar (void *abstract_templ,
!                                    glitz_format_t *format,
                                     int width,
                                     int height)
  {
    glitz_glx_surface_t *templ = (glitz_glx_surface_t *) abstract_templ;
+ 
+   if (!format->read.offscreen)
+     return NULL;
    
!   return _glitz_glx_surface_create (templ->screen_info, format, width, height);
  }
  

Index: glitz_programmatic.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_programmatic.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** a/glitz_programmatic.c	18 May 2004 15:01:50 -0000	1.6
--- b/glitz_programmatic.c	24 May 2004 07:16:42 -0000	1.7
***************
*** 36,41 ****
  static glitz_surface_t *
  _glitz_programmatic_surface_create_similar (void *abstract_templ,
!                                             glitz_format_name_t format_name,
!                                             glitz_bool_t drawable,
                                              int width,
                                              int height)
--- 36,40 ----
  static glitz_surface_t *
  _glitz_programmatic_surface_create_similar (void *abstract_templ,
!                                             glitz_format_t *format,
                                              int width,
                                              int height)
***************
*** 132,136 ****
    glitz_surface_init (&surface->base,
                        &glitz_programmatic_surface_backend,
!                       NULL, NULL, MAXSHORT, MAXSHORT, NULL, 0);
  
    surface->base.hint_mask |= GLITZ_HINT_PROGRAMMATIC_MASK;
--- 131,135 ----
    glitz_surface_init (&surface->base,
                        &glitz_programmatic_surface_backend,
!                       NULL, NULL, NULL, 0, MAXSHORT, MAXSHORT, NULL, 0);
  
    surface->base.hint_mask |= GLITZ_HINT_PROGRAMMATIC_MASK;

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** a/glitz_surface.c	20 May 2004 00:00:06 -0000	1.11
--- b/glitz_surface.c	24 May 2004 07:16:42 -0000	1.12
***************
*** 40,43 ****
--- 40,45 ----
                      glitz_gl_proc_address_list_t *gl,
                      glitz_format_t *format,
+                     glitz_format_t *formats,
+                     int n_formats,
                      int width,
                      int height,
***************
*** 53,56 ****
--- 55,60 ----
    surface->programs = programs;
    surface->format = format;
+   surface->formats = formats;
+   surface->n_formats = n_formats;
    surface->width = width;
    surface->height = height;
***************
*** 85,119 ****
  }
  
! glitz_surface_t *
! glitz_int_surface_create_similar (glitz_surface_t *templ,
!                                   glitz_format_name_t format_name,
!                                   glitz_bool_t drawable,
!                                   int width,
!                                   int height)
  {
!   glitz_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;
!   
!   return surface;
  }
  
  glitz_surface_t *
  glitz_surface_create_similar (glitz_surface_t *templ,
!                               glitz_format_name_t format_name,
                                int width,
                                int height)
  {
!   return
!     glitz_int_surface_create_similar (templ, format_name, 0, width, height);
  }
- slim_hidden_def(glitz_surface_create_similar);
  
  glitz_surface_t *
--- 89,169 ----
  }
  
! glitz_format_t *
! glitz_surface_find_similar_standard_format (glitz_surface_t *surface,
!                                             unsigned long option_mask,
!                                             glitz_format_name_t format_name)
  {
!   return
!     glitz_format_find_standard (surface->formats, surface->n_formats,
!                                 option_mask, format_name);
! }
! slim_hidden_def(glitz_surface_find_similar_standard_format);
  
! glitz_format_t *
! glitz_surface_find_similar_format (glitz_surface_t *surface,
!                                    unsigned long mask,
!                                    const glitz_format_t *templ,
!                                    int count)
! {
!   return glitz_format_find (surface->formats, surface->n_formats,
!                             mask, templ, count);
  }
  
  glitz_surface_t *
  glitz_surface_create_similar (glitz_surface_t *templ,
!                               glitz_format_t *format,
                                int width,
                                int height)
  {
!   if (width < 1 || height < 1)
!     return NULL;
!   
!   return templ->backend->create_similar (templ, format, width, height);
! }
! 
! glitz_surface_t *
! glitz_surface_create_intermediate (glitz_surface_t *surface,
!                                    glitz_intermediate_t type,
!                                    int width,
!                                    int height)
! {
!   glitz_format_t templ;
!   glitz_format_t *format;
!   glitz_surface_t *intermediate;
!   unsigned long mask;
!   
!   templ.draw.offscreen = 1;
!   mask = GLITZ_FORMAT_DRAW_OFFSCREEN_MASK;
! 
!   /* component size 8 should instead be 1 but first need to add a
!      GLITZ_FORMAT_MINIMUM_MASK. */
!   switch (type) {
!   case GLITZ_INTERMEDIATE_RGBA:
!     templ.red_size = 8;
!     templ.green_size = 8;
!     templ.blue_size = 8;
!     mask |= (GLITZ_FORMAT_RED_SIZE_MASK |
!              GLITZ_FORMAT_GREEN_SIZE_MASK |
!              GLITZ_FORMAT_BLUE_SIZE_MASK);
!     /* fall through */
!   case GLITZ_INTERMEDIATE_ALPHA:
!     templ.alpha_size = 8;
!     mask |= GLITZ_FORMAT_ALPHA_SIZE_MASK;
!     break;
!   }
! 
!   format = glitz_surface_find_similar_format (surface, mask, &templ, 0);
!   if (!format) {
!     glitz_surface_status_add (surface, GLITZ_STATUS_NOT_SUPPORTED_MASK);
!     return NULL;
!   }
!     
!   intermediate = glitz_surface_create_similar (surface, format, width, height);
!   
!   if (!intermediate)
!     glitz_surface_status_add (surface, GLITZ_STATUS_NO_MEMORY_MASK);
! 
!   return intermediate;
  }
  
  glitz_surface_t *

Index: glitz_trap.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_trap.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_trap.c	10 May 2004 21:00:31 -0000	1.4
--- b/glitz_trap.c	24 May 2004 07:16:42 -0000	1.5
***************
*** 217,229 ****
      if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
        return;
!     
!     mask = glitz_int_surface_create_similar (dst, GLITZ_STANDARD_ARGB32, 1,
!                                              bounds.x2 - bounds.x1,
!                                              bounds.y2 - bounds.y1);
!     
!     if (!mask) {
!       glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
        return;
-     }
      
      mask->hint_mask |= GLITZ_INT_HINT_IMPLICIT_MASK_MASK;
--- 217,226 ----
      if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
        return;
! 
!     mask = glitz_surface_create_intermediate (dst, GLITZ_INTERMEDIATE_ALPHA,
!                                               bounds.x2 - bounds.x1,
!                                               bounds.y2 - bounds.y1);
!     if (!mask)
        return;
      
      mask->hint_mask |= GLITZ_INT_HINT_IMPLICIT_MASK_MASK;

Index: glitz_tri.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_tri.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** a/glitz_tri.c	10 May 2004 21:00:31 -0000	1.4
--- b/glitz_tri.c	24 May 2004 07:16:42 -0000	1.5
***************
*** 180,192 ****
      if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
        return;
!   
!     mask = glitz_int_surface_create_similar (dst, GLITZ_STANDARD_ARGB32, 1,
!                                              bounds.x2 - bounds.x1,
!                                              bounds.y2 - bounds.y1);
!   
!     if (!mask) {
!       glitz_surface_status_add (dst, GLITZ_STATUS_NOT_SUPPORTED_MASK);
        return;
-     }
      
      mask->hint_mask |= GLITZ_INT_HINT_IMPLICIT_MASK_MASK;
--- 180,189 ----
      if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
        return;
! 
!     mask = glitz_surface_create_intermediate (dst, GLITZ_INTERMEDIATE_ALPHA,
!                                               bounds.x2 - bounds.x1,
!                                               bounds.y2 - bounds.y1);
!     if (!mask)
        return;
      
      mask->hint_mask |= GLITZ_INT_HINT_IMPLICIT_MASK_MASK;

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** a/glitzint.h	20 May 2004 00:00:06 -0000	1.14
--- b/glitzint.h	24 May 2004 07:16:42 -0000	1.15
***************
*** 77,81 ****
  #define GLITZ_TEXTURE_TARGET_NPOT_MASK      (1L << 2)
  
! #define GLITZ_FORMAT_ALL_EXCEPT_ID_MASK ((1L << 17) - 2)
  
  #include "glitz_gl.h"
--- 77,81 ----
  #define GLITZ_TEXTURE_TARGET_NPOT_MASK      (1L << 2)
  
! #define GLITZ_FORMAT_ALL_EXCEPT_ID_MASK ((1L << 19) - 2)
  
  #include "glitz_gl.h"
***************
*** 249,254 ****
    glitz_surface_t *
    (*create_similar) (void *surface,
!                      glitz_format_name_t format_name,
!                      glitz_bool_t drawable,
                       int width,
                       int height);
--- 249,253 ----
    glitz_surface_t *
    (*create_similar) (void *surface,
!                      glitz_format_t *format,
                       int width,
                       int height);
***************
*** 306,309 ****
--- 305,310 ----
  
    glitz_format_t *format;
+   glitz_format_t *formats;
+   int n_formats;
    glitz_texture_t texture;
    unsigned long status_mask;
***************
*** 500,503 ****
--- 501,506 ----
                      glitz_gl_proc_address_list_t *gl,
                      glitz_format_t *format,
+                     glitz_format_t *formats,
+                     int n_formats,
                      int width,
                      int height,
***************
*** 563,572 ****
  glitz_status_pop_from_mask (unsigned long *mask);
  
  extern glitz_surface_t *__internal_linkage
! glitz_int_surface_create_similar (glitz_surface_t *templ,
!                                   glitz_format_name_t format_name,
!                                   glitz_bool_t drawable,
!                                   int width,
!                                   int height);
  
  extern void __internal_linkage
--- 566,579 ----
  glitz_status_pop_from_mask (unsigned long *mask);
  
+ typedef enum {
+   GLITZ_INTERMEDIATE_ALPHA,
+   GLITZ_INTERMEDIATE_RGBA
+ } glitz_intermediate_t;
+ 
  extern glitz_surface_t *__internal_linkage
! glitz_surface_create_intermediate (glitz_surface_t *templ,
!                                    glitz_intermediate_t type,
!                                    int width,
!                                    int height);
  
  extern void __internal_linkage
***************
*** 750,754 ****
  /* Avoid unnecessary PLT entries.  */
  
! slim_hidden_proto(glitz_surface_create_similar)
  slim_hidden_proto(glitz_surface_create_solid)
  slim_hidden_proto(glitz_surface_create_linear)
--- 757,761 ----
  /* Avoid unnecessary PLT entries.  */
  
! slim_hidden_proto(glitz_surface_find_similar_standard_format)
  slim_hidden_proto(glitz_surface_create_solid)
  slim_hidden_proto(glitz_surface_create_linear)





More information about the cairo-commit mailing list