[cairo-commit] libglc/src glc.c,1.15,1.16 glc_glx_surface.c,1.11,1.12

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-serv17151/src

Modified Files:
	glc.c glc_glx_surface.c 
Log Message:
Sub-pixel positioning fixes

Index: glc.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** glc.c	10 Feb 2004 23:38:36 -0000	1.15
--- glc.c	11 Feb 2004 01:42:14 -0000	1.16
***************
*** 34,39 ****
  #include <math.h>
  
- #define GLC_ROUND(value) (floor (value + 0.5))
- 
  #define TRANSFORM(surface) \
    (surface->transform)
--- 34,37 ----
***************
*** 83,91 ****
    if (TRANSFORM (src) || TRANSFORM (mask)) {
  
!     /* If transform is a simple translation we can emulate this
         by shifting destination coordinates. */
!     if ((!TRANSFORM (mask)) && TRANSLATE (src)) {
!       x_dst += GLC_ROUND (src->transform->m[2][0]);
!       y_dst += GLC_ROUND (src->transform->m[2][1]);
      } else
        return 0;
--- 81,93 ----
    if (TRANSFORM (src) || TRANSFORM (mask)) {
  
!     /* If transform is a simple integer translation we can emulate this
         by shifting destination coordinates. */
!     if ((!TRANSFORM (mask)) && TRANSLATE (src) &&
!         (((double) ((int) src->transform->m[2][0])) ==
!          src->transform->m[2][0]) &&
!         (((double) ((int) src->transform->m[2][1])) ==
!          src->transform->m[2][1])) {
!       x_dst += (int) src->transform->m[2][0];
!       y_dst += (int) src->transform->m[2][1];
      } else
        return 0;
***************
*** 471,481 ****
      glBegin (GL_QUADS);
      glTexCoord2d (0.0, repeat_factor_y);
!     glVertex2i (GLC_ROUND (tl.x), GLC_ROUND (tl.y));
      glTexCoord2d (repeat_factor_x, repeat_factor_y);
!     glVertex2i (GLC_ROUND (tr.x), GLC_ROUND (tr.y));
      glTexCoord2d (repeat_factor_x, 0.0);
!     glVertex2i (GLC_ROUND (br.x), GLC_ROUND (br.y));
      glTexCoord2d (0.0, 0.0);
!     glVertex2i (GLC_ROUND (bl.x), GLC_ROUND (bl.y));
      glEnd ();
      
--- 473,483 ----
      glBegin (GL_QUADS);
      glTexCoord2d (0.0, repeat_factor_y);
!     glVertex2d (tl.x, tl.y);
      glTexCoord2d (repeat_factor_x, repeat_factor_y);
!     glVertex2d (tr.x, tr.y);
      glTexCoord2d (repeat_factor_x, 0.0);
!     glVertex2d (br.x, br.y);
      glTexCoord2d (0.0, 0.0);
!     glVertex2d (bl.x, bl.y);
      glEnd ();
      
***************
*** 556,568 ****
          
          glBegin (GL_QUADS);
!         glTexCoord2d (0.0, texture->texcoord_height - 0.0001);
!         glVertex2i (GLC_ROUND (tl.x), GLC_ROUND (tl.y));
!         glTexCoord2d (texture->texcoord_width - 0.0001,
!                       texture->texcoord_height - 0.0001);
!         glVertex2i (GLC_ROUND (tr.x), GLC_ROUND (tr.y));
!         glTexCoord2d (texture->texcoord_width - 0.0001, 0.0);
!         glVertex2i (GLC_ROUND (br.x), GLC_ROUND (br.y));
          glTexCoord2d (0.0, 0.0);
!         glVertex2i (GLC_ROUND (bl.x), GLC_ROUND (bl.y));
          glEnd ();
  
--- 558,570 ----
          
          glBegin (GL_QUADS);
!         glTexCoord2d (0.0, texture->texcoord_height);
!         glVertex2d (tl.x, tl.y);
!         glTexCoord2d (texture->texcoord_width,
!                       texture->texcoord_height);
!         glVertex2d (tr.x, tr.y);
!         glTexCoord2d (texture->texcoord_width, 0.0);
!         glVertex2d (br.x, br.y);
          glTexCoord2d (0.0, 0.0);
!         glVertex2d (bl.x, bl.y);
          glEnd ();
  

Index: glc_glx_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_glx_surface.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** glc_glx_surface.c	10 Feb 2004 23:38:36 -0000	1.11
--- glc_glx_surface.c	11 Feb 2004 01:42:14 -0000	1.12
***************
*** 165,169 ****
      _glc_glx_proc_address.glx_bind_tex_image_ati
        (surface->screen_info->display_info->display, surface->pbuffer,
!        (surface->format->doublebuffer)? GLX_BACK_LEFT_ATI: GLX_FRONT_LEFT_ATI);
  #endif
      
--- 165,170 ----
      _glc_glx_proc_address.glx_bind_tex_image_ati
        (surface->screen_info->display_info->display, surface->pbuffer,
!        (surface->base.format->doublebuffer)?
!        GLX_BACK_LEFT_ATI: GLX_FRONT_LEFT_ATI);
  #endif
      
***************
*** 352,356 ****
      _glc_glx_proc_address.glx_release_tex_image_ati
        (surface->screen_info->display_info->display, surface->pbuffer,
!        GLX_FRONT_LEFT_ATI);
  #endif
      
--- 353,358 ----
      _glc_glx_proc_address.glx_release_tex_image_ati
        (surface->screen_info->display_info->display, surface->pbuffer,
!        (surface->base.format->doublebuffer)?
!        GLX_BACK_LEFT_ATI: GLX_FRONT_LEFT_ATI);
  #endif
      





More information about the cairo-commit mailing list