[cairo-commit] libglc/src glc.h,1.9,1.10 glc_agl_format.c,1.5,1.6 glc_agl_surface.c,1.5,1.6 glc_format.c,1.3,1.4 glc_glx_format.c,1.12,1.13 glc_glx_surface.c,1.12,1.13 glc_surface.c,1.13,1.14 glc_util.c,1.7,1.8 glcint.h,1.14,1.15

David Reveman commit at pdx.freedesktop.org
Mon Aug 15 11:12:59 PDT 2005


Committed by: davidr

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

Modified Files:
	glc.h glc_agl_format.c glc_agl_surface.c glc_format.c 
	glc_glx_format.c glc_glx_surface.c glc_surface.c glc_util.c 
	glcint.h 
Log Message:
Added pixel read/draw format info

Index: glc.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glc.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** glc.h	10 Feb 2004 23:38:36 -0000	1.9
--- glc.h	12 Feb 2004 12:49:39 -0000	1.10
***************
*** 145,159 ****
    
  #define GLC_FORMAT_ID_MASK                  (1 <<  0)
! #define GLC_FORMAT_RED_MASK                 (1 <<  1)
! #define GLC_FORMAT_GREEN_MASK               (1 <<  2)
! #define GLC_FORMAT_BLUE_MASK                (1 <<  3)
! #define GLC_FORMAT_ALPHA_MASK               (1 <<  4)
! #define GLC_FORMAT_DEPTH_MASK               (1 <<  5)
! #define GLC_FORMAT_DOUBLEBUFFER_MASK        (1 <<  6)
! #define GLC_FORMAT_ONSCREEN_MASK            (1 <<  7)
! #define GLC_FORMAT_OFFSCREEN_MASK           (1 <<  8)
! #define GLC_FORMAT_MULTISAMPLE_MASK         (1 <<  9)
! #define GLC_FORMAT_MULTISAMPLE_SAMPLES_MASK (1 << 10)
!   
  typedef unsigned long int glc_format_id_t;
  
--- 145,164 ----
    
  #define GLC_FORMAT_ID_MASK                  (1 <<  0)
! #define GLC_FORMAT_BPP_MASK                 (1 <<  1)
! #define GLC_FORMAT_RED_MASK_MASK            (1 <<  2)
! #define GLC_FORMAT_GREEN_MASK_MASK          (1 <<  3)
! #define GLC_FORMAT_BLUE_MASK_MASK           (1 <<  4)
! #define GLC_FORMAT_ALPHA_MASK_MASK          (1 <<  5)
! #define GLC_FORMAT_RED_SIZE_MASK            (1 <<  6)
! #define GLC_FORMAT_GREEN_SIZE_MASK          (1 <<  7)
! #define GLC_FORMAT_BLUE_SIZE_MASK           (1 <<  8)
! #define GLC_FORMAT_ALPHA_SIZE_MASK          (1 <<  9)
! #define GLC_FORMAT_DEPTH_SIZE_MASK          (1 << 10)
! #define GLC_FORMAT_DOUBLEBUFFER_MASK        (1 << 11)
! #define GLC_FORMAT_ONSCREEN_MASK            (1 << 12)
! #define GLC_FORMAT_OFFSCREEN_MASK           (1 << 13)
! #define GLC_FORMAT_MULTISAMPLE_MASK         (1 << 14)
! #define GLC_FORMAT_MULTISAMPLE_SAMPLES_MASK (1 << 15)
! 
  typedef unsigned long int glc_format_id_t;
  
***************
*** 170,178 ****
  typedef struct _glc_format_t {
    glc_format_id_t id;
!   unsigned short red;
!   unsigned short green;
!   unsigned short blue;
!   unsigned short alpha;
!   unsigned short depth;
    glc_bool_t doublebuffer;
    glc_drawable_type_t drawable;
--- 175,192 ----
  typedef struct _glc_format_t {
    glc_format_id_t id;
! 
!   /* bpp and mask values specifies the pixel format for read/draw pixels */
!   int bpp;
!   unsigned long red_mask;
!   unsigned long green_mask;
!   unsigned long blue_mask;
!   unsigned long alpha_mask;
!   
!   unsigned short red_size;
!   unsigned short green_size;
!   unsigned short blue_size;
!   unsigned short alpha_size;
!   unsigned short depth_size;
!   
    glc_bool_t doublebuffer;
    glc_drawable_type_t drawable;
***************
*** 246,252 ****
                    unsigned int height);
  
- int
- glc_surface_get_pixelsize (glc_surface_t *surface);
- 
  void
  glc_surface_read_pixels (glc_surface_t *surface,
--- 260,263 ----

Index: glc_agl_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_format.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glc_agl_format.c	10 Feb 2004 23:38:36 -0000	1.5
--- glc_agl_format.c	12 Feb 2004 12:49:39 -0000	1.6
***************
*** 153,161 ****
  
    for (; i < 2; i++) {
!     if (format[i]->alpha)
        score[i] += 10;
!     if (format[i]->red)
        score[i] += 10;
!     if (format[i]->depth)
        score[i] += 10;
      if (format[i]->multisample.supported) 
--- 153,161 ----
  
    for (; i < 2; i++) {
!     if (format[i]->alpha_size)
        score[i] += 10;
!     if (format[i]->red_size)
        score[i] += 10;
!     if (format[i]->depth_size)
        score[i] += 10;
      if (format[i]->multisample.supported) 
***************
*** 170,173 ****
--- 170,175 ----
                   glc_format_t *format)
  {
+   glc_format_calculate_pixel_transfer_info (format);
+   
    if (!glc_format_find (thread_info->formats, thread_info->n_formats,
                          GLC_FORMAT_ALL_EXCEPT_ID_MASK, format, 0)) {
***************
*** 236,248 ****
        
      aglDescribePixelFormat (pixel_format, AGL_RED_SIZE, &value);
!     format.red = (unsigned short) value;
      aglDescribePixelFormat (pixel_format, AGL_GREEN_SIZE, &value);
!     format.green = (unsigned short) value;
      aglDescribePixelFormat (pixel_format, AGL_BLUE_SIZE, &value);
!     format.blue = (unsigned short) value;
      aglDescribePixelFormat (pixel_format, AGL_ALPHA_SIZE, &value);
!     format.alpha = (unsigned short) value;
      aglDescribePixelFormat (pixel_format, AGL_DEPTH_SIZE, &value);
!     format.depth = (unsigned short) value;
      
      if (thread_info->feature_mask & GLC_FEATURE_MULTISAMPLE_MASK) {
--- 238,250 ----
        
      aglDescribePixelFormat (pixel_format, AGL_RED_SIZE, &value);
!     format.red_size = (unsigned short) value;
      aglDescribePixelFormat (pixel_format, AGL_GREEN_SIZE, &value);
!     format.green_size = (unsigned short) value;
      aglDescribePixelFormat (pixel_format, AGL_BLUE_SIZE, &value);
!     format.blue_size = (unsigned short) value;
      aglDescribePixelFormat (pixel_format, AGL_ALPHA_SIZE, &value);
!     format.alpha_size = (unsigned short) value;
      aglDescribePixelFormat (pixel_format, AGL_DEPTH_SIZE, &value);
!     format.depth_size = (unsigned short) value;
      
      if (thread_info->feature_mask & GLC_FEATURE_MULTISAMPLE_MASK) {
***************
*** 263,279 ****
  
      if (format.drawable.offscreen &&
!         format.alpha && format.red && format.green && format.blue) 
        offscreen_argb32_format = 1;
      
      _glc_add_format (thread_info, &format);
  
!     if (format.alpha && (format.red || format.green || format.blue)) {
        unsigned short tmp;
        
!       tmp = format.alpha;
!       format.alpha = 0;
        _glc_add_format (thread_info, &format);
!       format.alpha = tmp;
!       format.red = format.green = format.blue = 0;
        _glc_add_format (thread_info, &format);
      }
--- 265,283 ----
  
      if (format.drawable.offscreen &&
!         format.alpha_size &&
!         format.red_size && format.green_size && format.blue_size) 
        offscreen_argb32_format = 1;
      
      _glc_add_format (thread_info, &format);
  
!     if (format.alpha_size &&
!         (format.red_size || format.green_size || format.blue_size)) {
        unsigned short tmp;
        
!       tmp = format.alpha_size;
!       format.alpha_size = 0;
        _glc_add_format (thread_info, &format);
!       format.alpha_size = tmp;
!       format.red_size = format.green_size = format.blue_size = 0;
        _glc_add_format (thread_info, &format);
      }
***************
*** 289,299 ****
      memset (&format, 0, sizeof (glc_format_t));
      format.drawable.offscreen = 1;
!     format.alpha = format.red = format.green = format.blue = 8;
      format.id = 0;
      _glc_add_format (thread_info, &format);
!     format.alpha = 0;
      _glc_add_format (thread_info, &format);
!     format.alpha  = 8;
!     format.red = format.green = format.blue = 0;
      _glc_add_format (thread_info, &format);
    }
--- 293,304 ----
      memset (&format, 0, sizeof (glc_format_t));
      format.drawable.offscreen = 1;
!     format.alpha_size = format.red_size = format.green_size =
!       format.blue_size = 8;
      format.id = 0;
      _glc_add_format (thread_info, &format);
!     format.alpha_size = 0;
      _glc_add_format (thread_info, &format);
!     format.alpha_size  = 8;
!     format.red_size = format.green_size = format.blue_size = 0;
      _glc_add_format (thread_info, &format);
    }

Index: glc_agl_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_agl_surface.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glc_agl_surface.c	10 Feb 2004 23:38:36 -0000	1.5
--- glc_agl_surface.c	12 Feb 2004 12:49:39 -0000	1.6
***************
*** 180,194 ****
    surface->thread_info = thread_info;
    surface->context = context;
-   surface->base.format = format;
-   
-   surface->base.red = format->red;
-   surface->base.green = format->green;
-   surface->base.blue = format->blue;
-   surface->base.alpha = format->alpha;
    
    surface->base.width = width;
    surface->base.height = height;
!   
!   texture_format = glc_surface_get_texture_format (&surface->base);
  
    glc_surface_push_current (&surface->base, GLC_CN_ANY_CONTEXT_CURRENT);
--- 180,189 ----
    surface->thread_info = thread_info;
    surface->context = context;
    
+   surface->base.format = format;
    surface->base.width = width;
    surface->base.height = height;
! 
!   texture_format = glc_get_gl_format_from_bpp (format->bpp);
  
    glc_surface_push_current (&surface->base, GLC_CN_ANY_CONTEXT_CURRENT);
***************
*** 265,275 ****
    surface->thread_info = thread_info;
    surface->context = context;
-   surface->base.format = format;
- 
-   surface->base.red = format->red;
-   surface->base.green = format->green;
-   surface->base.blue = format->blue;
-   surface->base.alpha = format->alpha;
    
    surface->base.width = width;
    surface->base.height = height;
--- 260,265 ----
    surface->thread_info = thread_info;
    surface->context = context;
    
+   surface->base.format = format;
    surface->base.width = width;
    surface->base.height = height;

Index: glc_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_format.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** glc_format.c	10 Feb 2004 23:38:36 -0000	1.3
--- glc_format.c	12 Feb 2004 12:49:39 -0000	1.4
***************
*** 46,67 ****
          continue;
  
!     if (mask & GLC_FORMAT_RED_MASK)
!       if (templ->red != formats->red)
          continue;
  
!     if (mask & GLC_FORMAT_GREEN_MASK)
!       if (templ->green != formats->green)
          continue;
  
!     if (mask & GLC_FORMAT_BLUE_MASK)
!       if (templ->blue != formats->blue)
          continue;
  
!     if (mask & GLC_FORMAT_ALPHA_MASK)
!       if (templ->alpha != formats->alpha)
          continue;
  
!     if (mask & GLC_FORMAT_DEPTH_MASK)
!       if (templ->depth != formats->depth)
          continue;
  
--- 46,87 ----
          continue;
  
!     if (mask & GLC_FORMAT_BPP_MASK)
!       if (templ->bpp != formats->bpp)
!         continue;
!         
!     if (mask & GLC_FORMAT_RED_MASK_MASK)
!       if (templ->red_mask != formats->red_mask)
          continue;
  
!     if (mask & GLC_FORMAT_GREEN_MASK_MASK)
!       if (templ->green_mask != formats->green_mask)
          continue;
  
!     if (mask & GLC_FORMAT_BLUE_MASK_MASK)
!       if (templ->blue_mask != formats->blue_mask)
          continue;
  
!     if (mask & GLC_FORMAT_ALPHA_MASK_MASK)
!       if (templ->alpha_mask != formats->alpha_mask)
          continue;
  
!     if (mask & GLC_FORMAT_RED_SIZE_MASK)
!       if (templ->red_size != formats->red_size)
!         continue;
! 
!     if (mask & GLC_FORMAT_GREEN_SIZE_MASK)
!       if (templ->green_size != formats->green_size)
!         continue;
! 
!     if (mask & GLC_FORMAT_BLUE_SIZE_MASK)
!       if (templ->blue_size != formats->blue_size)
!         continue;
! 
!     if (mask & GLC_FORMAT_ALPHA_SIZE_MASK)
!       if (templ->alpha_size != formats->alpha_size)
!         continue;
! 
!     if (mask & GLC_FORMAT_DEPTH_SIZE_MASK)
!       if (templ->depth_size != formats->depth_size)
          continue;
  
***************
*** 137,167 ****
  {
    glc_format_t templ;
!   unsigned long mask = GLC_FORMAT_RED_MASK | GLC_FORMAT_GREEN_MASK |
!     GLC_FORMAT_BLUE_MASK | GLC_FORMAT_ALPHA_MASK;
  
    switch (format_name) {
    case GLC_STANDARD_ARGB32:
!     templ.red = 8;
!     templ.green = 8;
!     templ.blue = 8;
!     templ.alpha = 8;
      break;
    case GLC_STANDARD_RGB24:
!     templ.red = 8;
!     templ.green = 8;
!     templ.blue = 8;
!     templ.alpha = 0;
      break;
    case GLC_STANDARD_A8:
!     templ.red = 0;
!     templ.green = 0;
!     templ.blue = 0;
!     templ.alpha = 8;
      break;
    case GLC_STANDARD_A1:
!     templ.red = 0;
!     templ.green = 0;
!     templ.blue = 0;
!     templ.alpha = 1;
      break;
    }
--- 157,187 ----
  {
    glc_format_t templ;
!   unsigned long mask = GLC_FORMAT_RED_SIZE_MASK | GLC_FORMAT_GREEN_SIZE_MASK |
!     GLC_FORMAT_BLUE_SIZE_MASK | GLC_FORMAT_ALPHA_SIZE_MASK;
  
    switch (format_name) {
    case GLC_STANDARD_ARGB32:
!     templ.red_size = 8;
!     templ.green_size = 8;
!     templ.blue_size = 8;
!     templ.alpha_size = 8;
      break;
    case GLC_STANDARD_RGB24:
!     templ.red_size = 8;
!     templ.green_size = 8;
!     templ.blue_size = 8;
!     templ.alpha_size = 0;
      break;
    case GLC_STANDARD_A8:
!     templ.red_size = 0;
!     templ.green_size = 0;
!     templ.blue_size = 0;
!     templ.alpha_size = 8;
      break;
    case GLC_STANDARD_A1:
!     templ.red_size = 0;
!     templ.green_size = 0;
!     templ.blue_size = 0;
!     templ.alpha_size = 1;
      break;
    }
***************
*** 183,207 ****
    switch (format_name) {
    case GLC_STANDARD_ARGB32:
!     mask = GLC_FORMAT_RED_MASK | GLC_FORMAT_GREEN_MASK |
!       GLC_FORMAT_BLUE_MASK | GLC_FORMAT_ALPHA_MASK;
!     templ.red = 8;
!     templ.green = 8;
!     templ.blue = 8;
!     templ.alpha = 8;
      break;
    case GLC_STANDARD_RGB24:
!     mask = GLC_FORMAT_RED_MASK | GLC_FORMAT_GREEN_MASK |
!       GLC_FORMAT_BLUE_MASK;
!     templ.red = 8;
!     templ.green = 8;
!     templ.blue = 8;
      break;
    case GLC_STANDARD_A8:
!     mask = GLC_FORMAT_ALPHA_MASK;
!     templ.alpha = 8;
      break;
    case GLC_STANDARD_A1:
!     mask = GLC_FORMAT_ALPHA_MASK;
!     templ.alpha = 1;
      break;
    }
--- 203,227 ----
    switch (format_name) {
    case GLC_STANDARD_ARGB32:
!     mask = GLC_FORMAT_RED_SIZE_MASK | GLC_FORMAT_GREEN_SIZE_MASK |
!       GLC_FORMAT_BLUE_SIZE_MASK | GLC_FORMAT_ALPHA_SIZE_MASK;
!     templ.red_size = 8;
!     templ.green_size = 8;
!     templ.blue_size = 8;
!     templ.alpha_size = 8;
      break;
    case GLC_STANDARD_RGB24:
!     mask = GLC_FORMAT_RED_SIZE_MASK | GLC_FORMAT_GREEN_SIZE_MASK |
!       GLC_FORMAT_BLUE_SIZE_MASK;
!     templ.red_size = 8;
!     templ.green_size = 8;
!     templ.blue_size = 8;
      break;
    case GLC_STANDARD_A8:
!     mask = GLC_FORMAT_ALPHA_SIZE_MASK;
!     templ.alpha_size = 8;
      break;
    case GLC_STANDARD_A1:
!     mask = GLC_FORMAT_ALPHA_SIZE_MASK;
!     templ.alpha_size = 1;
      break;
    }
***************
*** 211,212 ****
--- 231,254 ----
    return glc_format_find (formats, n_formats, mask, &templ, 0);
  }
+ 
+ void
+ glc_format_calculate_pixel_transfer_info (glc_format_t *format)
+ {
+   long int mask = 0x000000ff;
+   format->bpp = 0;
+ 
+   if (format->red_size || format->green_size || format->blue_size) {
+     format->blue_mask = mask;
+     format->green_mask = mask << 8;
+     format->red_mask = mask << 16;
+     format->bpp += 24;
+     mask = 0xff000000;
+   } else
+     format->blue_mask = format->green_mask = format->red_mask = 0x0;
+   
+   if (format->alpha_size) {
+     format->alpha_mask = mask;
+     format->bpp += 8;
+   } else
+     format->alpha_mask = 0x0;
+ }

Index: glc_glx_format.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_format.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glc_glx_format.c	10 Feb 2004 23:38:36 -0000	1.12
--- glc_glx_format.c	12 Feb 2004 12:49:39 -0000	1.13
***************
*** 47,55 ****
  
    for (; i < 2; i++) {
!     if (format[i]->depth)
        score[i] += 10;
!     if (format[i]->alpha)
        score[i] += 10;
!     if (format[i]->red)
        score[i] += 10;
      if (format[i]->doublebuffer)
--- 47,55 ----
  
    for (; i < 2; i++) {
!     if (format[i]->depth_size)
        score[i] += 10;
!     if (format[i]->alpha_size)
        score[i] += 10;
!     if (format[i]->red_size)
        score[i] += 10;
      if (format[i]->doublebuffer)
***************
*** 73,76 ****
--- 73,78 ----
                   glc_format_t *format)
  {
+   glc_format_calculate_pixel_transfer_info (format);
+   
    if (!glc_format_find (screen_info->formats, screen_info->n_formats,
                          GLC_FORMAT_ALL_EXCEPT_ID_MASK, format, 0)) {
***************
*** 80,84 ****
        realloc (screen_info->formats,
                 sizeof (glc_format_t) * screen_info->n_formats);
!     
      memcpy (&screen_info->formats[index], format, sizeof (glc_format_t));
    }
--- 82,86 ----
        realloc (screen_info->formats,
                 sizeof (glc_format_t) * screen_info->n_formats);
! 
      memcpy (&screen_info->formats[index], format, sizeof (glc_format_t));
    }
***************
*** 139,151 ****
      format.id = visuals[i].visualid;
      glXGetConfig (display, &visuals[i], GLX_RED_SIZE, &value);
!     format.red = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_GREEN_SIZE, &value);
!     format.green = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_BLUE_SIZE, &value);
!     format.blue = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_ALPHA_SIZE, &value);
!     format.alpha = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_DEPTH_SIZE, &value);
!     format.depth = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_DOUBLEBUFFER, &value);
      format.doublebuffer = (value) ? 1: 0;
--- 141,153 ----
      format.id = visuals[i].visualid;
      glXGetConfig (display, &visuals[i], GLX_RED_SIZE, &value);
!     format.red_size = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_GREEN_SIZE, &value);
!     format.green_size = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_BLUE_SIZE, &value);
!     format.blue_size = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_ALPHA_SIZE, &value);
!     format.alpha_size = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_DEPTH_SIZE, &value);
!     format.depth_size = (unsigned short) value;
      glXGetConfig (display, &visuals[i], GLX_DOUBLEBUFFER, &value);
      format.doublebuffer = (value) ? 1: 0;
***************
*** 163,174 ****
      _glc_add_format (screen_info, &format);
  
!     if (format.alpha && (format.red || format.green || format.blue)) {
        unsigned short tmp;
        
!       tmp = format.alpha;
!       format.alpha = 0;
        _glc_add_format (screen_info, &format);
!       format.alpha = tmp;
!       format.red = format.green = format.blue = 0;
        _glc_add_format (screen_info, &format);
      }
--- 165,177 ----
      _glc_add_format (screen_info, &format);
  
!     if (format.alpha_size &&
!         (format.red_size || format.green_size || format.blue_size)) {
        unsigned short tmp;
        
!       tmp = format.alpha_size;
!       format.alpha_size = 0;
        _glc_add_format (screen_info, &format);
!       format.alpha_size = tmp;
!       format.red_size = format.green_size = format.blue_size = 0;
        _glc_add_format (screen_info, &format);
      }
***************
*** 183,193 ****
    memset (&format, 0, sizeof (glc_format_t));
    format.drawable.offscreen = 1;
!   format.alpha = format.red = format.green = format.blue = 8;
    format.id = 0;
    _glc_add_format (screen_info, &format);
!   format.alpha = 0;
    _glc_add_format (screen_info, &format);
!   format.alpha  = 8;
!   format.red = format.green = format.blue = 0;
    _glc_add_format (screen_info, &format);
    
--- 186,197 ----
    memset (&format, 0, sizeof (glc_format_t));
    format.drawable.offscreen = 1;
!   format.alpha_size = format.red_size = format.green_size =
!     format.blue_size = 8;
    format.id = 0;
    _glc_add_format (screen_info, &format);
!   format.alpha_size = 0;
    _glc_add_format (screen_info, &format);
!   format.alpha_size  = 8;
!   format.red_size = format.green_size = format.blue_size = 0;
    _glc_add_format (screen_info, &format);
    
***************
*** 237,249 ****
      
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_RED_SIZE, &value);
!     format.red = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_GREEN_SIZE, &value);
!     format.green = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_BLUE_SIZE, &value);
!     format.blue = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_ALPHA_SIZE, &value);
!     format.alpha = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_DEPTH_SIZE, &value);
!     format.depth = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_DOUBLEBUFFER, &value);
      format.doublebuffer = (value) ? 1: 0;
--- 241,253 ----
      
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_RED_SIZE, &value);
!     format.red_size = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_GREEN_SIZE, &value);
!     format.green_size = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_BLUE_SIZE, &value);
!     format.blue_size = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_ALPHA_SIZE, &value);
!     format.alpha_size = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_DEPTH_SIZE, &value);
!     format.depth_size = (unsigned short) value;
      glXGetFBConfigAttrib (display, fbconfigs[i], GLX_DOUBLEBUFFER, &value);
      format.doublebuffer = (value) ? 1: 0;
***************
*** 261,277 ****
  
      if (format.drawable.offscreen &&
!         format.alpha && format.red && format.green && format.blue)
        offscreen_argb32_format = 1;
      
      _glc_add_format (screen_info, &format);
  
!     if (format.alpha && (format.red || format.green || format.blue)) {
        unsigned short tmp;
        
!       tmp = format.alpha;
!       format.alpha = 0;
        _glc_add_format (screen_info, &format);
!       format.alpha = tmp;
!       format.red = format.green = format.blue = 0;
        _glc_add_format (screen_info, &format);
      }    
--- 265,283 ----
  
      if (format.drawable.offscreen &&
!         format.alpha_size &&
!         format.red_size && format.green_size && format.blue_size)
        offscreen_argb32_format = 1;
      
      _glc_add_format (screen_info, &format);
  
!     if (format.alpha_size &&
!         (format.red_size || format.green_size || format.blue_size)) {
        unsigned short tmp;
        
!       tmp = format.alpha_size;
!       format.alpha_size = 0;
        _glc_add_format (screen_info, &format);
!       format.alpha_size = tmp;
!       format.red_size = format.green_size = format.blue_size = 0;
        _glc_add_format (screen_info, &format);
      }    
***************
*** 289,299 ****
      memset (&format, 0, sizeof (glc_format_t));
      format.drawable.offscreen = 1;
!     format.alpha = format.red = format.green = format.blue = 8;
      format.id = 0;
      _glc_add_format (screen_info, &format);
!     format.alpha = 0;
      _glc_add_format (screen_info, &format);
!     format.alpha  = 8;
!     format.red = format.green = format.blue = 0;
      _glc_add_format (screen_info, &format);
    }
--- 295,306 ----
      memset (&format, 0, sizeof (glc_format_t));
      format.drawable.offscreen = 1;
!     format.alpha_size = format.red_size = format.green_size =
!       format.blue_size = 8;
      format.id = 0;
      _glc_add_format (screen_info, &format);
!     format.alpha_size = 0;
      _glc_add_format (screen_info, &format);
!     format.alpha_size  = 8;
!     format.red_size = format.green_size = format.blue_size = 0;
      _glc_add_format (screen_info, &format);
    }

Index: glc_glx_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_surface.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** glc_glx_surface.c	11 Feb 2004 01:42:14 -0000	1.12
--- glc_glx_surface.c	12 Feb 2004 12:49:39 -0000	1.13
***************
*** 212,230 ****
    surface->screen_info = screen_info;
    surface->context = context;
-   surface->base.format = format;
-   
-   surface->base.red = format->red;
-   surface->base.green = format->green;
-   surface->base.blue = format->blue;
-   surface->base.alpha = format->alpha;
    
    surface->base.width = width;
    surface->base.height = height;
  
!   texture_format = glc_surface_get_texture_format (&surface->base);
  
    if (screen_info->glx_feature_mask & GLC_GLX_FEATURE_RENDER_TEXTURE_MASK) {
      surface->render_texture = 1;
!     if (format->red || format->green || format->blue)
        surface->base.requires_flipping = 0;
    }
--- 212,225 ----
    surface->screen_info = screen_info;
    surface->context = context;
    
+   surface->base.format = format;  
    surface->base.width = width;
    surface->base.height = height;
  
!   texture_format = glc_get_gl_format_from_bpp (format->bpp);
  
    if (screen_info->glx_feature_mask & GLC_GLX_FEATURE_RENDER_TEXTURE_MASK) {
      surface->render_texture = 1;
!     if (format->red_size || format->green_size || format->blue_size)
        surface->base.requires_flipping = 0;
    }
***************
*** 299,311 ****
    surface->screen_info = screen_info;
    surface->context = context;
-   surface->base.format = format;
- 
-   surface->base.red = format->red;
-   surface->base.green = format->green;
-   surface->base.blue = format->blue;
-   surface->base.alpha = format->alpha;
    
    surface->base.width = width;
    surface->base.height = height;
    surface->drawable = window;
    
--- 294,302 ----
    surface->screen_info = screen_info;
    surface->context = context;
    
+   surface->base.format = format;
    surface->base.width = width;
    surface->base.height = height;
+   
    surface->drawable = window;
    

Index: glc_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_surface.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** glc_surface.c	10 Feb 2004 23:38:36 -0000	1.13
--- glc_surface.c	12 Feb 2004 12:49:39 -0000	1.14
***************
*** 268,281 ****
  slim_hidden_def(glc_surface_show);
  
- int
- glc_surface_get_pixelsize (glc_surface_t *surface)
- {
-   return glc_get_pixelsize_from_components (surface->red,
-                                             surface->green,
-                                             surface->blue,
-                                             surface->alpha);
- }
- slim_hidden_def(glc_surface_get_pixelsize);
- 
  void
  glc_surface_dirty (glc_surface_t *surface,
--- 268,271 ----
***************
*** 338,353 ****
  }
  
- unsigned int
- glc_surface_get_texture_format (glc_surface_t *surface)
- {
-   int pixelsize =
-     glc_get_pixelsize_from_components (surface->red,
-                                        surface->green,
-                                        surface->blue,
-                                        surface->alpha);
-   
-   return glc_get_format_from_pixelsize (pixelsize);
- }
- 
  void
  glc_surface_read_pixels (glc_surface_t *surface,
--- 328,331 ----
***************
*** 359,363 ****
  {
    unsigned char *pixel_buf;
!   int rowstride, area_rowstride, pixelsize;
    unsigned int i;
    GLenum format, type;
--- 337,341 ----
  {
    unsigned char *pixel_buf;
!   int rowstride, area_rowstride, bytes_per_pixel;
    unsigned int i;
    GLenum format, type;
***************
*** 369,379 ****
    }
  
!   pixelsize =
!     glc_get_pixelsize_from_components (surface->red,
!                                        surface->green,
!                                        surface->blue,
!                                        surface->alpha);
!   format = glc_get_format_from_pixelsize (pixelsize);
!   type = glc_get_data_type_from_pixelsize (pixelsize);
  
    /* We currently read the whole image to a temporary buffer and then
--- 347,353 ----
    }
  
!   bytes_per_pixel = (surface->format->bpp / 8);
!   format = glc_get_gl_format_from_bpp (surface->format->bpp);
!   type = glc_get_gl_data_type_from_bpp (surface->format->bpp);
  
    /* We currently read the whole image to a temporary buffer and then
***************
*** 382,386 ****
  
    if (glc_surface_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     rowstride = surface->width * pixelsize;
      rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
      pixel_buf = (unsigned char *) malloc (surface->height * rowstride);
--- 356,360 ----
  
    if (glc_surface_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
!     rowstride = surface->width * bytes_per_pixel;
      rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
      pixel_buf = (unsigned char *) malloc (surface->height * rowstride);
***************
*** 394,398 ****
      glc_texture_bind (texture);
  
!     rowstride = texture->width * pixelsize;
      rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
      pixel_buf = (unsigned char *) malloc (texture->height * rowstride);
--- 368,372 ----
      glc_texture_bind (texture);
  
!     rowstride = texture->width * bytes_per_pixel;
      rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
      pixel_buf = (unsigned char *) malloc (texture->height * rowstride);
***************
*** 412,416 ****
    glc_surface_pop_current (surface);
  
!   area_rowstride = width * pixelsize;
    area_rowstride += (area_rowstride % 4)? (4 - (area_rowstride % 4)): 0;
  
--- 386,390 ----
    glc_surface_pop_current (surface);
  
!   area_rowstride = width * bytes_per_pixel;
    area_rowstride += (area_rowstride % 4)? (4 - (area_rowstride % 4)): 0;
  
***************
*** 435,439 ****
    unsigned char *pixel_buf;
    GLenum format, type;
!   int pixelsize;
  
    if (x < 0 || x > (surface->width - (int) width) ||
--- 409,413 ----
    unsigned char *pixel_buf;
    GLenum format, type;
!   int bytes_per_pixel;
  
    if (x < 0 || x > (surface->width - (int) width) ||
***************
*** 442,454 ****
      return;
    }
-  
-   pixelsize =
-     glc_get_pixelsize_from_components (surface->red,
-                                        surface->green,
-                                        surface->blue,
-                                        surface->alpha);
-   format = glc_get_format_from_pixelsize (pixelsize);
-   type = glc_get_data_type_from_pixelsize (pixelsize);
  
  
    if (glc_surface_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
--- 416,423 ----
      return;
    }
  
+   bytes_per_pixel = (surface->format->bpp / 8);
+   format = glc_get_gl_format_from_bpp (surface->format->bpp);
+   type = glc_get_gl_data_type_from_bpp (surface->format->bpp);
  
    if (glc_surface_push_current (surface, GLC_CN_SURFACE_DRAWABLE_CURRENT)) {
***************
*** 475,479 ****
      glc_texture_t *texture;
      
!     rowstride = width * pixelsize;
      rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
      pixel_buf = (unsigned char *) malloc (rowstride * height);
--- 444,448 ----
      glc_texture_t *texture;
      
!     rowstride = width * bytes_per_pixel;
      rowstride += (rowstride % 4)? (4 - (rowstride % 4)): 0;
      pixel_buf = (unsigned char *) malloc (rowstride * height);

Index: glc_util.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_util.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** glc_util.c	10 Feb 2004 23:38:36 -0000	1.7
--- glc_util.c	12 Feb 2004 12:49:39 -0000	1.8
***************
*** 63,83 ****
  }
  
- int
- glc_get_pixelsize_from_components (int red,
-                                    int green,
-                                    int blue,
-                                    int alpha)
- {
-   int size = 0;
-   
-   if (red && green && blue)
-     size += 3;
-     
-   if (alpha)
-     size += 1;
-   
-   return size;
- }
- 
  static int
  big_endian (void)
--- 63,66 ----
***************
*** 94,104 ****
  
  unsigned int
! glc_get_format_from_pixelsize (int pixelsize)
  {
!   switch (pixelsize) {
!   case 1:
      return GL_ALPHA;
      break;
!   case 3:
      if (big_endian ())
        return GL_RGB;
--- 77,87 ----
  
  unsigned int
! glc_get_gl_format_from_bpp (unsigned short bpp)
  {
!   switch (bpp) {
!   case 8:
      return GL_ALPHA;
      break;
!   case 24:
      if (big_endian ())
        return GL_RGB;
***************
*** 113,119 ****
  
  unsigned int
! glc_get_data_type_from_pixelsize (int pixelsize)
  {
!   if (pixelsize == 4 && big_endian ())
      return GL_UNSIGNED_INT_8_8_8_8_REV;
    else
--- 96,102 ----
  
  unsigned int
! glc_get_gl_data_type_from_bpp (unsigned short bpp)
  {
!   if (bpp == 32 && big_endian ())
      return GL_UNSIGNED_INT_8_8_8_8_REV;
    else

Index: glcint.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glcint.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** glcint.h	10 Feb 2004 23:38:36 -0000	1.14
--- glcint.h	12 Feb 2004 12:49:39 -0000	1.15
***************
*** 77,81 ****
  #define GLC_TEXTURE_TARGET_NV_RECTANGLE_MASK  (1L << 2)
  
! #define GLC_FORMAT_ALL_EXCEPT_ID_MASK ((1 << 11) - 2)
  
  typedef enum {
--- 77,81 ----
  #define GLC_TEXTURE_TARGET_NV_RECTANGLE_MASK  (1L << 2)
  
! #define GLC_FORMAT_ALL_EXCEPT_ID_MASK ((1 << 16) - 2)
  
  typedef enum {
***************
*** 163,167 ****
    glc_bool_t anti_aliasing;
    int width, height;
-   glc_bool_t red, green, blue, alpha;
    glc_bool_t implicit_mask;
    glc_bool_t dirty;
--- 163,166 ----
***************
*** 169,172 ****
--- 168,172 ----
    glc_bool_t requires_flipping;
  };
+ 
  typedef struct _glc_extension_map {
    char *name;
***************
*** 201,215 ****
                    glc_region_box_t *return_box);
  
- extern int __internal_linkage
- glc_get_pixelsize_from_components (int red,
-                                    int green,
-                                    int blue,
-                                    int alpha);
- 
  extern unsigned int __internal_linkage
! glc_get_format_from_pixelsize (int pixelsize);
  
  extern unsigned int __internal_linkage
! glc_get_data_type_from_pixelsize (int pixelsize);
  
  extern long int __internal_linkage
--- 201,209 ----
                    glc_region_box_t *return_box);
  
  extern unsigned int __internal_linkage
! glc_get_gl_format_from_bpp (unsigned short bpp);
  
  extern unsigned int __internal_linkage
! glc_get_gl_data_type_from_bpp (unsigned short bpp);
  
  extern long int __internal_linkage
***************
*** 293,299 ****
  glc_surface_setup_environment (glc_surface_t *surface);
  
- extern unsigned int __internal_linkage
- glc_surface_get_texture_format (glc_surface_t *surface);
- 
  extern glc_status_t __internal_linkage
  glc_status_pop_from_mask (long int *mask);
--- 287,290 ----
***************
*** 318,321 ****
--- 309,315 ----
                                       glc_format_name_t format_name);
  
+ void
+ glc_format_calculate_pixel_transfer_info (glc_format_t *format);
+ 
  extern glc_bool_t __internal_linkage
  glc_program_enable_fragment_arb (glc_fragment_programs_t *programs,
***************
*** 391,395 ****
  slim_hidden_proto(glc_surface_realize)
  slim_hidden_proto(glc_surface_show)
- slim_hidden_proto(glc_surface_get_pixelsize)
  slim_hidden_proto(glc_surface_read_pixels)
  slim_hidden_proto(glc_surface_draw_pixels)
--- 385,388 ----





More information about the cairo-commit mailing list