[cairo-commit] glitz/src glitz_compose.c, 1.5, 1.6 glitz_program.c, 1.13, 1.14 glitz_surface.c, 1.21, 1.22 glitzint.h, 1.26, 1.27

David Reveman commit at pdx.freedesktop.org
Thu Sep 9 16:09:05 PDT 2004


Committed by: davidr

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

Modified Files:
	glitz_compose.c glitz_program.c glitz_surface.c glitzint.h 
Log Message:
Fixed so that perspective transformations work with convolution filters and gradient filters

Index: glitz_compose.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_compose.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** glitz_compose.c	9 Sep 2004 09:50:26 -0000	1.5
--- glitz_compose.c	9 Sep 2004 23:09:03 -0000	1.6
***************
*** 418,423 ****
      ) \
     : \
!    ((!SURFACE_PAD (surface)) || \
      (TEXTURE_PADABLE (&(surface)->texture)) \
     ) \
    )
--- 418,428 ----
      ) \
     : \
!    ((SURFACE_PAD (surface))? \
      (TEXTURE_PADABLE (&(surface)->texture)) \
+     : \
+     ( \
+      (!SURFACE_PROJECTIVE_TRANSFORM (surface)) || \
+      ((feature_mask) & GLITZ_FEATURE_TEXTURE_BORDER_CLAMP_MASK) \
+     ) \
     ) \
    )

Index: glitz_program.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_program.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** glitz_program.c	9 Sep 2004 09:50:26 -0000	1.13
--- glitz_program.c	9 Sep 2004 23:09:03 -0000	1.14
***************
*** 100,128 ****
  
  /*
!  * general convolution filter (projective transformations might not
!  * produce correct results).
   */
  static const char *_convolution_header[] = {
    "PARAM p[%d] = { program.local[0..%d] };",
    "ATTRIB pos = fragment.texcoord[%s];",
!   "TEMP color, in, coord;",
  
    /* extra declerations */
    "%s"
! 
!   "MOV coord, pos;", NULL
  };
  
  static const char *_convolution_sample_first[] = {
!   "ADD coord.x, pos.x, p[0].x;",
!   "ADD coord.y, pos.y, p[0].y;",
!   "TXP in, coord, texture[%s], %s;",
    "MUL color, in, p[0].z;", NULL
  };
  
  static const char *_convolution_sample[] = {
!   "ADD coord.x, pos.x, p[%d].x;",
!   "ADD coord.y, pos.y, p[%d].y;",
!   "TXP in, coord, texture[%s], %s;",
    "MAD color, in, p[%d].z, color;", NULL
  };
--- 100,130 ----
  
  /*
!  * general convolution filter.
   */
  static const char *_convolution_header[] = {
    "PARAM p[%d] = { program.local[0..%d] };",
    "ATTRIB pos = fragment.texcoord[%s];",
!   "TEMP color, in, coord, position;",
  
    /* extra declerations */
    "%s"
!   
!   /* perspective divide */
!   "RCP position.w, pos.w;",
!   "MUL position, pos, position.w;", NULL
  };
  
  static const char *_convolution_sample_first[] = {
!   "MOV coord, 0.0;",
!   "ADD coord.x, position.x, p[0].x;",
!   "ADD coord.y, position.y, p[0].y;",
!   "TEX in, coord, texture[%s], %s;",
    "MUL color, in, p[0].z;", NULL
  };
  
  static const char *_convolution_sample[] = {
!   "ADD coord.x, position.x, p[%d].x;",
!   "ADD coord.y, position.y, p[%d].y;",
!   "TEX in, coord, texture[%s], %s;",
    "MAD color, in, p[%d].z, color;", NULL
  };
***************
*** 139,143 ****
  
    /* extra declerations */
!   "%s", NULL
  };
  
--- 141,149 ----
  
    /* extra declerations */
!   "%s",
! 
!   /* perspective divide */
!   "RCP position.w, pos.w;",
!   "MUL position, pos, position.w;", NULL
  };
  
***************
*** 151,156 ****
   */
  static const char *_linear_gradient_calculations[] = {
!   "MUL position.x, gradient.z, pos.x;",
!   "MAD position.x, gradient.w, pos.y, position.x;",
    "SUB position.z, position.x, gradient.x;",
    "MUL position.z, position.z, gradient.y;", NULL
--- 157,162 ----
   */
  static const char *_linear_gradient_calculations[] = {
!   "MUL position.x, gradient.z, position.x;",
!   "MAD position.x, gradient.w, position.y, position.x;",
    "SUB position.z, position.x, gradient.x;",
    "MUL position.z, position.z, gradient.y;", NULL
***************
*** 166,170 ****
   */
  static const char *_radial_gradient_calculations[] = {
!   "SUB position, pos, gradient;",
    "MUL position.x, position.x, position.x;",
    "MAD position.x, position.y, position.y, position.x;",
--- 172,176 ----
   */
  static const char *_radial_gradient_calculations[] = {
!   "SUB position, position, gradient;",
    "MUL position.x, position.x, position.x;",
    "MAD position.x, position.y, position.y, position.x;",
***************
*** 453,461 ****
    ((surface)? \
     (((surface)->texture.target == GLITZ_GL_TEXTURE_2D)? \
!     GLITZ_TEXTURE_2D: \
!     GLITZ_TEXTURE_RECT \
!     ) : \
     GLITZ_TEXTURE_NONE \
!    )
  
  glitz_gl_uint_t
--- 459,467 ----
    ((surface)? \
     (((surface)->texture.target == GLITZ_GL_TEXTURE_2D)? \
!      GLITZ_TEXTURE_2D: \
!      GLITZ_TEXTURE_RECT \
!    ) : \
     GLITZ_TEXTURE_NONE \
!   )
  
  glitz_gl_uint_t

Index: glitz_surface.c
===================================================================
RCS file: /cvs/cairo/glitz/src/glitz_surface.c,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** glitz_surface.c	9 Sep 2004 09:50:26 -0000	1.21
--- glitz_surface.c	9 Sep 2004 23:09:03 -0000	1.22
***************
*** 338,349 ****
      height = surface->texture.texcoord_height_unit * surface->texture.box.y1;
      
!     /* translate coordinates into texture. this only makes a difference when
         GL_ARB_texture_border_clamp is missing as box.x1 and box.y1 are
!        otherwise always zero. hmm, does this break projective
!        transformations? affine transformations should be fine */
      t[12] += surface->texture.texcoord_width_unit * surface->texture.box.x1;
      t[13] += surface->texture.texcoord_height_unit * surface->texture.box.y1;
  
      surface->flags |= GLITZ_SURFACE_FLAG_TRANSFORM_MASK;
    } else {
      if (surface->transform)
--- 338,351 ----
      height = surface->texture.texcoord_height_unit * surface->texture.box.y1;
      
!     /* Translate coordinates into texture. This only makes a difference when
         GL_ARB_texture_border_clamp is missing as box.x1 and box.y1 are
!        otherwise always zero. This breaks projective transformations so
!        those wont work without GL_ARB_texture_border_clamp. */
      t[12] += surface->texture.texcoord_width_unit * surface->texture.box.x1;
      t[13] += surface->texture.texcoord_height_unit * surface->texture.box.y1;
  
      surface->flags |= GLITZ_SURFACE_FLAG_TRANSFORM_MASK;
+     if (m[3] != 0.0f || m[7] != 0.0f || (m[15] != 1.0f && m[15] != -1.0f))
+       surface->flags |= GLITZ_SURFACE_FLAG_PROJECTIVE_TRANSFORM_MASK;
    } else {
      if (surface->transform)
***************
*** 352,355 ****
--- 354,358 ----
      surface->transform = NULL;
      surface->flags &= ~GLITZ_SURFACE_FLAG_TRANSFORM_MASK;
+     surface->flags &= ~GLITZ_SURFACE_FLAG_PROJECTIVE_TRANSFORM_MASK;
    }
  }

Index: glitzint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/glitzint.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** glitzint.h	9 Sep 2004 09:50:26 -0000	1.26
--- glitzint.h	9 Sep 2004 23:09:03 -0000	1.27
***************
*** 336,339 ****
--- 336,340 ----
  #define GLITZ_SURFACE_FLAG_EYE_COORDS_MASK              (1L << 15)
  #define GLITZ_SURFACE_FLAG_TRANSFORM_MASK               (1L << 16)
+ #define GLITZ_SURFACE_FLAG_PROJECTIVE_TRANSFORM_MASK    (1L << 17)
  
  #define SURFACE_OFFSCREEN(surface) \
***************
*** 387,390 ****
--- 388,394 ----
    ((surface)->flags & GLITZ_SURFACE_FLAG_TRANSFORM_MASK)
  
+ #define SURFACE_PROJECTIVE_TRANSFORM(surface) \
+   ((surface)->flags & GLITZ_SURFACE_FLAG_PROJECTIVE_TRANSFORM_MASK)
+ 
  typedef struct _glitz_sample_offset {
    glitz_float_t x;




More information about the cairo-commit mailing list