[cairo-commit] libglc/src glc_surface.c,1.22,1.23 glc_trap.c,1.14,1.15 glc_tri.c,1.12,1.13 glcint.h,1.25,1.26

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

Modified Files:
	glc_surface.c glc_trap.c glc_tri.c glcint.h 
Log Message:
Fixed polygon bounds

Index: glc_surface.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_surface.c,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** a/glc_surface.c	8 Mar 2004 00:20:28 -0000	1.22
--- b/glc_surface.c	13 Mar 2004 23:44:29 -0000	1.23
***************
*** 175,178 ****
--- 175,196 ----
  
  void
+ glc_surface_bounds (glc_surface_t *surface,
+                     glc_region_box_t *box)
+ {
+   box->y1 = MINSHORT;
+   box->y2 = MAXSHORT;
+   box->x1 = MINSHORT;
+   box->x2 = MAXSHORT;
+   
+   if (surface->programmatic || surface->repeat || surface->transform)
+     return;
+     
+   box->x1 = 0;
+   box->y1 = 0;
+   box->x2 = surface->width;
+   box->y2 = surface->height;
+ }
+ 
+ void
  glc_surface_set_transform (glc_surface_t *surface,
                             glc_transform_t *transform)

Index: glc_trap.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_trap.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** a/glc_trap.c	12 Mar 2004 09:44:19 -0000	1.14
--- b/glc_trap.c	13 Mar 2004 23:44:29 -0000	1.15
***************
*** 105,109 ****
  {
    glc_surface_t *mask;
!   glc_region_box_t bounds, mask_bounds;
    double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
--- 105,109 ----
  {
    glc_surface_t *mask;
!   glc_region_box_t trap_bounds, src_bounds, dst_bounds, bounds;
    double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
***************
*** 115,155 ****
    y_dst = traps[0].left.p1.y >> 16;
  
!   if (src->programmatic)
!     glc_programmatic_surface_setup (src, dst->width + x_src,
!                                     dst->height + y_src);
!     
!   glc_trapezoid_bounds (n_traps, traps, &bounds);
!   if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2 ||
!       bounds.x1 > dst->width || bounds.y1 > dst->height ||
!       bounds.x2 < 0 || bounds.y2 < 0)
!     return;
! 
!   if ((!src->repeat) && (!src->transform)) {
!     glc_region_box_t src_bounds;
! 
!     src_bounds.x1 = bounds.x1 - (x_src - x_dst);
!     src_bounds.y1 = bounds.y1 - (y_src - y_dst);
!     src_bounds.x2 = src->width - (x_src - x_dst);
!     src_bounds.y2 = src->height - (y_src - y_dst);
  
!     glc_intersect_region (&bounds, &src_bounds, &bounds);
!   }
  
!   mask_bounds.x1 = mask_bounds.y1 = 0;
!   mask_bounds.x2 = dst->width;
!   mask_bounds.y2 = dst->height;
!   glc_intersect_region (&bounds, &mask_bounds, &mask_bounds);
!   x_draw_offset = (double) -mask_bounds.x1;
!   y_draw_offset = (double) -mask_bounds.y1;
  
!   if (mask_bounds.x2 - mask_bounds.x1 <= 0 ||
!       mask_bounds.y2 - mask_bounds.y1 <= 0)
      return;
! 
!   mask = glc_surface_create_similar (dst,
!                                      GLC_STANDARD_A8,
!                                      mask_bounds.x2 - mask_bounds.x1,
!                                      mask_bounds.y2 - mask_bounds.y1);
! 
    if (!mask) {
      glc_surface_status_add (dst, GLC_STATUS_NOT_SUPPORTED_MASK);
--- 115,140 ----
    y_dst = traps[0].left.p1.y >> 16;
  
!   glc_trapezoid_bounds (n_traps, traps, &trap_bounds);
!   glc_surface_bounds (src, &src_bounds);
!   glc_surface_bounds (dst, &dst_bounds);
  
!   src_bounds.x1 += (x_dst - x_src);
!   src_bounds.y1 += (y_dst - y_src);
!   src_bounds.x2 += (x_dst - x_src);
!   src_bounds.y2 += (y_dst - y_src);
  
!   glc_intersect_region (&src_bounds, &trap_bounds, &bounds);
!   glc_intersect_region (&dst_bounds, &bounds, &bounds);
  
!   if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
      return;
!   
!   x_draw_offset = (double) -bounds.x1;
!   y_draw_offset = (double) -bounds.y1;
!   
!   mask = glc_surface_create_similar (dst, GLC_STANDARD_A8,
!                                      bounds.x2 - bounds.x1,
!                                      bounds.y2 - bounds.y1);
!   
    if (!mask) {
      glc_surface_status_add (dst, GLC_STATUS_NOT_SUPPORTED_MASK);
***************
*** 220,226 ****
                   mask,
                   dst,
!                  x_src + bounds.x1 - x_dst, y_src + bounds.y1 - y_dst,
                   0, 0,
!                  mask_bounds.x1, mask_bounds.y1,
                   mask->width, mask->height);              
    
--- 205,212 ----
                   mask,
                   dst,
!                  x_src + trap_bounds.x1 - x_dst,
!                  y_src + trap_bounds.y1 - y_dst,
                   0, 0,
!                  bounds.x1, bounds.y1,
                   mask->width, mask->height);              
    

Index: glc_tri.c
===================================================================
RCS file: /cvs/cairo/libglc/src/glc_tri.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** a/glc_tri.c	27 Feb 2004 14:46:23 -0000	1.12
--- b/glc_tri.c	13 Mar 2004 23:44:29 -0000	1.13
***************
*** 72,76 ****
  {
    glc_surface_t *mask;
!   glc_region_box_t bounds, mask_bounds;
    double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
--- 72,76 ----
  {
    glc_surface_t *mask;
!   glc_region_box_t tri_bounds, src_bounds, dst_bounds, bounds;
    double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
***************
*** 79,118 ****
    y_dst = tris[0].p1.y >> 16;
  
!   if (src->programmatic)
!     glc_programmatic_surface_setup (src, dst->width + x_src,
!                                     dst->height + y_src);
! 
!   glc_point_fixed_bounds (n_tris * 3, (glc_point_fixed_t *) tris, &bounds);
!   if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2 ||
!       bounds.x1 > dst->width || bounds.y1 > dst->height ||
!       bounds.x2 < 0 || bounds.y2 < 0)
!     return;
! 
!   if ((!src->repeat) && (!src->transform)) {
!     glc_region_box_t src_bounds;
  
!     src_bounds.x1 = bounds.x1 - (x_src - x_dst);
!     src_bounds.y1 = bounds.y1 - (y_src - y_dst);
!     src_bounds.x2 = src->width - (x_src - x_dst);
!     src_bounds.y2 = src->height - (y_src - y_dst);
  
!     glc_intersect_region (&bounds, &src_bounds, &bounds);
!   }
  
!   mask_bounds.x1 = mask_bounds.y1 = 0;
!   mask_bounds.x2 = dst->width;
!   mask_bounds.y2 = dst->height;
!   glc_intersect_region (&bounds, &mask_bounds, &mask_bounds);
!   x_draw_offset = (double) -mask_bounds.x1;
!   y_draw_offset = (double) -mask_bounds.y1;
!   
!   if (mask_bounds.x2 - mask_bounds.x1 <= 0 ||
!       mask_bounds.y2 - mask_bounds.y1 <= 0)
      return;
!     
!   mask = glc_surface_create_similar (dst,
!                                      GLC_STANDARD_A8,
!                                      mask_bounds.x2 - mask_bounds.x1,
!                                      mask_bounds.y2 - mask_bounds.y1);
    
    if (!mask) {
--- 79,103 ----
    y_dst = tris[0].p1.y >> 16;
  
!   glc_point_fixed_bounds (n_tris * 3, (glc_point_fixed_t *) tris, &tri_bounds);
!   glc_surface_bounds (src, &src_bounds);
!   glc_surface_bounds (dst, &dst_bounds);
  
!   src_bounds.x1 += (x_dst - x_src);
!   src_bounds.y1 += (y_dst - y_src);
!   src_bounds.x2 += (x_dst - x_src);
!   src_bounds.y2 += (y_dst - y_src);
  
!   glc_intersect_region (&src_bounds, &tri_bounds, &bounds);
!   glc_intersect_region (&dst_bounds, &bounds, &bounds);
  
!   if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
      return;
!   
!   x_draw_offset = (double) -bounds.x1;
!   y_draw_offset = (double) -bounds.y1;
!   
!   mask = glc_surface_create_similar (dst, GLC_STANDARD_A8,
!                                      bounds.x2 - bounds.x1,
!                                      bounds.y2 - bounds.y1);
    
    if (!mask) {
***************
*** 170,176 ****
                   mask,
                   dst,
!                  x_src + bounds.x1 - x_dst, y_src + bounds.y1 - y_dst,
                   0, 0,
!                  mask_bounds.x1, mask_bounds.y1,
                   mask->width, mask->height);
    
--- 155,162 ----
                   mask,
                   dst,
!                  x_src + tri_bounds.x1 - x_dst,
!                  y_src + tri_bounds.y1 - y_dst,
                   0, 0,
!                  bounds.x1, bounds.y1,
                   mask->width, mask->height);
    
***************
*** 189,193 ****
  {
    glc_surface_t *mask;
!   glc_region_box_t bounds, mask_bounds;
    double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
--- 175,179 ----
  {
    glc_surface_t *mask;
!   glc_region_box_t tri_bounds, src_bounds, dst_bounds, bounds;
    double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
***************
*** 199,238 ****
    y_dst = points[0].y >> 16;
  
!   if (src->programmatic)
!     glc_programmatic_surface_setup (src, dst->width + x_src,
!                                     dst->height + y_src);
! 
!   glc_point_fixed_bounds (n_points, points, &bounds);
!   if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2 ||
!       bounds.x1 > dst->width || bounds.y1 > dst->height ||
!       bounds.x2 < 0 || bounds.y2 < 0)
!     return;
! 
!   if ((!src->repeat) && (!src->transform)) {
!     glc_region_box_t src_bounds;
  
!     src_bounds.x1 = bounds.x1 - (x_src - x_dst);
!     src_bounds.y1 = bounds.y1 - (y_src - y_dst);
!     src_bounds.x2 = src->width - (x_src - x_dst);
!     src_bounds.y2 = src->height - (y_src - y_dst);
  
!     glc_intersect_region (&bounds, &src_bounds, &bounds);
!   }
  
!   mask_bounds.x1 = mask_bounds.y1 = 0;
!   mask_bounds.x2 = dst->width;
!   mask_bounds.y2 = dst->height;
!   glc_intersect_region (&bounds, &mask_bounds, &mask_bounds);
!   x_draw_offset = (double) -mask_bounds.x1;
!   y_draw_offset = (double) -mask_bounds.y1;
!   
!   if (mask_bounds.x2 - mask_bounds.x1 <= 0 ||
!       mask_bounds.y2 - mask_bounds.y1 <= 0)
      return;
!     
!   mask = glc_surface_create_similar (dst,
!                                      GLC_STANDARD_A8,
!                                      mask_bounds.x2 - mask_bounds.x1,
!                                      mask_bounds.y2 - mask_bounds.y1);
    
    if (!mask) {
--- 185,209 ----
    y_dst = points[0].y >> 16;
  
!   glc_point_fixed_bounds (n_points, points, &tri_bounds);
!   glc_surface_bounds (src, &src_bounds);
!   glc_surface_bounds (dst, &dst_bounds);
  
!   src_bounds.x1 += (x_dst - x_src);
!   src_bounds.y1 += (y_dst - y_src);
!   src_bounds.x2 += (x_dst - x_src);
!   src_bounds.y2 += (y_dst - y_src);
  
!   glc_intersect_region (&src_bounds, &tri_bounds, &bounds);
!   glc_intersect_region (&dst_bounds, &bounds, &bounds);
  
!   if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
      return;
!   
!   x_draw_offset = (double) -bounds.x1;
!   y_draw_offset = (double) -bounds.y1;
!   
!   mask = glc_surface_create_similar (dst, GLC_STANDARD_A8,
!                                      bounds.x2 - bounds.x1,
!                                      bounds.y2 - bounds.y1);
    
    if (!mask) {
***************
*** 285,291 ****
                   mask,
                   dst,
!                  x_src + bounds.x1 - x_dst, y_src + bounds.y1 - y_dst,
                   0, 0,
!                  mask_bounds.x1, mask_bounds.y1,
                   mask->width, mask->height);
  
--- 256,263 ----
                   mask,
                   dst,
!                  x_src + tri_bounds.x1 - x_dst,
!                  y_src + tri_bounds.y1 - y_dst,
                   0, 0,
!                  bounds.x1, bounds.y1,
                   mask->width, mask->height);
  
***************
*** 304,308 ****
  {
    glc_surface_t *mask;
!   glc_region_box_t bounds, mask_bounds;
    double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
--- 276,280 ----
  {
    glc_surface_t *mask;
!   glc_region_box_t tri_bounds, src_bounds, dst_bounds, bounds;
    double x_draw_offset, y_draw_offset;
    int x_dst, y_dst;
***************
*** 314,353 ****
    y_dst = points[0].y >> 16;
  
!   if (src->programmatic)
!     glc_programmatic_surface_setup (src, dst->width + x_src,
!                                     dst->height + y_src);
! 
!   glc_point_fixed_bounds (n_points, points, &bounds);
!   if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2 ||
!       bounds.x1 > dst->width || bounds.y1 > dst->height ||
!       bounds.x2 < 0 || bounds.y2 < 0)
!     return;
! 
!   if ((!src->repeat) && (!src->transform)) {
!     glc_region_box_t src_bounds;
  
!     src_bounds.x1 = bounds.x1 - (x_src - x_dst);
!     src_bounds.y1 = bounds.y1 - (y_src - y_dst);
!     src_bounds.x2 = src->width - (x_src - x_dst);
!     src_bounds.y2 = src->height - (y_src - y_dst);
  
!     glc_intersect_region (&bounds, &src_bounds, &bounds);
!   }
  
!   mask_bounds.x1 = mask_bounds.y1 = 0;
!   mask_bounds.x2 = dst->width;
!   mask_bounds.y2 = dst->height;
!   glc_intersect_region (&bounds, &mask_bounds, &mask_bounds);
!   x_draw_offset = (double) -mask_bounds.x1;
!   y_draw_offset = (double) -mask_bounds.y1;
!   
!   if (mask_bounds.x2 - mask_bounds.x1 <= 0 ||
!       mask_bounds.y2 - mask_bounds.y1 <= 0)
      return;
!     
!   mask = glc_surface_create_similar (dst,
!                                      GLC_STANDARD_A8,
!                                      mask_bounds.x2 - mask_bounds.x1,
!                                      mask_bounds.y2 - mask_bounds.y1);
    
    if (!mask) {
--- 286,310 ----
    y_dst = points[0].y >> 16;
  
!   glc_point_fixed_bounds (n_points, points, &tri_bounds);
!   glc_surface_bounds (src, &src_bounds);
!   glc_surface_bounds (dst, &dst_bounds);
  
!   src_bounds.x1 += (x_dst - x_src);
!   src_bounds.y1 += (y_dst - y_src);
!   src_bounds.x2 += (x_dst - x_src);
!   src_bounds.y2 += (y_dst - y_src);
  
!   glc_intersect_region (&src_bounds, &tri_bounds, &bounds);
!   glc_intersect_region (&dst_bounds, &bounds, &bounds);
  
!   if ((bounds.x2 - bounds.x1) <= 0 || (bounds.y2 - bounds.y1) <= 0)
      return;
!   
!   x_draw_offset = (double) -bounds.x1;
!   y_draw_offset = (double) -bounds.y1;
!   
!   mask = glc_surface_create_similar (dst, GLC_STANDARD_A8,
!                                      bounds.x2 - bounds.x1,
!                                      bounds.y2 - bounds.y1);
    
    if (!mask) {
***************
*** 400,406 ****
                   mask,
                   dst,
!                  x_src + bounds.x1 - x_dst, y_src + bounds.y1 - y_dst,
                   0, 0,
!                  mask_bounds.x1, mask_bounds.y1,
                   mask->width, mask->height);
  
--- 357,364 ----
                   mask,
                   dst,
!                  x_src + tri_bounds.x1 - x_dst,
!                  y_src + tri_bounds.y1 - y_dst,
                   0, 0,
!                  bounds.x1, bounds.y1,
                   mask->width, mask->height);
  

Index: glcint.h
===================================================================
RCS file: /cvs/cairo/libglc/src/glcint.h,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** a/glcint.h	8 Mar 2004 00:20:28 -0000	1.25
--- b/glcint.h	13 Mar 2004 23:44:29 -0000	1.26
***************
*** 393,396 ****
--- 393,400 ----
  
  extern void __internal_linkage
+ glc_surface_bounds (glc_surface_t *surface,
+                     glc_region_box_t *box);
+ 
+ extern void __internal_linkage
  glc_surface_enable_program (glc_program_type_t type,
                              glc_surface_t *surface,





More information about the cairo-commit mailing list